> Why would BasicUserService ( = GizmoService?) be called if you invoke
> UserRequest#persist(UserProxy) ( = ThingRequest#persist(ThingProxy) ?)
Because BasicUserProxy is part of UserProxy.
> It's hard to follow what you're expecting given that you switched from
> thing/gizmo/setSomething to [something-else]/user/basicUser/set[what?]
I wanted to keep it generic but see below.
> Could you post the actual code that led to the request whose payload you
> posted already?
Here you go:
final UserRequest userRequest =
domainRequestApi.getRequestBuilder().newUserRequest();
final UserProxy mutableUser =
userRequest.edit(domainRequestApi.getCache().getCurrentUser());
final BasicUserProxy mutableBasicUser = mutableUser.getBasicUser();
final int level = mutableBasicUser.getLevel();
final int basicCurrencyDelta = ...;
final int premiumCurrencyDelta = ...;
final int newLevel = level + 1;
final String comment = "Level Up to Level " + newLevel + ".";
mutableBasicUser.setLevel(newLevel);
final Receiver<Integer> levelUpReceiver = new LevelUpReceiver(...,
mutableUser, comment, basicCurrencyDelta, premiumCurrencyDelta);
userRequest.persist(mutableUser).fire(levelUpReceiver);
LevelUpReceiver's onSuccess simply fires some events, including one
that sends out the by then presumably updated UserProxy (hence the
mutableUser in the constructor).
Given that BasicUserProxy is part of UserProxy, I would expect its
changes to be stored, i.e. I expect the entire object graph that is
UserProxy to be stored (as necessary).
Just to be complete:
@ProxyForName(value = "com.company.domain.api.User", locator =
"com.company.domain.service.api.UserService")
public interface UserProxy extends EntityProxy
{
BasicUserProxy getBasicUser();
void setBasicUser(BasicUserProxy basicUser);
... a few others ...
}
@ProxyForName(value = "com.company.domain.api.BasicUser", locator =
"com.company.domain.service.api.BasicUserService")
public interface BasicUserProxy extends EntityProxy
{
int getLevel();
void setLevel(int level);
... a few others ...
}
In very short pseudo code, what I want to happen is the following:
User.BasicUser.Level := User.BasicUser.Level + 1;
Persist User (or BasicUser, I don't care);
Make sure that User.BasicUser.Level == BasicUser.Level, i.e. User's
BasicUser should be the newly updated one.
(I've tried persisting User but then BasicUser's changes are ignored;
persisting BasicUser works but then User references an outdated
BasicUser; I tried using the Editor framework but that didn't make any
difference either.)
--
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