Sunday, May 1, 2011

Using request factory to keep the object graph up to date

We are using RequestFactory to create the object based on the user action.  

For example, Person has many Contact . We are using a contacts view to create the Contacts for the Person. 

When the user clicks on "Create" we are using ContactProxy and ContactRequest to create the object. 
When the user clicks on "Create" again, we already have the contact, but we want to create the Contact only if it does not exist for the Person. What is the best place to verify the contact is already existing.

ContactRequest cr = rf.contactRequest();
cr.create(contact).fire(new Receiver() {
 public void onSuccess(Contact contact) 
 {
log.info("Contact created");
 }
}

How do we update the person's contact list just after a new contact is created. is onSuccess the right place to do that. Basically i am not clear on how to keep the object graph in sync with the server. The RF documentation says it always keeps the objects in sync. But it is not happening in our case though.

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-web-toolkit@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

No comments:

Post a Comment