Package org.apache.unomi.api.query
Class Query
- java.lang.Object
-
- org.apache.unomi.api.query.Query
-
- All Implemented Interfaces:
Serializable
public class Query extends Object implements Serializable
A query wrapper gathering all elements needed for a potentially complex CXS query:Condition
, offset, limit, sorting specification, etc. Created by kevan on 14/05/15.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Query()
Instantiates a new Query.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Condition
getCondition()
Retrieves theCondition
associated with this Query.int
getLimit()
Retrieves the number of elements to retrieve.int
getOffset()
Retrieves the offset of the first element to be retrievedString
getScrollIdentifier()
String
getScrollTimeValidity()
String
getSortby()
Retrieves the sorting specifications for this Query in String format, if any.String
getText()
Retrieves the text to be used in full-text searches, if any.boolean
isForceRefresh()
Determines whether or not an index refresh is needed before performing this Queryvoid
setCondition(Condition condition)
Sets theCondition
associated with this Query.void
setForceRefresh(boolean forceRefresh)
Specifies whether or not an index refresh is needed before performing this Query.void
setLimit(int limit)
Sets the number of elements to retrieve.void
setOffset(int offset)
Sets the offset of the first element to be retrievedvoid
setScrollIdentifier(String scrollIdentifier)
void
setScrollTimeValidity(String scrollTimeValidity)
void
setSortby(String sortby)
Sets the String representation of the sorting specifications for this Query if any.void
setText(String text)
Sets to be used in full-text searches
-
-
-
Method Detail
-
getText
public String getText()
Retrieves the text to be used in full-text searches, if any.- Returns:
- the text to be used in full-text searches or
null
if no full-text search is needed for this Query
-
setText
public void setText(String text)
Sets to be used in full-text searches- Parameters:
text
- the text to be used in full-text searches ornull
if no full-text search is needed for this Query
-
getOffset
public int getOffset()
Retrieves the offset of the first element to be retrieved- Returns:
- zero or a positive integer specifying the position of the first item to be retrieved in the total ordered collection of matching items
-
setOffset
public void setOffset(int offset)
Sets the offset of the first element to be retrieved- Parameters:
offset
- zero or a positive integer specifying the position of the first item to be retrieved in the total ordered collection of matching items
-
getLimit
public int getLimit()
Retrieves the number of elements to retrieve.- Returns:
- a positive integer specifying how many matching items should be retrieved or
-1
if all of them should be retrieved
-
setLimit
public void setLimit(int limit)
Sets the number of elements to retrieve.- Parameters:
limit
- a positive integer specifying how many matching items should be retrieved or-1
if all of them should be retrieved
-
getSortby
public String getSortby()
Retrieves the sorting specifications for this Query in String format, if any.- Returns:
- an optional (
null
if no sorting is required) String of comma (,
) separated property names on which ordering should be performed, ordering elements according to the property order in the String, considering each in turn and moving on to the next one in case of equality of all preceding ones. Each property name is optionally followed by a column (:
) and an order specifier:asc
ordesc
.
-
setSortby
public void setSortby(String sortby)
Sets the String representation of the sorting specifications for this Query if any. SeegetSortby()
method documentation for format.- Parameters:
sortby
- the String representation of the sorting specifications for this Query ornull
if no sorting is required
-
getCondition
public Condition getCondition()
Retrieves theCondition
associated with this Query.- Returns:
- the
Condition
associated with this Query
-
setCondition
public void setCondition(Condition condition)
Sets theCondition
associated with this Query.- Parameters:
condition
- theCondition
associated with this Query
-
isForceRefresh
public boolean isForceRefresh()
Determines whether or not an index refresh is needed before performing this Query- Returns:
true
if an index refresh is needed before performing this Query,false
otherwise
-
setForceRefresh
public void setForceRefresh(boolean forceRefresh)
Specifies whether or not an index refresh is needed before performing this Query.- Parameters:
forceRefresh
-true
if an index refresh is needed before performing this Query,false
otherwise
-
getScrollIdentifier
public String getScrollIdentifier()
-
setScrollIdentifier
public void setScrollIdentifier(String scrollIdentifier)
-
getScrollTimeValidity
public String getScrollTimeValidity()
-
setScrollTimeValidity
public void setScrollTimeValidity(String scrollTimeValidity)
-
-