It creates and sets up a filter to use in a request to the collection of a cloud persistence model. It enables the user to filter the collection comparing the values of the attributes of the model taking into consideration a criteria. The criteria is applied to each object of the persisted collection and those which fulfill the criteria will be part of the collection. A Filter can configure more than one criteria, in this case a criteria is applied to a result collection of the previous criteria. A filter is used as a parameter of public and private methods of broker.cloudPersistence
CONSTRUCTOR
Filter(modelName:String)
Arguments |
|
modelName |
String: name of the model with which the filter starts. |
Return |
|
Filter |
New instance of filter configured with a model. |
Exceptions |
ModelNotFound – Model ‘modelName’ not found. |
PUBLIC METHODS
void equalTo(String attribute, Any value)
It configures the filter so that each object of the resulting collection is equal to the value you want.
Arguments |
|
attribute |
String: name of the attribute of the configured model in the filter over which the equality criteria will be applied. |
value |
[String,Double,Integer,Bool,Date,Model]: value of the attribute to be compared with each object of the collection. |
Exceptions |
CloudOperationError – Error when trying to equalTo a not cloud model value. |
void lessThanOrEqual(String attrubute, Any value)
It configures the filter so that each object of the resulting collection is lower than or equal to the desired value.
Arguments |
|
attribute |
String: name of the attribute of the configured model in the filter over which the criteria of the lower or equal value will be applied. |
value |
[String,Double,Integer,Bool,Date]: value of the attribute to be compared with each object of the collection. |
Exceptions |
UnsupportedCollectionTypeInCloud – Collections are not supported as lessThanOrEqual argument (the value of the parameter is a collection, and collection values cannot be filtered). |
void greaterThanOrEqual(String attribute, Any value)
It configures the filter so that each object of the resulting collection is higher than or equal to the desired value.
Arguments |
|
attribute |
String: name of the attribute of the configured model in the filter over which the criteria of the higher or equal value will be applied. |
valor |
[String,Double,Integer,Bool,Date]: value of the attribute to be compared with each object of the collection. |
Exceptions |
UnsupportedCollectionTypeInCloud – Collections are not supported as greaterThanOrEqual argument (the value of the parameter is a collection, and collection values cannot be filtered). |
void lessThan(String atributo, Any valor)
It configures the filter so that each filter of the resulting collection is lower than the value we want.
Arguments |
|
attribute |
String: name of the attribute of the configured model in the filter over which the criteria of the lower is applied. |
value |
[String,Double,Integer,Bool,Date]: value of the attribute to be compared with each object of the collection. |
Exceptions |
UnsupportedCollectionTypeInCloud – Collections are not supported as lessThan argument (the value of the parameter is a collection, and collection values cannot be filtered). |
void greaterThan(String attribute, Any value)
It configures the filter so that each filter of the resulting collection is higher than the value we want.
Argumentos |
|
atributo |
String: nname of the attribute of the configured model in the filter over which the criteria of the higher is applied. |
valor |
[String,Double,Integer,Bool,Date]: value of the attribute to be compared with each object of the collection. |
Exceptions |
UnsupportedCollectionTypeInCloud – Collections are not supported as greaterThan argument (the value of the parameter is a collection, and collection values cannot be filtered). |
void limit(Integer limite)
It restricts the number of the result collection to the limit we want.
Arguments |
|
limit |
Integer: limit of the size of the collection. |
Exceptions |
WrongLimitInCloudFilter – Limit cannot be negative or zero value. |
void ascendingOrderBy(String attribute)
It sorts the list in ascending order applying the criteria to the parameter attribute. The null values are dismissed from the result collection.
Arguments |
|
attribute |
String: name of the attribute. |
void descendingOrderBy(String attribute)
It sorts the list in descending order applying the criteria to a parameter attribute. The null values are considered and placed at the bottom of the list, interpreting them as the lowest values.
Arguments |
|
attribute |
String: name of the attribute. |