• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ERRest and ERXKeyFilters advice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ERRest and ERXKeyFilters advice


  • Subject: Re: ERRest and ERXKeyFilters advice
  • From: George Domurot <email@hidden>
  • Date: Tue, 02 Apr 2013 08:03:30 -0700

You shouldn't hard-code your key values. It should look more like this:

ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
filter.exclude(MyEntity.MY_ATTRIBUTE);
filter.exclude(MyEntity.MY_OTHER_ATTRIBUTE);
return filter;

If you want to include a to-one relationship, but none of its attributes (just type and id):

ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
filter.include(MyEntity.MY_TO_ONE_RELATIONSHIP_OBJECT);
return filter;

If you want to include a to-one relationship, and a couple attributes:

ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
filter.include(MyEntity.MY_TO_ONE_RELATIONSHIP_OBJECT).include(MyOtherEntity.ATTRIBUTE);
filter.include(MyEntity.MY_TO_ONE_RELATIONSHIP_OBJECT).include(MyOtherEntity.ATTRIBUTE2);
return filter;

-G

On Apr 2, 2013, at 7:55 AM, Giles Palmer <email@hidden> wrote:

> Hi
>
> I am just starting my first ERRest app and playing with ERXKeyFilters.
>
> I have an OrganisationController using a filter and I remove unwanted attributes from the rest response with:
>
> ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
> filter.exclude("dateTimeStamp","autoNotify","notifyMethod","webSitePassword","website");
>
> This works great, however if I then have a TransactionController and a Transaction object that has a to-1 Organisation relationship how best do I also remove the unwanted Organisation attributes from the rest response? At the moment I have the below:
>
> ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
> filter.include("organisation").includeAttributes();
> filter.exclude("organisation.dateTimeStamp","organisation.autoNotify","organisation.notifyMethod","organisation.webSitePassword","organisation.website");
>
>
> but I can't help thinking there is a better way to ensure consistency about what attributes are contained in the response for various EOs when they form parts of responses that contain relationship objects.  Is there a better way of achieving this?
>
> Thanks
>
> Giles
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (email@hidden)
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: ERRest and ERXKeyFilters advice
      • From: Giles Palmer <email@hidden>
References: 
 >ERRest and ERXKeyFilters advice (From: Giles Palmer <email@hidden>)

  • Prev by Date: Re: ImageIO Native Java 1.6
  • Next by Date: Re: ImageIO Native Java 1.6
  • Previous by thread: ERRest and ERXKeyFilters advice
  • Next by thread: Re: ERRest and ERXKeyFilters advice
  • Index(es):
    • Date
    • Thread