public class QueryOptions extends Object
options on a query (e.g. sorting, paging, total result size, etc)
Sorting example:
queryOptions = new QueryOptions().sortAsc("m.subjectIdDb");
Set<Member> members = group.getImmediateMembers(field, queryOptions);
Paging example:
QueryPaging queryPaging = new QueryPaging();
queryPaging.setPageSize(pageSize);
queryPaging.setPageNumber(pageNumberOneIndexed);
-or- queryPaging.setFirstIndexOnPage(startZeroIndexed);
queryOptions = new QueryOptions().paging(queryPaging);
Set<Member> members = group.getImmediateMembers(field, queryOptions);
Query count example:
QueryOptions queryOptions = new QueryOptions().retrieveCount(true).retrieveResults(false);
group.getImmediateMembers(field, queryOptions);
int totalSize = queryOptions.getCount().intValue();
| Constructor and Description |
|---|
QueryOptions() |
| Modifier and Type | Method and Description |
|---|---|
static QueryOptions |
create(String sortString,
Boolean ascending,
Integer pageNumber,
Integer pageSize) |
Long |
getCount()
count of the query if it is being calculated.
|
QueryPaging |
getQueryPaging()
If this is a paged query, and what are specs
|
QuerySort |
getQuerySort()
if this query is sorted (by options), and what the col(s) are
|
Boolean |
getSecondLevelCache() |
String |
getSecondLevelCacheRegion() |
static void |
initTotalCount(QueryOptions queryOptions) |
boolean |
isRetrieveCount()
If the count of the query should be retrieved (sometimes paging will get
the count)
default to false
|
boolean |
isRetrieveResults()
If the results should be retrieved (generally only false for size queries).
|
static boolean |
needsCountQuery(QueryOptions queryOptions,
int maxResults)
see if paging is constraining the query so we dont need a separate count query
|
QueryOptions |
paging(int pageSize,
int pageNumber,
boolean doTotalCount)
factory for query paging
|
QueryOptions |
paging(QueryPaging queryPaging1)
If this is a paged query, and what are specs
|
QueryOptions |
pagingCursor(int pageSize,
Object lastCursorField,
boolean cursorFieldIncludesLastRetrieved,
boolean doTotalCount)
factory for query paging
|
QueryOptions |
retrieveCount(boolean retrieveCount1)
If the count of the query should be retrieved (sometimes paging will get
the count)
default to false
|
QueryOptions |
retrieveResults(boolean retrieveResults1)
If the results should be retrieved (generally only false for size queries).
|
QueryOptions |
secondLevelCache(boolean secondLevelCache1) |
QueryOptions |
secondLevelCacheRegion(String secondLevelCacheRegion1) |
void |
setCount(Long count1)
count of the query if it is being calculated.
|
QueryOptions |
sort(QuerySort querySort1)
if this query is sorted (by options), and what the col(s) are
|
QueryOptions |
sortAsc(String field)
sort ascending on this field
|
QueryOptions |
sortDesc(String field)
sort ascending on this field
|
String |
toString() |
public static boolean needsCountQuery(QueryOptions queryOptions, int maxResults)
queryOptions - maxResults - public static void initTotalCount(QueryOptions queryOptions)
queryOptions - public static QueryOptions create(String sortString, Boolean ascending, Integer pageNumber, Integer pageSize)
sortString - ascending - pageNumber - 1 indexed page numberpageSize - public QueryOptions secondLevelCache(boolean secondLevelCache1)
secondLevelCache1 - public Boolean getSecondLevelCache()
public QueryOptions secondLevelCacheRegion(String secondLevelCacheRegion1)
secondLevelCacheRegion1 - public String getSecondLevelCacheRegion()
public String toString()
toString in class ObjectObject.toString()public QuerySort getQuerySort()
public QueryOptions sort(QuerySort querySort1)
querySort1 - public QueryPaging getQueryPaging()
public QueryOptions sortAsc(String field)
field - public QueryOptions paging(int pageSize, int pageNumber, boolean doTotalCount)
pageSize - pageNumber - 1 indexed page numberdoTotalCount - true to do total count, false to notpublic QueryOptions pagingCursor(int pageSize, Object lastCursorField, boolean cursorFieldIncludesLastRetrieved, boolean doTotalCount)
pageSize - lastCursorField - cursorFieldIncludesLastRetrieved - doTotalCount - true to do total count, false to notpublic QueryOptions sortDesc(String field)
field - public QueryOptions paging(QueryPaging queryPaging1)
queryPaging1 - public boolean isRetrieveResults()
public QueryOptions retrieveResults(boolean retrieveResults1)
retrieveResults1 - public boolean isRetrieveCount()
public QueryOptions retrieveCount(boolean retrieveCount1)
retrieveCount1 - public Long getCount()
public void setCount(Long count1)
count1 - Copyright © 2016 Internet2. All rights reserved.