How to use RequestFactory: .with(propertyRefs) for composition of objects

162 views
Skip to first unread message

basilboli

unread,
Jul 31, 2011, 3:31:55 PM7/31/11
to google-we...@googlegroups.com

Hello, 

I am newbie to GWT and  I need your professional advice.


My question is : 

how to use RequestFactory: .with(propertyRefs) for kind of “tree” structures when 

these propertyRefs itself contains list of items I would like to retrieve.


Some details: 

On the server-side I have hierarchy of four domain objects A,B,C,D:

  • A object contains (or I'd better say keep reference to)  List <B>
  • B contains List <C>
  • C contains List <D>.

All mentioned domain objects have its corresponding proxy interfaces AProxy, BProxy, CProxy, DProxy to use on the client side.


On the client side I would like to get all that hierarchy of objects

by once requesting AProxy object so I would profit from the easiness of data access using “get” methods and wouldn’t be obliged to make looping server requests for every sub-object, sub-sub-objects etc.


Due to specification I should use smth. like  .with(“property ref”) to get one level of hierarchy 

but what about retrieving following levels of compositions (in my case List <C> for every object B and List<D> for every object C).


Thanks in advance.

Ryan McFall

unread,
Jul 31, 2011, 5:35:23 PM7/31/11
to Google Web Toolkit
Hi there:

Assuming that your lists are named listB, listC, listD, then you would
write:
.with ("A.listB", "A.listB.listC", "A.listB.listC.listD")
to cause your various proxies to be populated by a single call to the
server.

Hope that helps,
Ryan

On Jul 31, 3:31 pm, basilboli <basilb...@gmail.com> wrote:
> Hello,
>
> I am newbie to GWT and  I need your professional advice.
>
> My question is :
>
> how to use RequestFactory: *.with(propertyRefs)* for kind of “tree”
> structures when
>
> these propertyRefs itself contains list of items I would like to retrieve.
>
> Some details:
>
> On the server-side I have hierarchy of four domain objects A,B,C,D:
>
>    - A object contains (or I'd better say keep reference to)  List <B>
>    - B contains List <C>
>    - C contains List <D>.

Jens

unread,
Jul 31, 2011, 5:40:27 PM7/31/11
to google-we...@googlegroups.com
The .with method accepts a string array via variable arguments. So you can write .with("a.b", "a.b.c", "a.b.c.d"). If you use RequestFactoryEditorDriver there is also a method called getPath() with returns the correct path array needed by your editors.

-- J.

basilboli

unread,
Aug 1, 2011, 4:15:20 AM8/1/11
to google-we...@googlegroups.com
thanks a lot guys.
it worked out the problem. :)
Reply all
Reply to author
Forward
0 new messages