Wednesday, November 3, 2010

RequestFactory and Collections

Hi,

I am working on an example application to learn about RequestFactory
and the new Editor framework. The idea is to edit a Recipe, which has
multiple ingredients. The ingredients are displayed in CellTable. This
still involves a couple of problems (e.g.,
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/1725bc619a4459ab#
), but I got it working to the point, where the Request seems to be
correcty set up and contains the edited RecipeProxy as well as
multiple IngredientProxy instances.

When I edit a direct property of the Recipe, eg the name (String), on
the server Recipe.persist() is called and I can save the updated
object easily (I am using Objectify for this).

However, when I am editing a String property "text" on one of the
Ingredients, Ingredient.persist is NOT called for the edited
instance.

I looked at the raw JSON of the request made, and it seems to include
the updated Ingredient instance. Unfortunately, the DynatableRf and
the Expenses examples don't deal with n-ary relationships on the
entities. How is this done? Are there any more naming conventions for
handling collections?

My proxy interfaces currently look like this:

@ProxyFor(Ingredient.class)
public interface IngredientProxy extends EntityProxy {

String getId();

String getText();

void setText(String text);

@Override
EntityProxyId<IngredientProxy> stableId();

}

@ProxyFor(Recipe.class)
public interface RecipeProxy extends EntityProxy {

long getId();

String getName();

void setName(String name);

@Override
EntityProxyId<RecipeProxy> stableId();

List<IngredientProxy> getIngredients();

void setIngredients(List<IngredientProxy> ingredients);
}

Regards,
Tobias

--
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