Class QueryOptions
java.lang.Object
edu.internet2.middleware.grouper.internal.dao.QueryOptions
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 Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic QueryOptions
getCount()
count of the query if it is being calculated.If this is a paged query, and what are specsif this query is sorted (by options), and what the col(s) arestatic void
initTotalCount
(QueryOptions queryOptions) boolean
If the count of the query should be retrieved (sometimes paging will get the count) default to falseboolean
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 querypaging
(int pageSize, int pageNumber, boolean doTotalCount) factory for query pagingpaging
(QueryPaging queryPaging1) If this is a paged query, and what are specspagingCursor
(int pageSize, Object lastCursorField, boolean cursorFieldIncludesLastRetrieved, boolean doTotalCount) factory for query pagingretrieveCount
(boolean retrieveCount1) If the count of the query should be retrieved (sometimes paging will get the count) default to falseretrieveResults
(boolean retrieveResults1) If the results should be retrieved (generally only false for size queries).secondLevelCache
(boolean secondLevelCache1) secondLevelCacheRegion
(String secondLevelCacheRegion1) void
count of the query if it is being calculated.if this query is sorted (by options), and what the col(s) aresort ascending on this fieldsort ascending on this fieldtoString()
-
Constructor Details
-
QueryOptions
public QueryOptions()
-
-
Method Details
-
needsCountQuery
see if paging is constraining the query so we dont need a separate count query- Parameters:
queryOptions
-maxResults
-- Returns:
- true if needs extra count query
-
initTotalCount
- Parameters:
queryOptions
-
-
create
public static QueryOptions create(String sortString, Boolean ascending, Integer pageNumber, Integer pageSize) - Parameters:
sortString
-ascending
-pageNumber
- 1 indexed page numberpageSize
-- Returns:
- the query options if needed
-
secondLevelCache
- Parameters:
secondLevelCache1
-- Returns:
- this for chaining
-
getSecondLevelCache
- Returns:
- if second level cache
-
secondLevelCacheRegion
- Parameters:
secondLevelCacheRegion1
-- Returns:
- this for chaining
-
getSecondLevelCacheRegion
- Returns:
- if second level cache
-
toString
-
getQuerySort
if this query is sorted (by options), and what the col(s) are- Returns:
- sort
-
sort
if this query is sorted (by options), and what the col(s) are- Parameters:
querySort1
-- Returns:
- this for chaining
-
getQueryPaging
If this is a paged query, and what are specs- Returns:
- paging
-
sortAsc
sort ascending on this field- Parameters:
field
-- Returns:
- this for chaining
-
paging
factory for query paging- Parameters:
pageSize
-pageNumber
- 1 indexed page numberdoTotalCount
- true to do total count, false to not- Returns:
- this for chaining
-
pagingCursor
public QueryOptions pagingCursor(int pageSize, Object lastCursorField, boolean cursorFieldIncludesLastRetrieved, boolean doTotalCount) factory for query paging- Parameters:
pageSize
-lastCursorField
-cursorFieldIncludesLastRetrieved
-doTotalCount
- true to do total count, false to not- Returns:
- this for chaining
-
sortDesc
sort ascending on this field- Parameters:
field
-- Returns:
- this for chaining
-
paging
If this is a paged query, and what are specs- Parameters:
queryPaging1
-- Returns:
- this for chaining
-
isRetrieveResults
public boolean isRetrieveResults()If the results should be retrieved (generally only false for size queries). default to true- Returns:
- retrieve results
-
retrieveResults
If the results should be retrieved (generally only false for size queries). default to true- Parameters:
retrieveResults1
-- Returns:
- this for chaining
-
isRetrieveCount
public boolean isRetrieveCount()If the count of the query should be retrieved (sometimes paging will get the count) default to false- Returns:
- retrieve count
-
retrieveCount
If the count of the query should be retrieved (sometimes paging will get the count) default to false- Parameters:
retrieveCount1
-- Returns:
- this for chaining
-
getCount
count of the query if it is being calculated. Note the hibernateSession API is what sets this- Returns:
- the count or null if not set
-
setCount
count of the query if it is being calculated. Note the hibernateSession API is what sets this- Parameters:
count1
-
-