T
- the type of the objects being returnedpublic class ERXRestFetchSpecification<T extends 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,
EOQualifier defaultQualifier,
EOQualifier baseQualifier,
ERXKeyFilter qualifierFilter,
NSArray<EOSortOrdering> defaultSortOrderings,
int defaultBatchSize)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100 and with request qualifiers enabled.
|
ERXRestFetchSpecification(String entityName,
EOQualifier defaultQualifier,
NSArray<EOSortOrdering> defaultSortOrderings)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100, but with batching turned off by
default.
|
ERXRestFetchSpecification(String entityName,
EOQualifier defaultQualifier,
NSArray<EOSortOrdering> defaultSortOrderings,
int defaultBatchSize)
Creates a new ERXRestFetchSpecification with a maximum batch size of 100.
|
Modifier and Type | Method and Description |
---|---|
int |
batchNumber(NSKeyValueCoding options)
Returns the effective batch number.
|
int |
batchSize(NSKeyValueCoding options)
Returns the effective batch size.
|
int |
defaultBatchSize()
Returns the default batch size (defaults to -1 = off).
|
void |
enableRequestQualifiers(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(EOEditingContext editingContext,
NSKeyValueCoding options)
Fetches the objects into the given editing context with the effective attributes of this fetch specification.
|
NSArray<T> |
objects(EOEditingContext editingContext,
WORequest request)
Fetches the objects into the given editing context with the effective attributes of this fetch specification.
|
NSArray<T> |
objects(NSArray<T> objects,
EOEditingContext editingContext,
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,
EOEditingContext editingContext,
WORequest request)
Applies the effective attributes of this fetch specification to the given array, filtering, sorting, and cutting
into batches accordingly.
|
EOQualifier |
qualifier(EOEditingContext editingContext,
NSKeyValueCoding options)
Returns the effective qualifier.
|
NSRange |
range(NSKeyValueCoding options)
Returns the range of this fetch.
|
ERXRestFetchSpecification.Results<T> |
results(EOEditingContext editingContext,
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<EOSortOrdering> |
sortOrderings(EOEditingContext editingContext,
NSKeyValueCoding options)
Returns the effective sort orderings.
|
public ERXRestFetchSpecification(String entityName, EOQualifier defaultQualifier, NSArray<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, EOQualifier defaultQualifier, NSArray<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, EOQualifier defaultQualifier, EOQualifier baseQualifier, ERXKeyFilter qualifierFilter, NSArray<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(EOQualifier baseQualifier, ERXKeyFilter qualifierFilter)
baseQualifier
- the base qualifier to and withqualifierFilter
- the key filter to apply against the query qualifierpublic NSArray<EOSortOrdering> sortOrderings(EOEditingContext editingContext, NSKeyValueCoding options)
editingContext
- the editing contextoptions
- the current optionspublic EOQualifier qualifier(EOEditingContext editingContext, NSKeyValueCoding options)
editingContext
- the editing contextoptions
- the current optionspublic int batchNumber(NSKeyValueCoding options)
options
- the current optionspublic NSRange range(NSKeyValueCoding options)
options
- the current optionspublic int batchSize(NSKeyValueCoding options)
options
- the current optionspublic ERXRestFetchSpecification.Results<T> results(EOEditingContext editingContext, NSKeyValueCoding options)
editingContext
- the editing context to fetch intooptions
- the current optionspublic NSArray<T> objects(EOEditingContext editingContext, NSKeyValueCoding options)
editingContext
- the editing context to fetch intooptions
- the current optionspublic NSArray<T> objects(NSArray<T> objects, EOEditingContext editingContext, NSKeyValueCoding options)
objects
- the objects to filtereditingContext
- the editing context to evaluate the qualifer filter withoptions
- the current optionspublic NSArray<T> objects(EOEditingContext editingContext, WORequest request)
editingContext
- the editing context to fetch intorequest
- the current requestpublic NSArray<T> objects(NSArray<T> objects, EOEditingContext editingContext, WORequest request)
objects
- the objects to filtereditingContext
- the editing context to evaluate the qualifer filter withrequest
- the current requestCopyright © 2002 – 2024 Project Wonder.