Re: Who uses ERDirectToRest ?
Re: Who uses ERDirectToRest ?
- Subject: Re: Who uses ERDirectToRest ?
- From: Pascal Robert <email@hidden>
- Date: Fri, 13 Jul 2012 18:59:51 -0400
Le 2012-07-13 à 17:21, Farrukh Ijaz a écrit :
>> AFAIK, nobody use it, except maybe Anjo. Using the "routes" based API in ERRest in quite easy, but I do agree that being able to use D2W rules instead of ERXKeyFilter to decide what is going to be send or accepted would be cool.
>
> One can use following methods in the Route Controller class. I have create a BaseRouteController and defined all useful methods in it.
Thanks. I added it to the wiki:
http://wiki.wocommunity.org/display/WONDER/ERRest+Framework#ERRestFramework-UsingD2WruleswithERRest
> Farrukh
>
> private D2WContext d2wContext;
>
> protected D2WContext d2wContext() {
> if (d2wContext == null) {
> d2wContext = new D2WContext();
> }
> return d2wContext;
> }
>
> synchronized public NSArray<String> inferFilterKeysForEntity(String entityName) {
> EOEntity entity = EOModelGroup.defaultGroup().entityNamed(entityName);
> d2wContext().setEntity(entity);
> d2wContext().setTask(request().method());
> return (NSArray<String>) d2wContext().inferValueForKey("displayPropertyKeys");
> }
>
> synchronized public NSArray<String> inferFilterKeysForPage(String page) {
> d2wContext().setDynamicPage(page);
> d2wContext().setTask(request().method());
> return (NSArray<String>) d2wContext().inferValueForKey("displayPropertyKeys");
> }
>
> public ERXKeyFilter showFilter(String entityName) {
> NSArray<String> keys = inferFilterKeysForEntity(entityName);
> ERXKeyFilter filter = null;
> if (keys != null && !keys.isEmpty()) {
> filter = ERXKeyFilter.filterWithNone();
> for (String key : keys) {
> filter.include(new ERXKey<String>(key));
> }
> } else {
> filter = ERXKeyFilter.filterWithAttributesAndToOneRelationships();
> }
> return filter;
> }
>
>
> The D2WRule should be something like:
>
> LHS: entity.name = 'Employee' and task = 'GET'
> RHS: displayPropertyKeys = ('firstName', 'lastName', 'position')
>
>>
>>> I've just started to use REST with our business logic.
>>>
>>> I wanted to use ERDirectToRest because it seems very interesting to quickly delivery access to the business logic but there are a lot of warning to NOT use it:
>>> - In the read me: "This framework uses the old and deprecated REST APIs, avoid using it."
>>> - Classes are deprecated
>>>
>>> So my questions:
>>> - Can this framework be used ?
>>> - Does anybody use it ?
>>> - What people use instead ?
>>>
>>> Dominique
>>>
>>>
>>> _______________________________________________
>>> 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
_______________________________________________
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