Also note RequestFactory#find(EntityProxyId)

On Tue, Sep 28, 2010 at 10:26 AM, Ray Ryan <rj...@google.com> wrote:

>
>
> On Tue, Sep 28, 2010 at 10:13 AM, Patrick Julien <pjul...@gmail.com>wrote:
>
>> It's not very clear to me how EntityProxyId helps us achieve very
>> simple scenarios.
>>
>> How do you use this thing when you have pre and post operations to do
>> in an activity?
>>
>> If I have an edit scenario, let's say a user with a list of phones,
>> normally, I would follow something like this:
>>
>> 1. Set the record in the activity
>> 2. Start the activity
>> 3. In start, get the id of the user and list the phones
>> 4. When I receive the phone, I show the display of the edit activity
>>
>> I don't see how this is done anymore with EntityProxyId.  How do I get
>> my phone numbers?  On the client side, the only member EntityProxyId
>> has is getClass(), what I'm a suppose to give to the server to find my
>> phone numbers?
>>
>
> There is nothing stopping you from making your real ID part of your public
> API. We no longer force you to expose getId on the client, but you're still
> allowed to.
>
>
>>
>> It's the same problem if you want to do something post save.  If I
>> want to save the phones of a newly created user, I would do:
>>
>> 1. Exit is called from AbstractProxyEditActivity
>> 2. Save the user
>> 3. Get the id of the newly created user
>> 4. Attach the phone numbers to the newly created user
>>
>> Again, here, with EntityProxyId, I have no idea how you do this anymore.
>>
>> I don't mean to complain here but seriously how do you use this thing?
>>  It's so opaque that I can't do anything with it
>>
>
> If your persist method returns the newly saved entity, that's the simplest
> way. If it doesn't, listen for create events and compare the EPId of the
> created item with that of the proxy you got from RequestFactory#create().
> They will be equal if the one in the createEvent is the result of the
> persist of the create()d proxy.
>
>>
>> --
>>
>> http://groups.google.com/group/Google-Web-Toolkit-Contributors
>>
>
>

-- 
http://groups.google.com/group/Google-Web-Toolkit-Contributors

Reply via email to