• 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: Pascal Robert <email@hidden>
  • Date: Wed, 03 Apr 2013 05:49:18 -0400

Le 2013-04-03 à 05:40, Giles Palmer <email@hidden> a écrit :

> Hi
>
> Thanks for that.
>
> I was actually trying to see if there was a way to ensure that eo's on their own or as part of a relationship get returned in the same form by having standard filters for each type of eo.
>
> include(String keyName, ERXKeyFilter existingFilter)  is exactly what I was looking for.
>
> So for my transaction filter with its to 1 organisation I can do:
>
> ERXKeyFilter filter = ERXKeyFilter.filterWithAttributes();
> filter.include("organisation", organisationFilter());

Avoid using strings like this, if you rename your relationship, you will not see that you have a string to change. Either use

  include(ERXKey key, ERXKeyFilter existingFilter)

or :

  include(MyEntity.ORGANISATION_KEY, organisationFilter())

> Where organisationFilter() is a filter determining how organisations should be filtered.
>
> Thanks
>
> Giles
>
>> 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


 _______________________________________________
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>)
 >Re: ERRest and ERXKeyFilters advice (From: George Domurot <email@hidden>)
 >Re: ERRest and ERXKeyFilters advice (From: Giles Palmer <email@hidden>)

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