public class Search extends java.lang.Object implements IMutableSearch, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected boolean |
disjunction |
protected boolean |
distinct |
protected java.util.List<java.lang.String> |
fetches |
protected java.util.List<Field> |
fields |
protected java.util.List<Filter> |
filters |
protected int |
firstResult |
protected int |
maxResults |
protected int |
page |
protected int |
resultMode |
protected java.lang.Class<?> |
searchClass |
protected java.util.List<Sort> |
sorts |
RESULT_ARRAY, RESULT_AUTO, RESULT_LIST, RESULT_MAP, RESULT_SINGLE
Constructor and Description |
---|
Search() |
Search(java.lang.Class<?> searchClass) |
Modifier and Type | Method and Description |
---|---|
Search |
addFetch(java.lang.String property) |
Search |
addFetches(java.lang.String... properties) |
Search |
addField(Field field) |
Search |
addField(java.lang.String property)
If this field is used with
resultMode == RESULT_MAP , the
property will also be used as the key for this value in the
map. |
Search |
addField(java.lang.String property,
int operator)
If this field is used with
resultMode == RESULT_MAP , the
property will also be used as the key for this value in the
map. |
Search |
addField(java.lang.String property,
int operator,
java.lang.String key)
If this field is used with
resultMode == RESULT_MAP , the
key will be used as the key for this value in the map. |
Search |
addField(java.lang.String property,
java.lang.String key)
If this field is used with
resultMode == RESULT_MAP , the
key will be used as the key for this value in the map. |
Search |
addFields(Field... fields) |
Search |
addFilter(Filter filter) |
Search |
addFilterAll(java.lang.String property,
Filter filter)
Add a filter that uses the ALL operator.
|
Search |
addFilterAnd(Filter... filters)
Add a filter that uses the AND operator.
|
Search |
addFilterCustom(java.lang.String expression)
Add a filter that uses a custom expression.
|
Search |
addFilterCustom(java.lang.String expression,
java.util.Collection<?> values)
Add a filter that uses a custom expression.
|
Search |
addFilterCustom(java.lang.String expression,
java.lang.Object... values)
Add a filter that uses a custom expression.
|
Search |
addFilterEmpty(java.lang.String property)
Add a filter that uses the IS EMPTY operator.
|
Search |
addFilterEqual(java.lang.String property,
java.lang.Object value)
Add a filter that uses the == operator.
|
Search |
addFilterGreaterOrEqual(java.lang.String property,
java.lang.Object value)
Add a filter that uses the >= operator.
|
Search |
addFilterGreaterThan(java.lang.String property,
java.lang.Object value)
Add a filter that uses the > operator.
|
Search |
addFilterILike(java.lang.String property,
java.lang.String value)
Add a filter that uses the ILIKE operator.
|
Search |
addFilterIn(java.lang.String property,
java.util.Collection<?> value)
Add a filter that uses the IN operator.
|
Search |
addFilterIn(java.lang.String property,
java.lang.Object... value)
Add a filter that uses the IN operator.
|
Search |
addFilterLessOrEqual(java.lang.String property,
java.lang.Object value)
Add a filter that uses the <= operator.
|
Search |
addFilterLessThan(java.lang.String property,
java.lang.Object value)
Add a filter that uses the < operator.
|
Search |
addFilterLike(java.lang.String property,
java.lang.String value)
Add a filter that uses the LIKE operator.
|
Search |
addFilterNone(java.lang.String property,
Filter filter)
Add a filter that uses the NONE operator.
|
Search |
addFilterNot(Filter filter)
Add a filter that uses the NOT operator.
|
Search |
addFilterNotEmpty(java.lang.String property)
Add a filter that uses the IS NOT EMPTY operator.
|
Search |
addFilterNotEqual(java.lang.String property,
java.lang.Object value)
Add a filter that uses the != operator.
|
Search |
addFilterNotIn(java.lang.String property,
java.util.Collection<?> value)
Add a filter that uses the NOT IN operator.
|
Search |
addFilterNotIn(java.lang.String property,
java.lang.Object... value)
Add a filter that uses the NOT IN operator.
|
Search |
addFilterNotNull(java.lang.String property)
Add a filter that uses the IS NOT NULL operator.
|
Search |
addFilterNull(java.lang.String property)
Add a filter that uses the IS NULL operator.
|
Search |
addFilterOr(Filter... filters)
Add a filter that uses the OR operator.
|
Search |
addFilters(Filter... filters) |
Search |
addFilterSome(java.lang.String property,
Filter filter)
Add a filter that uses the SOME operator.
|
Search |
addSort(Sort sort) |
Search |
addSort(java.lang.String property,
boolean desc)
Add sort by property.
|
Search |
addSort(java.lang.String property,
boolean desc,
boolean ignoreCase)
Add sort by property.
|
Search |
addSortAsc(java.lang.String property)
Add ascending sort by property
|
Search |
addSortAsc(java.lang.String property,
boolean ignoreCase)
Add ascending sort by property
|
Search |
addSortDesc(java.lang.String property)
Add descending sort by property
|
Search |
addSortDesc(java.lang.String property,
boolean ignoreCase)
Add descending sort by property
|
Search |
addSorts(Sort... sorts) |
void |
clear() |
void |
clearFetches() |
void |
clearFields() |
void |
clearFilters() |
void |
clearPaging() |
void |
clearSorts() |
Search |
copy()
Create a copy of this search.
|
boolean |
equals(java.lang.Object obj) |
java.util.List<java.lang.String> |
getFetches() |
java.util.List<Field> |
getFields() |
java.util.List<Filter> |
getFilters() |
int |
getFirstResult()
Zero based index of first result record to return.
|
int |
getMaxResults()
The maximum number of records to return.
|
int |
getPage()
Zero based index of the page of records to return.
|
int |
getResultMode()
Result mode tells the search what form to use for the results.
|
java.lang.Class<?> |
getSearchClass() |
java.util.List<Sort> |
getSorts() |
int |
hashCode() |
boolean |
isDisjunction() |
boolean |
isDistinct() |
void |
removeFetch(java.lang.String property) |
void |
removeField(Field field) |
void |
removeField(java.lang.String property) |
void |
removeField(java.lang.String property,
java.lang.String key) |
void |
removeFilter(Filter filter) |
void |
removeFiltersOnProperty(java.lang.String property)
Remove all filters on the given property.
|
void |
removeSort(Sort sort) |
void |
removeSort(java.lang.String property) |
Search |
setDisjunction(boolean disjunction)
Filters added to a search are "ANDed" together if this is false (default)
and "ORed" if it is set to true.
|
IMutableSearch |
setDistinct(boolean distinct) |
Search |
setFetches(java.util.List<java.lang.String> fetches) |
Search |
setFields(java.util.List<Field> fields) |
Search |
setFilters(java.util.List<Filter> filters) |
Search |
setFirstResult(int firstResult) |
Search |
setMaxResults(int maxResults) |
Search |
setPage(int page) |
Search |
setResultMode(int resultMode) |
Search |
setSearchClass(java.lang.Class<?> searchClass) |
Search |
setSorts(java.util.List<Sort> sorts) |
java.lang.String |
toString() |
protected int firstResult
protected int maxResults
protected int page
protected java.lang.Class<?> searchClass
protected java.util.List<Filter> filters
protected boolean disjunction
protected java.util.List<Sort> sorts
protected java.util.List<Field> fields
protected boolean distinct
protected java.util.List<java.lang.String> fetches
protected int resultMode
public Search setSearchClass(java.lang.Class<?> searchClass)
setSearchClass
in interface IMutableSearch
public java.lang.Class<?> getSearchClass()
getSearchClass
in interface ISearch
public Search addFilterEqual(java.lang.String property, java.lang.Object value)
public Search addFilterGreaterOrEqual(java.lang.String property, java.lang.Object value)
public Search addFilterGreaterThan(java.lang.String property, java.lang.Object value)
public Search addFilterIn(java.lang.String property, java.util.Collection<?> value)
public Search addFilterIn(java.lang.String property, java.lang.Object... value)
This takes a variable number of parameters. Any number of values can be specified.
public Search addFilterNotIn(java.lang.String property, java.util.Collection<?> value)
public Search addFilterNotIn(java.lang.String property, java.lang.Object... value)
This takes a variable number of parameters. Any number of values can be specified.
public Search addFilterLessOrEqual(java.lang.String property, java.lang.Object value)
public Search addFilterLessThan(java.lang.String property, java.lang.Object value)
public Search addFilterLike(java.lang.String property, java.lang.String value)
public Search addFilterILike(java.lang.String property, java.lang.String value)
public Search addFilterNotEqual(java.lang.String property, java.lang.Object value)
public Search addFilterNull(java.lang.String property)
public Search addFilterNotNull(java.lang.String property)
public Search addFilterEmpty(java.lang.String property)
public Search addFilterNotEmpty(java.lang.String property)
public Search addFilterAnd(Filter... filters)
This takes a variable number of parameters. Any number of Filter
s can be
specified.
public Search addFilterOr(Filter... filters)
This takes a variable number of parameters. Any number of Filter
s can be
specified.
public Search addFilterSome(java.lang.String property, Filter filter)
public Search addFilterAll(java.lang.String property, Filter filter)
public Search addFilterNone(java.lang.String property, Filter filter)
public Search addFilterCustom(java.lang.String expression)
Filter#custom(String)}
public Search addFilterCustom(java.lang.String expression, java.lang.Object... values)
Filter#custom(String, Object...)}
public Search addFilterCustom(java.lang.String expression, java.util.Collection<?> values)
Filter#custom(String, Collection)}
public void removeFilter(Filter filter)
public void removeFiltersOnProperty(java.lang.String property)
public void clearFilters()
public boolean isDisjunction()
isDisjunction
in interface ISearch
public Search setDisjunction(boolean disjunction)
setDisjunction
in interface IMutableSearch
public Search addSortAsc(java.lang.String property)
public Search addSortAsc(java.lang.String property, boolean ignoreCase)
public Search addSortDesc(java.lang.String property)
public Search addSortDesc(java.lang.String property, boolean ignoreCase)
public Search addSort(java.lang.String property, boolean desc)
desc == false
, descending
if desc == true
.public Search addSort(java.lang.String property, boolean desc, boolean ignoreCase)
desc == false
, descending
if desc == true
.public void removeSort(Sort sort)
public void removeSort(java.lang.String property)
public void clearSorts()
public Search addField(java.lang.String property)
resultMode == RESULT_MAP
, the
property
will also be used as the key for this value in the
map.public Search addField(java.lang.String property, java.lang.String key)
resultMode == RESULT_MAP
, the
key
will be used as the key for this value in the map.public Search addField(java.lang.String property, int operator)
resultMode == RESULT_MAP
, the
property
will also be used as the key for this value in the
map.public Search addField(java.lang.String property, int operator, java.lang.String key)
resultMode == RESULT_MAP
, the
key
will be used as the key for this value in the map.public void removeField(Field field)
public void removeField(java.lang.String property)
public void removeField(java.lang.String property, java.lang.String key)
public void clearFields()
public boolean isDistinct()
isDistinct
in interface ISearch
public IMutableSearch setDistinct(boolean distinct)
setDistinct
in interface IMutableSearch
public int getResultMode()
ISearch
RESULT_AUTO
, RESULT_ARRAY
,
RESULT_LIST
, RESULT_MAP
and RESULT_SINGLE
.getResultMode
in interface ISearch
ISearch.RESULT_AUTO
,
ISearch.RESULT_ARRAY
,
ISearch.RESULT_LIST
,
ISearch.RESULT_MAP
,
ISearch.RESULT_SINGLE
public Search setResultMode(int resultMode)
setResultMode
in interface IMutableSearch
public Search addFetch(java.lang.String property)
public Search addFetches(java.lang.String... properties)
public void removeFetch(java.lang.String property)
public void clearFetches()
public void clear()
public int getFirstResult()
ISearch
<= 0
for unspecified value.
getFirstResult
in interface ISearch
public Search setFirstResult(int firstResult)
setFirstResult
in interface IMutableSearch
public int getPage()
ISearch
maxResults
. If both page
and
maxResults
are specified (i.e. > 0), the first result
returned is calculated by page * maxResults
.
firstResult
has precedence over page
. So if
firstResult
is specified (i.e. > 0), page
is
ignored.
<= 0
for unspecified value.
public Search setPage(int page)
setPage
in interface IMutableSearch
public int getMaxResults()
ISearch
page
.
<= 0
for unspecified value.
getMaxResults
in interface ISearch
public Search setMaxResults(int maxResults)
setMaxResults
in interface IMutableSearch
public void clearPaging()
public Search copy()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.List<Filter> getFilters()
getFilters
in interface ISearch
public Search setFilters(java.util.List<Filter> filters)
setFilters
in interface IMutableSearch
public Search setSorts(java.util.List<Sort> sorts)
setSorts
in interface IMutableSearch
public Search setFields(java.util.List<Field> fields)
setFields
in interface IMutableSearch
public java.util.List<java.lang.String> getFetches()
getFetches
in interface ISearch
public Search setFetches(java.util.List<java.lang.String> fetches)
setFetches
in interface IMutableSearch