|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecter.rest.ERXRestFetchSpecification<T>
T
- the type of the objects being returnedpublic class ERXRestFetchSpecification<T extends com.webobjects.eocontrol.EOEnterpriseObject>
ERXRestFetchSpecification provides a wrapper around fetching objects with batching, sort orderings, and (optionally) qualifiers configured in the WORequest.
Example query string parameters:
Because request EOQualifiers could possibly pose a security risk, you must explicitly enable request qualifiers by calling enableRequestQualifiers(baseQualifier) or by using the longer constructor that takes an optional base qualifier. A base qualifier is prepended (AND'd) to whatever qualifier is passed on the query string to restrict the results of the user's query.
An example use:
public WOActionResults indexAction() throws Throwable { ERXRestFetchSpecification<Task> fetchSpec = new ERXRestFetchSpecification<Task>(Task.ENTITY_NAME, null, null, queryFilter(), Task.CREATION_DATE.descs(), 25); NSArray<Task> tasks = fetchSpec.objects(editingContext(), options()); return response(editingContext(), Task.ENTITY_NAME, tasks, showFilter()); }
In this example, we are fetching the "Task" entity, sorted by creation date, with a default batch size of 25, and with request qualifiers enable (meaning, we allow users to pass in a qualifier in the query string), filtering the qualifier with the ERXKeyFilter returned by the queryFilter() method. We then fetch the resulting tasks and return the response to the user.
Nested Class Summary | |
---|---|
static class |
ERXRestFetchSpecification.Results<T>
Encapsulates the results of a fetch along with some fetch metadata. |
Constructor Summary | |
---|---|
ERXRestFetchSpecification(java.lang.String entityName,
com.webobjects.eocontrol.EOQualifier defaultQualifier,
com.webobjects.eocontrol.EOQualifier baseQualifier,
ERXKeyFilter qualifierFilter,
com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings,
int defaultBatchSize)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100 and with request qualifiers enabled. |
|
ERXRestFetchSpecification(java.lang.String entityName,
com.webobjects.eocontrol.EOQualifier defaultQualifier,
com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100, but with batching turned off by default. |
|
ERXRestFetchSpecification(java.lang.String entityName,
com.webobjects.eocontrol.EOQualifier defaultQualifier,
com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings,
int defaultBatchSize)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100. |
Method Summary | |
---|---|
int |
batchNumber(com.webobjects.foundation.NSKeyValueCoding options)
Returns the effective batch number. |
int |
batchSize(com.webobjects.foundation.NSKeyValueCoding options)
Returns the effective batch size. |
int |
defaultBatchSize()
Returns the default batch size (defaults to -1 = off). |
void |
enableRequestQualifiers(com.webobjects.eocontrol.EOQualifier baseQualifier,
ERXKeyFilter qualifierFilter)
Enables qualifiers in the request, but will be AND'd to the given base qualifier (in case you need to perform security restrictions) |
java.lang.String |
entityName()
Returns the name of the entity used in this fetch. |
int |
maxBatchSize()
Returns the maximum batch size (defaults to 100). |
com.webobjects.foundation.NSArray<T> |
objects(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
Fetches the objects into the given editing context with the effective attributes of this fetch specification. |
com.webobjects.foundation.NSArray<T> |
objects(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.appserver.WORequest request)
Fetches the objects into the given editing context with the effective attributes of this fetch specification. |
com.webobjects.foundation.NSArray<T> |
objects(com.webobjects.foundation.NSArray<T> objects,
com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
Applies the effective attributes of this fetch specification to the given array, filtering, sorting, and cutting into batches accordingly. |
com.webobjects.foundation.NSArray<T> |
objects(com.webobjects.foundation.NSArray<T> objects,
com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.appserver.WORequest request)
Applies the effective attributes of this fetch specification to the given array, filtering, sorting, and cutting into batches accordingly. |
com.webobjects.eocontrol.EOQualifier |
qualifier(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
Returns the effective qualifier. |
com.webobjects.foundation.NSRange |
range(com.webobjects.foundation.NSKeyValueCoding options)
Returns the range of this fetch. |
ERXRestFetchSpecification.Results<T> |
results(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
Fetches the objects into the given editing context with the effective attributes of this fetch specification. |
void |
setDefaultBatchSize(int defaultBatchSize)
Sets the default batch size |
void |
setMaxBatchSize(int maxBatchSize)
Sets the maximum batch size. |
com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> |
sortOrderings(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
Returns the effective sort orderings. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ERXRestFetchSpecification(java.lang.String entityName, com.webobjects.eocontrol.EOQualifier defaultQualifier, com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings)
entityName
- the name of the entity being fetcheddefaultQualifier
- the default qualifiers (if none are specified in the request)defaultSortOrderings
- the default sort orderings (if none are specified in the request)public ERXRestFetchSpecification(java.lang.String entityName, com.webobjects.eocontrol.EOQualifier defaultQualifier, com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings, int defaultBatchSize)
entityName
- the name of the entity being fetcheddefaultQualifier
- the default qualifiers (if none are specified in the request)defaultSortOrderings
- the default sort orderings (if none are specified in the request)defaultBatchSize
- the default batch size (-1 to disable)public ERXRestFetchSpecification(java.lang.String entityName, com.webobjects.eocontrol.EOQualifier defaultQualifier, com.webobjects.eocontrol.EOQualifier baseQualifier, ERXKeyFilter qualifierFilter, com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings, int defaultBatchSize)
entityName
- the name of the entity being fetcheddefaultQualifier
- the default qualifiers (if none are specified in the request)baseQualifier
- the base qualifier (see enableRequestQualifiers)qualifierFilter
- the key filter to apply against the query qualifierdefaultSortOrderings
- the default sort orderings (if none are specified in the request)defaultBatchSize
- the default batch size (-1 to disable)Method Detail |
---|
public java.lang.String entityName()
public int maxBatchSize()
public void setMaxBatchSize(int maxBatchSize)
maxBatchSize
- the maximum batch sizepublic int defaultBatchSize()
public void setDefaultBatchSize(int defaultBatchSize)
defaultBatchSize
- the default batch sizepublic void enableRequestQualifiers(com.webobjects.eocontrol.EOQualifier baseQualifier, ERXKeyFilter qualifierFilter)
baseQualifier
- the base qualifier to and withqualifierFilter
- the key filter to apply against the query qualifierpublic com.webobjects.foundation.NSArray<com.webobjects.eocontrol.EOSortOrdering> sortOrderings(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
options
- the current options
public com.webobjects.eocontrol.EOQualifier qualifier(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
options
- the current options
public int batchNumber(com.webobjects.foundation.NSKeyValueCoding options)
options
- the current options
public com.webobjects.foundation.NSRange range(com.webobjects.foundation.NSKeyValueCoding options)
options
- the current options
public int batchSize(com.webobjects.foundation.NSKeyValueCoding options)
options
- the current options
public ERXRestFetchSpecification.Results<T> results(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
editingContext
- the editing context to fetch intooptions
- the current options
public com.webobjects.foundation.NSArray<T> objects(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
editingContext
- the editing context to fetch intooptions
- the current options
public com.webobjects.foundation.NSArray<T> objects(com.webobjects.foundation.NSArray<T> objects, com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
objects
- the objects to filtereditingContext
- the editing context to evaluate the qualifer filter withoptions
- the current options
public com.webobjects.foundation.NSArray<T> objects(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.appserver.WORequest request)
editingContext
- the editing context to fetch intorequest
- the current request
public com.webobjects.foundation.NSArray<T> objects(com.webobjects.foundation.NSArray<T> objects, com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.appserver.WORequest request)
objects
- the objects to filtereditingContext
- the editing context to evaluate the qualifer filter withrequest
- the current request
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |