public class ModifiableQuery extends Object implements SearchQuery, Serializable
ModifiedQuery enables a modifiable lightweight copy of a
SearchQuery to be created
by wrapping the original query.
This class is provided primarily for use by core-, security- and storage layer classes, in those rare cases where modifications may be appropriate to a query before processing it.
The ModifiedQuery wraps the original query, and can be modified
without affecting the original query. Modifications are not validated, and
may lead to inconsistent data in the query (e.g. sorting on fields
that are not in the query), resulting in a query that can not be processed
by the storage.
Avoiding such inconsistencies is the responsibility of the user.
DEFAULT_MAX_NUMBER, DEFAULT_OFFSET| Constructor and Description |
|---|
ModifiableQuery(SearchQuery query)
Creates a new instance of ModifiedQuery
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
Compares this query to the specified object.
|
CachePolicy |
getCachePolicy()
Returns the CachePolicy of the object.
|
Constraint |
getConstraint()
Gets the constraints on the search results.
|
List<StepField> |
getFields()
Gets the stepfields in the search request.
|
int |
getMaxNumber()
Gets the maximum number of results to be returned, or -1 if the number of results to be returned is unlimited.
|
int |
getOffset()
Gets the (zerobased) offset in the list of results, of the first result to return.
|
List<SortOrder> |
getSortOrders()
Gets the SortOrder objects in the order they are to be applied.
|
List<Step> |
getSteps()
Gets the steps in the search request.
|
int |
hashCode()
Should correspond to
BasicSearchQuery.hashCode() |
boolean |
isAggregating()
Tests if this is an aggregating query, i.e.
|
boolean |
isDistinct()
Tests if the search request is to return distinct results.
|
boolean |
markUsed() |
ModifiableQuery |
setAggregating(Boolean aggregating)
Sets the aggregating property.
|
void |
setCachePolicy(CachePolicy policy)
Sets the CachePolicy of the query.
|
ModifiableQuery |
setConstraint(Constraint constraint)
Sets the constraint property.
|
ModifiableQuery |
setDistinct(Boolean distinct)
Sets the distinct property.
|
ModifiableQuery |
setFields(List<StepField> fields)
Sets the fields property.
|
ModifiableQuery |
setMaxNumber(int maxNumber)
Sets the maxNumber property.
|
ModifiableQuery |
setOffset(int offset)
Sets the offset property.
|
ModifiableQuery |
setSortOrders(List<SortOrder> sortOrders)
Sets the sortOrders property.
|
ModifiableQuery |
setSteps(List<Step> steps)
Sets the steps property.
|
String |
toString()
Returns a string representation of this SearchQuery.
|
public ModifiableQuery(SearchQuery query)
public ModifiableQuery setMaxNumber(int maxNumber)
maxNumber - The maxNumber value, -1 means: use
query.getMaxNumber().ModifiableQuery instance.public ModifiableQuery setOffset(int offset)
offset - The offset value, -1 means: use
query.getOffset().ModifiableQuery instance.public ModifiableQuery setConstraint(Constraint constraint)
constraint - The constraint, null means: use
query.getConstraint().ModifiableQuery instance.public ModifiableQuery setFields(List<StepField> fields)
fields - The fields, null means: use
query.getFields().ModifiableQuery instance.public ModifiableQuery setSortOrders(List<SortOrder> sortOrders)
sortOrders - The sortorders, null means: use
query.getSortOrders().ModifiableQuery instance.public ModifiableQuery setSteps(List<Step> steps)
steps - The steps, null means: use
query.getSteps()
- Returns:
- This
ModifiableQuery instance.
public ModifiableQuery setDistinct(Boolean distinct)
distinct - The value of the distinct property,
null means: use query.isDistinct().ModifiableQuery instance.public ModifiableQuery setAggregating(Boolean aggregating)
aggregating - The value of the aggregating property,
null means: use query.isAggregating().ModifiableQuery instance.public int getMaxNumber()
SearchQueryNote: limiting the number of results may not be supported by the database layer.
getMaxNumber in interface SearchQuerypublic int getOffset()
SearchQueryNote: skipping results may not be supported by the database layer.
getOffset in interface SearchQuerypublic Constraint getConstraint()
SearchQueryThis corresponds to (part of) the constraints in the WHERE-clause in SQL SELECT-syntax.
getConstraint in interface SearchQuerypublic List<StepField> getFields()
SearchQueryThis corresponds to the fields in SQL SELECT-syntax.
getFields in interface SearchQuerypublic List<SortOrder> getSortOrders()
SearchQueryThis corresponds to the ORDER BY clause in SQL SELECT syntax.
getSortOrders in interface SearchQuerypublic List<Step> getSteps()
SearchQueryThis corresponds to the tables in SQL SELECT-syntax.
getSteps in interface SearchQuerypublic boolean isDistinct()
SearchQueryThis corresponds to the use of "DISTINCT" in SQL SELECT-syntax .
isDistinct in interface SearchQuerypublic boolean isAggregating()
SearchQueryisAggregating in interface SearchQuerypublic CachePolicy getCachePolicy()
CacheablegetCachePolicy in interface CacheableCachePolicy object.public void setCachePolicy(CachePolicy policy)
CacheablesetCachePolicy in interface Cacheablepolicy - the CachePolicy object.public boolean equals(Object obj)
true if and only if the argument is a non-null
SearchQuery object representing the same query.
Should correspond to BasicSearchQuery.equals(java.lang.Object)equals in interface SearchQueryequals in class Objectobj - The object to compare with.true if the objects are equal,
false otherwise.public int hashCode()
BasicSearchQuery.hashCode()hashCode in interface SearchQueryhashCode in class Objectpublic String toString()
SearchQueryisDistinct()
getSteps()
getFields()
getConstraint()
getSortOrders()
getMaxNumber()
getOffset()
toString in interface SearchQuerytoString in class Objectpublic boolean markUsed()
markUsed in interface SearchQueryMMBase 1.9-SNAPSHOT - ${javadoctimestamp}