
Classes | |
| class | Results< T > |
Public Member Functions | |
| int | batchNumber (NSKeyValueCoding options) |
| int | batchSize (NSKeyValueCoding options) |
| int | defaultBatchSize () |
| void | enableRequestQualifiers (EOQualifier baseQualifier, ERXKeyFilter qualifierFilter) |
| String | entityName () |
| ERXRestFetchSpecification (String entityName, EOQualifier defaultQualifier, EOQualifier baseQualifier, ERXKeyFilter qualifierFilter, NSArray< EOSortOrdering > defaultSortOrderings, int defaultBatchSize) | |
| ERXRestFetchSpecification (String entityName, EOQualifier defaultQualifier, NSArray< EOSortOrdering > defaultSortOrderings, int defaultBatchSize) | |
| ERXRestFetchSpecification (String entityName, EOQualifier defaultQualifier, NSArray< EOSortOrdering > defaultSortOrderings) | |
| int | maxBatchSize () |
| NSArray< T > | objects (NSArray< T > objects, EOEditingContext editingContext, WORequest request) |
| NSArray< T > | objects (EOEditingContext editingContext, WORequest request) |
| NSArray< T > | objects (NSArray< T > objects, EOEditingContext editingContext, NSKeyValueCoding options) |
| NSArray< T > | objects (EOEditingContext editingContext, NSKeyValueCoding options) |
| EOQualifier | qualifier (EOEditingContext editingContext, NSKeyValueCoding options) |
| NSRange | range (NSKeyValueCoding options) |
| Results< T > | results (EOEditingContext editingContext, NSKeyValueCoding options) |
| void | setDefaultBatchSize (int defaultBatchSize) |
| void | setMaxBatchSize (int maxBatchSize) |
| NSArray< EOSortOrdering > | sortOrderings (EOEditingContext editingContext, NSKeyValueCoding options) |
Private Attributes | |
| EOQualifier | _baseQualifier |
| int | _defaultBatchSize |
| EOQualifier | _defaultQualifier |
| NSArray< EOSortOrdering > | _defaultSortOrderings |
| String | _entityName |
| int | _maxBatchSize |
| ERXKeyFilter | _qualifierFilter |
| boolean | _requestQualifiersEnabled |
Static Private Attributes | |
| static final Pattern | _rangePattern = Pattern.compile("items=(.*)-(.*)") |
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.
| <T> | the type of the objects being returned |
| 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.
| entityName | the name of the entity being fetched | |
| defaultQualifier | the default qualifiers (if none are specified in the request) | |
| defaultSortOrderings | the default sort orderings (if none are specified in the request) |
| ERXRestFetchSpecification | ( | String | entityName, | |
| EOQualifier | defaultQualifier, | |||
| NSArray< EOSortOrdering > | defaultSortOrderings, | |||
| int | defaultBatchSize | |||
| ) |
Creates a new ERXRestFetchSpecification with a maximum batch size of 100. default.
| entityName | the name of the entity being fetched | |
| defaultQualifier | 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) |
| 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. default.
| entityName | the name of the entity being fetched | |
| defaultQualifier | 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 qualifier | |
| defaultSortOrderings | the default sort orderings (if none are specified in the request) | |
| defaultBatchSize | the default batch size (-1 to disable) |
| int batchNumber | ( | NSKeyValueCoding | options | ) |
Returns the effective batch number.
| options | the current options |
| int batchSize | ( | NSKeyValueCoding | options | ) |
Returns the effective batch size.
| options | the current options |
| 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)
| baseQualifier | the base qualifier to and with | |
| qualifierFilter | the key filter to apply against the query qualifier |
| 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 | ( | 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.
| objects | the objects to filter | |
| editingContext | the editing context to evaluate the qualifer filter with | |
| request | the current request |
| NSArray<T> objects | ( | EOEditingContext | editingContext, | |
| WORequest | request | |||
| ) |
Fetches the objects into the given editing context with the effective attributes of this fetch specification.
| editingContext | the editing context to fetch into | |
| request | the current request |
| 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.
| objects | the objects to filter | |
| editingContext | the editing context to evaluate the qualifer filter with | |
| options | the current options |
| NSArray<T> objects | ( | EOEditingContext | editingContext, | |
| NSKeyValueCoding | options | |||
| ) |
Fetches the objects into the given editing context with the effective attributes of this fetch specification.
| editingContext | the editing context to fetch into | |
| options | the current options |
| EOQualifier qualifier | ( | EOEditingContext | editingContext, | |
| NSKeyValueCoding | options | |||
| ) |
Returns the effective qualifier.
| options | the current options |
| NSRange range | ( | NSKeyValueCoding | options | ) |
Returns the range of this fetch.
| options | the current options |
| Results<T> results | ( | EOEditingContext | editingContext, | |
| NSKeyValueCoding | options | |||
| ) |
Fetches the objects into the given editing context with the effective attributes of this fetch specification.
| editingContext | the editing context to fetch into | |
| options | the current options |
| void setDefaultBatchSize | ( | int | defaultBatchSize | ) |
Sets the default batch size
| defaultBatchSize | the default batch size |
| void setMaxBatchSize | ( | int | maxBatchSize | ) |
Sets the maximum batch size.
| maxBatchSize | the maximum batch size |
| NSArray<EOSortOrdering> sortOrderings | ( | EOEditingContext | editingContext, | |
| NSKeyValueCoding | options | |||
| ) |
Returns the effective sort orderings.
| options | the current options |
EOQualifier _baseQualifier [private] |
int _defaultBatchSize [private] |
EOQualifier _defaultQualifier [private] |
NSArray<EOSortOrdering> _defaultSortOrderings [private] |
String _entityName [private] |
int _maxBatchSize [private] |
ERXKeyFilter _qualifierFilter [private] |
final Pattern _rangePattern = Pattern.compile("items=(.*)-(.*)") [static, private] |
boolean _requestQualifiersEnabled [private] |
1.5.8