> 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.

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 protected])
>> Help/Unsubscribe/Update your Subscription:
>> https://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:
> https://lists.apple.com/mailman/options/webobjects-dev/farrukh.ijaz%40fuegodigitalmedia.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:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to