there actually is an example in ERXKeyFilter's javadoc as well as in ERXRouteRequestHandler, but those are not particularly discoverable where someone actually runs into this issue ... probably there should be a short rest tutorial written up and put on the wiki.
On Mar 19, 2011, at 12:03 PM, Jesse Tayler wrote: > sweet. > > maybe I should put a few examples into the docs - if you're not familiar it > might be nice to see some code slices. > > On Mar 18, 2011, at 10:19 PM, Mike Schrag wrote: > >> .include returns a key filter that corresponds to the next relationship. You >> can .includeAttributes on that (or whatever else you want to do) >> >> Sent from my iPhone >> >> On Mar 18, 2011, at 9:49 PM, Pascal Robert <[email protected]> wrote: >> >>> I never had to include all properties from a relation, but to get some of >>> them, I do something like this: >>> >>> filter.include(InvitationUser.INVITATION.dot(Invitation.YOURPROPERTY1) >>> filter.include(InvitationUser.INVITATION.dot(Invitation.YOURPROPERTY2) >>> ... >>> >>>> Can't get ERRest to include attributes along a keypath? >>>> >>>> I show the attributes of the "invitation" relationship, but I wanted this >>>> filter to include attributes for "invitation.author" - I can only get the >>>> type and id for "author"? >>>> >>>> >>>> >>>> >>>> >>>> public WOActionResults inboxAction() { >>>> EOQualifier qual = InvitationUser.USER.eq(user()); >>>> ERXRestFetchSpecification<InvitationUser> fetchSpec = new >>>> ERXRestFetchSpecification<InvitationUser>(InvitationUser.ENTITY_NAME, >>>> qual, null, queryFilter(), null, 25); >>>> ERXKeyFilter filter = ERXKeyFilter.filterWithAll(); >>>> >>>> filter.include(InvitationUser.INVITATION).includeAttributesAndToOneRelationships(); >>>> return response(fetchSpec, filter); >>>> } >>>> >>>> >>>> >>>> >>>> >>>> >>>> ( >>>> { >>>> "id" = "1"; >>>> "invitation" = { >>>> "author" = { >>>> "type" = "Person"; >>>> "id" = "1"; >>>> }; >>>> "status" = "<com.webobjects.foundation.NSKeyValueCoding$Null>"; >>>> "mtly" = { >>>> "type" = "Mtly"; >>>> "id" = "27"; >>>> }; >>>> "id" = "1"; >>>> "active" = "true"; >>>> "created" = "2011-01-10 05:00:00 Etc/GMT"; >>>> "type" = "Invitation"; >>>> "name" = "<com.webobjects.foundation.NSKeyValueCoding$Null>"; >>>> "adjusted" = "2011-01-10 05:24:01 Etc/GMT"; >>>> }; >>>> "type" = "InvitationUser"; >>>> "user" = { >>>> "type" = "Person"; >>>> "id" = "1"; >>>> }; >>>> }, >>>> { >>>> "id" = "2"; >>>> "invitation" = { >>>> "author" = { >>>> "type" = "Person"; >>>> "id" = "1"; >>>> }; >>>> "status" = "<com.webobjects.foundation.NSKeyValueCoding$Null>"; >>>> "mtly" = { >>>> "type" = "Mtly"; >>>> "id" = "27"; >>>> }; >>>> "id" = "1"; >>>> "active" = "true"; >>>> "created" = "2011-01-10 05:00:00 Etc/GMT"; >>>> "type" = "Invitation"; >>>> "name" = "<com.webobjects.foundation.NSKeyValueCoding$Null>"; >>>> "adjusted" = "2011-01-10 05:24:01 Etc/GMT"; >>>> }; >>>> "type" = "InvitationUser"; >>>> "user" = { >>>> "type" = "Person"; >>>> "id" = "1"; >>>> }; >>>> } >>>> ) >>>> >>>> _______________________________________________ >>>> Do not post admin requests to the list. They will be ignored. >>>> Webobjects-dev mailing list ([email protected]) >>>> Help/Unsubscribe/Update your Subscription: >>>> http://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca >>>> >>>> This email sent to [email protected] >>> >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Webobjects-dev mailing list ([email protected]) >>> Help/Unsubscribe/Update your Subscription: >>> http://lists.apple.com/mailman/options/webobjects-dev/mschrag%40pobox.com >>> >>> This email sent to [email protected] >> > _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list ([email protected]) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to [email protected]
