Alan,
 
I got you on the docs - but here's what I don't get - an ArrayCollection
is just a wrapper around an Array and is intended for the client.
Personally, I wouldn't bother trying to translate an ArrayCollection to
my backend, and vice versa regardless of whether I'm using CF, Java, or
whatever else.
 
My suggestion is to dumb this down - you should be able to translate an
Array of strongly typed objects without any difficulty.  And your boss
will be happy.  If you need an ArrayCollection in your client, simply
create one with your returned array.
 
Jeff

        -----Original Message-----
        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Alan Prather
        Sent: Wednesday, April 30, 2008 11:25 AM
        To: [email protected]
        Subject: RE: [flexcoders] BlazeDS, List of VOs inside a VOs
won't translate
        
        

        Sorry, I did have it declared correctly but still no luck. I am
SO stuck and my boss is on my tail like mad now :-(

         

        The actual code (I had typed the email manually) has it declared
properly as:

         

        public var urlButtons: ArrayCollection;

         

        on the Flex side, and it's declared as a List (that ultimately
contains instances of the class UrlButtons, which I have a mirror of on
the Flex side.

        The flex class has the proper [RemoteClass(alias= tag in front
of it. 

         

        Is it that I have an ArrayCollection of a strongly typed object?
I'd figure if the compiler built the VO and saw the
[RemoteClass(alias="com.plateau.etc.etc.")] directive pointing to the
back end class, it would know what to do when it got an ArrayCollection
containing instances of that.

        Is it that that ArrayCollection is a property of another
translated class?

         

        Eg: (forgive the pseudo-code, it's faster)

         

        MyClass  {

         

         public urlButtons ArrayCollection;

         

        }

         

        Where urlButtons is an AC of instances of the UrlButtons class,
a VO declared on the Java side and having an equivalent VO class on the
Flex side, properly tagged with the RemoteClass var. What I find odd is
that Charles Web Debugging Proxy's AMF inspection shows that particular
property with the proper Java class name and namespace, but it shows as
"External Object" instead of just "Object"

         

        As this is just a demo, the SWF is embedded in a JSP and I can't
really debug it without some hacking of the template since we have an
authentication hack in there that requires the hand-written JSPs help in
getting the session over the JavaScript bridge to Flex. Otherwise I
might be able to get more info.

         

        All I know is Flex thinks that ArrayCollection is translating as
a plain old Object and throws an exception. (But it does expand out in
Charles just fine.)

         

        What on earth am I doing wrong, possibly?

         

        -Alan

         

        
________________________________


        From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Robert Cadena
        Sent: Tuesday, April 29, 2008 4:15 PM
        To: [email protected]
        Subject: Re: [flexcoders] BlazeDS, List of VOs inside a VOs
won't translate

         

        Hi Alan,
        
        the declaration of the urlButtons field in the AS object is a
little off.  it might just be that you typed it in, but just in case, it
should be:
        
        public var urlButtons:ArrayCollection;
        
        
        The value type should be converted automatically. I have an
application running that has a list in the java side and maps
automatically to an arraycollection.  have you tried just putting a
breakpoint before the foreach in FB and then inspecting the result,
first making sure that the CatalogItemVOX is actually getting mapped to
the response objects you received.  After that, I'd manually inspect the
CatalogItemVOX and see what its fields are.  so, basically, inspect
"data" and make sure its type is CatalogItemVOX.  use the fb3 debugger
too.
        
        /r
        
        
        
        
        
        

        On Tue, Apr 29, 2008 at 11:03 AM, Alan Prather
<[EMAIL PROTECTED]> wrote:

        Jeff,

         

        According to the documentation, all Java Collections will be
automatically translated to an ArrayCollection on the front end. That
seems to be the case for the list of parent VOs, but within them my
lists don't translate to ArrayCollection. I'm not sure why, but it's
something I can expand out in Charles, but I can't get it to cast to
anything in Flex (EG, trying to cast it to ArrayCollection throws an
exception. It's really weird.

         

        Something tells me that the reference to 'external object' in
Charles must be a clue! Thanks for your input Jeff!

         

        Help! Anyone? Anyone?

         

        -Alan

         

         

        
________________________________


        From: [email protected]
<mailto:[email protected]>  [mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of Battershall, Jeff
        Sent: Tuesday, April 29, 2008 1:55 PM
        To: [email protected]
<mailto:[email protected]> 
        Subject: RE: [flexcoders] BlazeDS, List of VOs inside a VOs
won't translate

         

        Alan,

         

        I know in LCDS that there isn't an analog for ArrayCollection.
I'd try having your nested VOs be simply  an array and if you need to
create an ArrayCollection on the client side do so using your array of
VOs as the source attribute.

         

        Jeff

                -----Original Message-----
                From: [email protected]
<mailto:[email protected]>  [mailto:[email protected]
<mailto:[email protected]> ] On Behalf Of Alan Prather
                Sent: Tuesday, April 29, 2008 12:08 PM
                To: [email protected]
<mailto:[email protected]> 
                Subject: [flexcoders] BlazeDS, List of VOs inside a VOs
won't translate

                Hi all,

                 

                I'm having trouble with BlazeDS and a particular VO that
lives inside another VO. The parent VO translates just fine, but I can't
cast the ArrayCollection of VOs inside that for the LIFE of me. 

                Actually the smaller one is a List in Java, so I am
trying to cast it to ArrayCollection.

                 

                I get the error: (And I know it to be from the below
ArrayCollection/list:-)

                TypeError: Error #1034: Type Coercion failed: cannot
convert [EMAIL PROTECTED] to mx.collections.ArrayCollection.

                 

                This occurs when I try and iterate through the list of
urlButtonVOs. I've tried casting it to an ArrayCollection with NO luck.

                Charles Web Debugging proxy tags it as an "External
Object" and recognizes it's Java class name. Every other object is an
Object in Charles. What makes this one special? It's an AC of a custom
Object, which has a definition and RemoteClass tag on the Flex side to
match.

                 

                On the Java side I have:

                public class CatalogItemVOX implements Serializable {

                 

                ......
                protected List urlButtons;

                .....

                }

                 

                And urlButtons happens to be a List of a class called
UrlButtonVO. It won't translate to an ArrayCol

                 

                On the ActionScript side I have:

        
[RemoteClass(alias="com.plateausystems.elms.client.struts.learner.catalo
g.CatalogItemVOX")]

                      public class CatalogItemVOX {

                            ...
                
                

                            public ArrayCollection urlButtons;

                            ...

                      }

                 

                 

                I'm TOTALLY stuck. The info shows up in Charles, but I
can't get it to be recognized as an AC of that object type. Here's where
the exception is thrown: (The for each) casting data.urlButtons to an AC
doesn't work either. BTW: It's inside an item renderer)

                 

                                  public function onCreationComplete():
void 

                                  {

                                              var buttonID: int=0;

                                              for each(var button:
UrlButtonVO in data.urlButtons) {

                                                    var newButton:
URLButton= new URLButton();

        
newButton.id=String("button"+String(buttonID));

                                                    newButton.label=
button.label;

                                                    newButton.URL=
button.url;    

        
newButton.addEventListener(MouseEvent.CLICK, buttonClickHandler);


                                                    

        
this.addChildAt(newButton, buttonID);

                                                    buttonID++;

                                              }

                                  }

                 

                Thanks in advance to anyone that can help!

                ______________________________

                -Alan Prather

                .
                The information contained in this e-mail message is
intended only for the personal 
                and confidential use of the recipient(s) named above.
This message is privileged 
                and confidential. If the reader of this message is not
the intended recipient or an
                agent responsible for delivering it to the intended
recipient, you are hereby notified 
                that you have received this document in error and that
any review, dissemination, 
                distribution, or copying of this message is strictly
prohibited.

        .
        The information contained in this e-mail message is intended
only for the personal 
        and confidential use of the recipient(s) named above. This
message is privileged 
        and confidential. If the reader of this message is not the
intended recipient or an
        agent responsible for delivering it to the intended recipient,
you are hereby notified 
        that you have received this document in error and that any
review, dissemination, 
        distribution, or copying of this message is strictly prohibited.

         

        

         
        .
        The information contained in this e-mail message is intended
only for the personal 
        and confidential use of the recipient(s) named above. This
message is privileged 
        and confidential. If the reader of this message is not the
intended recipient or an
        agent responsible for delivering it to the intended recipient,
you are hereby notified 
        that you have received this document in error and that any
review, dissemination, 
        distribution, or copying of this message is strictly prohibited.
        

Reply via email to