Class QueryPaging
java.lang.Object
edu.internet2.middleware.grouper.internal.dao.QueryPaging
-
Constructor Summary
ConstructorDescriptionQueryPaging
(int pageSize1, int pageNumber1, boolean doTotalCount1) constructor.QueryPaging
(int pageSize1, Object lastCursorField1, boolean cursorFieldIncludesLastRetrieved1, boolean doTotalCount1) factory for query paging -
Method Summary
Modifier and TypeMethodDescriptionvoid
throw exception if this bean is not inittedvoid
Based on the pageNumber, pageSize, and totalRecordCount, figure out the rest.This can be used to provide a drop down box of possible pages to skip to.int
return the first index on page (0 indexed), from 0 to the number of resultsif paging by cursor, then this is the last field retrievedint
return the last index on page (0 indexed)int
getter for numberOfPages: number of pages totalint
Get the number of results on the current pageint
getter for pageEndIndex: index (1 indexed) of the last record on the pageint
getter for pageNumber: page number indexed by 1 (friendly)int
getter for pageSize: the number of records per pageint
getter for pageStartIndex: index of the first record on the first page, this was documented as 1 indexed, but it seems to be 0 indexedint
calculate the total record count on last pageint
getter for totalRecordCount: total number of records in the set (you must set this before the tag is called)boolean
initted()
see if this bean has been calculatedboolean
if we should cache the total count and not run again if already runboolean
boolean
if cursor field is unique, this should be false.boolean
if we should do the total count when we do that actual query (note, this might not always be possible in all cases, will throw an exception if not possible)boolean
see if the paging is on first pageboolean
see if the paging is on last pageint
nextPageNeeded
(int currentPageNumber) based on a paging bean, and a current page, return the next page needed to display (ellipses, button, or label)static QueryPaging
page
(int pageSize, int pageNumber, boolean doTotalCount) factory for query pagingstatic QueryPaging
pageCursor
(int pageSize, Object lastCursorField, boolean cursorFieldIncludesLastRetrieved, boolean doTotalCount) factory for query pagingvoid
setCacheTotalCount
(boolean cacheTotalCount1) if we should cache the total count and not run again if already runvoid
setCursorBasedPaging
(boolean cursorBasedPaging1) void
setCursorFieldIncludesLastRetrieved
(boolean cursorFieldIncludesLAstRetrieved1) if cursor field is unique, this should be false.void
setDoTotalCount
(boolean doTotalCount1) if we should do the total count when we do that actual query (note, this might not always be possible in all cases, will throw an exception if not possible)void
setFirstIndexOnPage
(int startIndex) set the first index on the page, 0 indexed 0 -> 1, pageSize -> 2, 2*pageSize -> 3void
setLastCursorField
(Object lastCursorField1) if paging by cursor, then this is the last field retrievedvoid
setNumberOfPages
(int _numberOfPages) setter for numberOfPages: number of pages totalvoid
setPageEndIndex
(int _pageEndIndex) setter for pageEndIndex: index (1 indexed) of the last record on the pagevoid
setPageNumber
(int _pageNumber) pageNumber: page number indexed by 1 (friendly)void
setPageSize
(int _pageSize) setter for pageSize: the number of records per pagevoid
setPageStartIndex
(int _pageStartIndex) setter for pageStartIndex: index of the first record on the first page, this was documented as 1 indexed, but it seems to be 0 indexedvoid
setPageStartIndexQueryByIndex
(int startIndex) set the first index on the page, 0 indexed, dont use pages to query...void
setTotalRecordCount
(int _totalRecordCount) setter for totalRecordCount: total number of records in the set (you must set this before the tag is called)boolean
if we should pagetoString()
-
Constructor Details
-
QueryPaging
public QueryPaging() -
QueryPaging
public QueryPaging(int pageSize1, Object lastCursorField1, boolean cursorFieldIncludesLastRetrieved1, boolean doTotalCount1) factory for query paging- Parameters:
pageSize1
-lastCursorField1
- object that is last retrievedcursorFieldIncludesLastRetrieved1
- true if >= last cursor fielddoTotalCount1
- true to do total count, false to not
-
QueryPaging
public QueryPaging(int pageSize1, int pageNumber1, boolean doTotalCount1) constructor. NOTE, THIS IS 1 INDEXED ON PAGE NUMBER- Parameters:
pageSize1
- number of records per pagepageNumber1
- 1 indexed page number to showdoTotalCount1
- if hibernate session should do a total count and calculate indexes when doing the query
-
-
Method Details
-
getLastCursorField
if paging by cursor, then this is the last field retrieved- Returns:
- the lastCursorField
-
setLastCursorField
if paging by cursor, then this is the last field retrieved- Parameters:
lastCursorField1
- the lastCursorField to set
-
isCursorFieldIncludesLastRetrieved
public boolean isCursorFieldIncludesLastRetrieved()if cursor field is unique, this should be false. If not, then should be true if should include the last field in the next resultset- Returns:
- the cursorFieldIncludesLAstRetrieved
-
setCursorFieldIncludesLastRetrieved
public void setCursorFieldIncludesLastRetrieved(boolean cursorFieldIncludesLAstRetrieved1) if cursor field is unique, this should be false. If not, then should be true if should include the last field in the next resultset- Parameters:
cursorFieldIncludesLAstRetrieved1
- the cursorFieldIncludesLAstRetrieved to set
-
getNumberOfPages
public int getNumberOfPages()getter for numberOfPages: number of pages total- Returns:
- the value of the field
-
getPageEndIndex
public int getPageEndIndex()getter for pageEndIndex: index (1 indexed) of the last record on the page- Returns:
- the value of the field
-
getPageNumber
public int getPageNumber()getter for pageNumber: page number indexed by 1 (friendly)- Returns:
- the value of the field
-
getPageSize
public int getPageSize()getter for pageSize: the number of records per page- Returns:
- the value of the field
-
getPageStartIndex
public int getPageStartIndex()getter for pageStartIndex: index of the first record on the first page, this was documented as 1 indexed, but it seems to be 0 indexed- Returns:
- the value of the field
-
getTotalRecordCount
public int getTotalRecordCount()getter for totalRecordCount: total number of records in the set (you must set this before the tag is called)- Returns:
- the value of the field
-
setNumberOfPages
public void setNumberOfPages(int _numberOfPages) setter for numberOfPages: number of pages total- Parameters:
_numberOfPages
- is the data to set
-
setPageEndIndex
public void setPageEndIndex(int _pageEndIndex) setter for pageEndIndex: index (1 indexed) of the last record on the page- Parameters:
_pageEndIndex
- is the data to set
-
setPageSize
public void setPageSize(int _pageSize) setter for pageSize: the number of records per page- Parameters:
_pageSize
- is the data to set
-
setPageStartIndex
public void setPageStartIndex(int _pageStartIndex) setter for pageStartIndex: index of the first record on the first page, this was documented as 1 indexed, but it seems to be 0 indexed- Parameters:
_pageStartIndex
- is the data to set
-
setPageStartIndexQueryByIndex
public void setPageStartIndexQueryByIndex(int startIndex) set the first index on the page, 0 indexed, dont use pages to query...
- Parameters:
startIndex
-
-
setTotalRecordCount
public void setTotalRecordCount(int _totalRecordCount) setter for totalRecordCount: total number of records in the set (you must set this before the tag is called)- Parameters:
_totalRecordCount
- is the data to set
-
assertInitted
public void assertInitted()throw exception if this bean is not initted -
calculateIndexes
public void calculateIndexes()Based on the pageNumber, pageSize, and totalRecordCount, figure out the rest. Pretty much everything is friendly / oracle indexed (by 1) -
getAllPages
This can be used to provide a drop down box of possible pages to skip to. This is helpful for example if there are 30 pages and you want page 15, normally this would require numerous clicks before page 15 is displayed as a choice.- Returns:
- a list of all the valid page numbers that could be referred to
-
getFirstIndexOnPage
public int getFirstIndexOnPage()return the first index on page (0 indexed), from 0 to the number of results- Returns:
- the first index on page 0 indexed
-
setFirstIndexOnPage
public void setFirstIndexOnPage(int startIndex) set the first index on the page, 0 indexed 0 -> 1, pageSize -> 2, 2*pageSize -> 3
- Parameters:
startIndex
-
-
getLastIndexOnPage
public int getLastIndexOnPage()return the last index on page (0 indexed)- Returns:
- the last index on page 0 indexed
-
getNumberOfResultsOnPage
public int getNumberOfResultsOnPage()Get the number of results on the current page- Returns:
- number of results on current page
-
getTotalOnLastPage
public int getTotalOnLastPage()calculate the total record count on last page- Returns:
- total records on last page
-
initted
public boolean initted()see if this bean has been calculated- Returns:
- true if initted
-
isFirstPage
public boolean isFirstPage()see if the paging is on first page- Returns:
- true if first page
-
isLastPage
public boolean isLastPage()see if the paging is on last page- Returns:
- true if last page
-
nextPageNeeded
public int nextPageNeeded(int currentPageNumber) based on a paging bean, and a current page, return the next page needed to display (ellipses, button, or label)- Parameters:
currentPageNumber
-- Returns:
- the next page number which is relevant
-
setPageNumber
public void setPageNumber(int _pageNumber) pageNumber: page number indexed by 1 (friendly)- Parameters:
_pageNumber
-
-
shouldPage
public boolean shouldPage()if we should page- Returns:
- if should page
-
page
factory for query paging- Parameters:
pageSize
-pageNumber
- 1 indexed page numberdoTotalCount
- true to do total count, false to not- Returns:
- the query paging
-
pageCursor
public static QueryPaging pageCursor(int pageSize, Object lastCursorField, boolean cursorFieldIncludesLastRetrieved, boolean doTotalCount) factory for query paging- Parameters:
pageSize
-lastCursorField
- object that is last retrievedcursorFieldIncludesLastRetrieved
- true if >= last cursor fielddoTotalCount
- true to do total count, false to not- Returns:
- the query paging
-
isCursorBasedPaging
public boolean isCursorBasedPaging()- Returns:
- the cursorBasedPaging
-
setCursorBasedPaging
public void setCursorBasedPaging(boolean cursorBasedPaging1) - Parameters:
cursorBasedPaging1
- the cursorBasedPaging to set
-
toString
-
isDoTotalCount
public boolean isDoTotalCount()if we should do the total count when we do that actual query (note, this might not always be possible in all cases, will throw an exception if not possible)- Returns:
- true if we should do a total count
-
setDoTotalCount
public void setDoTotalCount(boolean doTotalCount1) if we should do the total count when we do that actual query (note, this might not always be possible in all cases, will throw an exception if not possible)- Parameters:
doTotalCount1
-
-
isCacheTotalCount
public boolean isCacheTotalCount()if we should cache the total count and not run again if already run- Returns:
- if we should cache the total count
-
setCacheTotalCount
public void setCacheTotalCount(boolean cacheTotalCount1) if we should cache the total count and not run again if already run- Parameters:
cacheTotalCount1
-
-