T - the type of the objects being returnedpublic class ERXRestFetchSpecification<T extends com.webobjects.eocontrol.EOEnterpriseObject> extends Object
Example query string parameters:
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.| Modifier and Type | Class and Description |
|---|---|
static class |
ERXRestFetchSpecification.Results<T>
Encapsulates the results of a fetch along with some fetch metadata.
|
| Constructor and Description |
|---|
ERXRestFetchSpecification(String entityName,
com.webobjects.eocontrol.EOQualifier defaultQualifier,
com.webobjects.eocontrol.EOQualifier baseQualifier,
ERXKeyFilter qualifierFilter,
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(String entityName,
com.webobjects.eocontrol.EOQualifier defaultQualifier,
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(String entityName,
com.webobjects.eocontrol.EOQualifier defaultQualifier,
NSArray<com.webobjects.eocontrol.EOSortOrdering> defaultSortOrderings,
int defaultBatchSize)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100.
|
| Modifier and Type | Method and Description |
|---|---|
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)
|
String |
entityName()
Returns the name of the entity used in this fetch.
|
int |
maxBatchSize()
Returns the maximum batch size (defaults to 100).
|
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.
|
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.
|
NSArray<T> |
objects(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.
|
NSArray<T> |
objects(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.
|
NSArray<com.webobjects.eocontrol.EOSortOrdering> |
sortOrderings(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
Returns the effective sort orderings.
|
public ERXRestFetchSpecification(String entityName, com.webobjects.eocontrol.EOQualifier defaultQualifier, 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(String entityName, com.webobjects.eocontrol.EOQualifier defaultQualifier, 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(String entityName, com.webobjects.eocontrol.EOQualifier defaultQualifier, com.webobjects.eocontrol.EOQualifier baseQualifier, ERXKeyFilter qualifierFilter, 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)public 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 NSArray<com.webobjects.eocontrol.EOSortOrdering> sortOrderings(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
editingContext - the editing contextoptions - the current optionspublic com.webobjects.eocontrol.EOQualifier qualifier(com.webobjects.eocontrol.EOEditingContext editingContext,
com.webobjects.foundation.NSKeyValueCoding options)
editingContext - the editing contextoptions - the current optionspublic int batchNumber(com.webobjects.foundation.NSKeyValueCoding options)
options - the current optionspublic com.webobjects.foundation.NSRange range(com.webobjects.foundation.NSKeyValueCoding options)
options - the current optionspublic int batchSize(com.webobjects.foundation.NSKeyValueCoding options)
options - the current optionspublic ERXRestFetchSpecification.Results<T> results(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
editingContext - the editing context to fetch intooptions - the current optionspublic NSArray<T> objects(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.foundation.NSKeyValueCoding options)
editingContext - the editing context to fetch intooptions - the current optionspublic NSArray<T> objects(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 optionspublic NSArray<T> objects(com.webobjects.eocontrol.EOEditingContext editingContext, com.webobjects.appserver.WORequest request)
editingContext - the editing context to fetch intorequest - the current requestpublic NSArray<T> objects(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 requestCopyright © 2002 – 2020 Project Wonder.