That's very useful ! Thanks everyone ! Dominique
On Jul 14, 2012, at 12:59 AM, Pascal Robert wrote: > > 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 (Webobjects-dev@lists.apple.com) >>>> Help/Unsubscribe/Update your Subscription: >>>> https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca >>>> >>>> This email sent to prob...@macti.ca >>> >>> >>> _______________________________________________ >>> Do not post admin requests to the list. They will be ignored. >>> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >>> Help/Unsubscribe/Update your Subscription: >>> https://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.com >>> >>> This email sent to farrukh.i...@fuegodigitalmedia.com >> >> _______________________________________________ >> Do not post admin requests to the list. They will be ignored. >> Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/webobjects-dev/probert%40macti.ca >> >> This email sent to prob...@macti.ca > _______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (Webobjects-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com