public class SearchOptionsBuilder extends Object
SearchOptions objects. It can be used to define paged searches returning SearchResults.
When several filters are added, implicit AND operators are used if not specified.
See SearchOptions for deeper details on search mechanism options.SearchOptions| Constructor and Description |
|---|
SearchOptionsBuilder(int startIndex,
int maxResults)
|
SearchOptionsBuilder(SearchOptions searchOptions)
Creates a new
SearchOptionsBuilder from another instance by |
public SearchOptionsBuilder(int startIndex,
int maxResults)
SearchOptions with results limited to startIndex and maxResults. If you are interested only in the number of
elements matching with the given criteria without knowing the elements details, it's possible to use zero as maxResults:
SearchResult.getResult() will send an empty list and SearchResult.getCount() will return the number of matching elements.startIndex - the first result to returnmaxResults - the maximum results to return. The actual number can be smaller, if the end of the list has been reached.SearchOptions,
SearchResult.getResult(),
SearchResult.getCount()public SearchOptionsBuilder(SearchOptions searchOptions)
SearchOptionsBuilder from another instance bysearchOptions - public SearchOptionsBuilder filter(String field, Serializable value)
field - The name of the field to filter on. Depending on the search parameter, specify the field by accessing the relevant xxxSearchDescriptor classes.
For example, HumanTaskInstanceSearchDescriptor.NAME and HumanTaskInstanceSearchDescriptor.PROCESS_DEFINITION_ID.value - the single value to filter on that field namepublic SearchOptionsBuilder greaterThan(String field, Serializable value)
field - the field name to compare to.value - the value to compare.for field valuespublic SearchOptionsBuilder greaterOrEquals(String field, Serializable value)
field - value - for field valuespublic SearchOptionsBuilder lessThan(String field, Serializable value)
field - the field that should be less thanvalue - for field valuespublic SearchOptionsBuilder lessOrEquals(String field, Serializable value)
field - the field that should be less or equalsvalue - the valuefor field valuespublic SearchOptionsBuilder between(String field, Serializable from, Serializable to)
field - the field that should be betweenfrom - from this valueto - to this valuefor field valuespublic SearchOptionsBuilder differentFrom(String field, Serializable value)
field - value - for field valuespublic SearchOptionsBuilder or()
public SearchOptionsBuilder and()
public SearchOptionsBuilder leftParenthesis()
public SearchOptionsBuilder rightParenthesis()
public SearchOptionsBuilder searchTerm(String value)
value - the search termpublic SearchOptionsBuilder sort(String field, Order order)
field - the field name to sort byorder - the order of the sort (ASCENDING, DESCENDING)public SearchOptionsBuilder setFilters(List<SearchFilter> filters)
filters - the filters to setpublic SearchOptionsBuilder setSort(List<Sort> sorts)
sorts - the sorts to setpublic SearchOptions done()
SearchOptions finally built using this builder.Copyright © 2018 Bonitasoft S.A.. All rights reserved.