Thanks for your explanation.

The systemObject class does have the Remote alias metadata which points to a Java class, i found a way to reproduce the same mistake using Flex 2 samples (the crm example) here's the url of my post on the adobe forums about this bug (it contains the debugger output):

http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=60&catid=585&threadid=1202566&enterthread=y

I am using Datagrids so i don't think it will be a good idea to override the uid, if after reading the post on the forum you come up with a solution please please let me know, i have been working on this for a couple of weeks and still haven't been able to solve it.

Thanks a lot again


Jeff Vroom <[EMAIL PROTECTED]> escribió:
Let me first give you a quick overview on how this works, then I’ll discuss how to diagnose it further.
 
When the fill call is sent to the server, it serializes the fill parameters from client to server.  The server then stores the fill parameters in a java representation.  When that fill is updated, an update collection message is sent to the client which contains the fill parameters as well.  Now these get converted to ActionScript objects again.  We then go through the existing fills on the client and call ObjectUtil.compare to see if they are the same.  This compares the class name and if they match, it will do a property-by-property comparison.
 
In your case, FDMS is likely not seeing “systemObject” as being the same when it gets serialized to the server and comes back again.  One common problem is that managed objects can end up with a “uid” property which gets set to a universally unique id by default on each instance.  When you serialize the object to the server and get it back again, the uid property is not the same so the client thinks it was pushed an update collection message for a different fill.  This is probabl not your problem but if systemObject is a strongly typed AS class which does not map to a Java class, the type can be lost when going from client to server.  When it comes back again it will not match (you need to use [RemoteClass] either with no argument as a signal to preserve the strong AS type or with an alias argument that points to a corresponding Java class that has the same public properties).  
 
These problems can be tricky to figure out so I usually recommend that folks stick with primitive values in the fill parameters.  If you do need this to work, I recommend trying to send systemObject to dummy Java method which just returns the argument passed and see if the result compares against ObjectUtil.compare.  You can probably dig into it in the debugger to figure out why it is not comparing.  I think that if you initialize “uid” to a default value it will override the auto-generating of the unique uid, but be careful if you use this object in a DataGrid or other list based component as those components use the uid to differentiate objects.
 
I hope this helps.
 
Jeff
 

From: [EMAIL PROTECTED]ups.com [mailto:[EMAIL PROTECTED]ups.com] On Behalf Of dmiramontesval
Sent: Thursday, October 05, 2006 5:50 PM
To: [EMAIL PROTECTED]ups.com
Subject: [flexcoders] Possible DataService BUG, can anyone help me out?
 
Hello everyone i have a bug when using the DataService component. I am
using a Java Assembler which extends from AbstractAssembler and has
the implementation of the DataService's methods (fill, createItem,
deleteItem, updateItem). My fill method implementation does certain
logic based on the number of parameters passed and calls a Java method
to obtain the result Collection.
Now on Flex i am calling the fill method and i pass an AS object (that
has remote alias metadata), which has a Java equivalent class. I am
calling it like this:

dataService.fill(arrayCollection, systemObject);

where systemObject is an instance of an AS class (which i will call
sysObj) that, like i mentioned, has a Java equivalent.

On Java the fill is like this:

public Collection fill (List fillParameters) {
SysObj a = (SysObj) fillParameters.get(0);
List results = dao.findRoles (a.getId() );
return results;
}

Now, when i add an item using the createItem method and then calling
the commit() method, the autoRefresh is executed calling once again
the fill method. This should trigger a CollectionChange event which
will automerge and autorefresh the ArrayCollection showing the
recently added item, the thing is that this IS NOT happening. I
debugged my Java code and it is indeed executing the fill method as a
result of the autoRefresh, but for some reason the ArrayCollection is
not receiving the notification.
If on Flex I manually call the fill method again,
dataService.fill(arrayCollection, systemObject), then i can see the
recently added item.

Now let's modify the flex and java code to be like this:

dataService.fill(arrayCollection, systemObject.id);

passing the object's id only to Java, which code changed to:

public Collection fill (List fillParameters) {
List results = dao.findRoles (fillParameters.get(0));
return results;
}

As you can see i am now sending and int value, then after createItem()
and commit() the autorefreshed is executed and the ArrayCollection IS
being refreshed too, showing the recently added item.

So in conclusion, when i send an AS object as a parameter of the fill
method, when the autoRefresh is executed it doesn't work but when i
send a primitive type (int) it does work. Is this a bug? Can't we pass
AS objects to the Assembler?? Like i said my AS object has a Java
equivalent class.

Please if anyone knows how to solve this please let me know


Do You Yahoo!? La mejor conexión a Internet y 2GB extra a tu correo por $100 al mes. http://net.yahoo.com.mx __._,_.___

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com





SPONSORED LINKS
Software development tool Software development Software development services
Home design software Software development company

Your email settings: Individual Email|Traditional
Change settings via the Web (Yahoo! ID required)
Change settings via email: Switch delivery to Daily Digest | Switch to Fully Featured
Visit Your Group | Yahoo! Groups Terms of Use | Unsubscribe

__,_._,___

Reply via email to