[Arp] How to Set up Netconnection for Coldfusion?

Tien Nguyen sufibaba at gmail.com
Sun Jan 8 12:10:47 PST 2006


Hi Chris,

Thanks for having a look at this.

I had a deeper look into how the Birthday code works.  It turns out that in
the Birthday example's QueryScreen.as, the returned resultset is treated as
an array of Java Objects of class PersonVO which talks to a PersonVO.java
class .

Coldfusion's ResultSet, on the other hand, given the way I had my CFC
configured, returned to Flash a RecordSet object.

After the ResultSet is returned to QueryScreen.as, newPersonList() is called
to map the ResultSet into a PersonVO and sent to the contacts_cb combo box.

So inorder for the example to work with coldfusion, I had to do the
following:

1.  Changed the QueryScreen.newPersonList( ) code to parse a RecordSet
object.

  The following code is inside of QueryScreen.as

   // top of  QueryScreen.as before class definition.
    import.remoting.RecordSet

    // inside of QueryScreen.as class definition

    private var PersonVOData:Object;
    private var personRec:RecordSet;


////////////////////////////////////////////////////////////////////////////
    // newPersonList()

////////////////////////////////////////////////////////////////////////////
    public function newPersonList ( personList:RecordSet )
    {
        var personData= new RecordSet;
        var personData = personList;

        trace ("INFO QueryScreen::newPersonList");

        // clear the combo box so subsequent calls do not add duplicates
        contacts_cb.removeAll();
        //contacts_cb.dataProvider = personData;
        //
        // Add the names and VOs to the combo box, in reverse order
        //

        var i = personData.getLength();

        trace("PersonListLength=" + i);

        while ( i-- )
        {
            trace("thePersonVO-i=" + i);

            var personRec:Object =  personList.getItemAt(i);
            PersonVOData.rsProperties = personRec;

            var fullName:String;
            fullName = personRec.forename + " "  + personRec.surname;

            // Note how we are adding thePersonVO as the data so we
            // always have a reference to it. We only pass VOs around.
            contacts_cb.addItem( fullName, PersonVOData );
        }

        // Hotwire the change event on the combobox to
        // get the initial date of birth.
        change();
    }

2.  Changed the PersonVO.as class

class com.ariaware.birthday.vo.PersonVO
{
    //
    // Properties
    //
    private var __forename:String;
    private var __surname:String;
    private var __dob:String;


////////////////////////////////////////////////////////////////////////////
    // Constructor

////////////////////////////////////////////////////////////////////////////


    private var __rsProperties:Object;


   public function PersonVO(rsProperties:Object) {
        this.__rsProperties = rsProperties;
    }
    public function get rsProperties():Object {
        return this.__rsProperties;
    }
    public function set rsProperties(value:Object):Void {
        this.__rsProperties = value;
    }



////////////////////////////////////////////////////////////////////////////
    // toString()

////////////////////////////////////////////////////////////////////////////
    public function toString():String
    {
        var str =
        "Instance of : com.ariaware.birthday.vo.PersonVO\n" +
        "\tForename: " +  __forename + "\n" +
        "\tSurname: " +  __surname + "\n" +
        "\tDate of Birth: " +  __dob;
        return str;
    }
}

Note: the above changes were a first cut get things working.  I didn't have
a chance to see how converting the PersonVO to the above object would impact
the rest of the Birthday code.  However, a unified solution for Java,
Coldfusion, etc.  would be best.

Perhaps this backend remoting issue for various platforms -- including
coldfusion have already been discussed amongst ARP gurus before.  If anyone
have comments regarding this situation, please do jump in.

Cheers,






On 1/8/06, Chris Velevitch <chris.velevitch at gmail.com> wrote:
>
> On 1/8/06, Tien Nguyen <sufibaba at gmail.com> wrote:
> >         <cfquery datasource="PersonData" name="myResult">
> >             Select * from person
> >         </cfquery>
> >
> >         <cfreturn myResult>
>
> In Flash the type of myResult is ResultEvent class. Show me your code
> that you are using to exact the data from return from the call to
> Coldfusion. It would be the onResultOperation function you defined in
> you Command class executeOperation function that contains a line
> similar to:-
>
>      pendingCall.responder = new RelayResponder(this,
> "onResultOperation", "onStatusOperation");
>
> The function declaration should be similar to:-
>
>         public function onResultOperation (resultObj:ResultEvent):Void
> {...}
>
> I want to see how you are getting the data out of the resultObj variable.
>
>
> Chris
> --
> Chris Velevitch
> Manager - Sydney Flash Platform Developers Group
> www.flashdev.org.au
>
> _______________________________________________
> Arp mailing list
> Arp at ariaware.com
> http://ariaware.com/mailman/listinfo/arp_ariaware.com
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ariaware.com/pipermail/arp_ariaware.com/attachments/20060108/179f94be/attachment.htm


More information about the Arp mailing list