Class QueryPaging
java.lang.Object
edu.internet2.middleware.grouper.internal.dao.QueryPaging
-
Constructor Summary
ConstructorsConstructorDescriptionQueryPaging(int pageSize1, int pageNumber1, boolean doTotalCount1) constructor.QueryPaging(int pageSize1, Object lastCursorField1, boolean cursorFieldIncludesLastRetrieved1, boolean doTotalCount1) factory for query paging -
Method Summary
Modifier and TypeMethodDescriptionvoidthrow exception if this bean is not inittedvoidBased 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.intreturn the first index on page (0 indexed), from 0 to the number of resultsif paging by cursor, then this is the last field retrievedintreturn the last index on page (0 indexed)intgetter for numberOfPages: number of pages totalintGet the number of results on the current pageintgetter for pageEndIndex: index (1 indexed) of the last record on the pageintgetter for pageNumber: page number indexed by 1 (friendly)intgetter for pageSize: the number of records per pageintgetter for pageStartIndex: index of the first record on the first page, this was documented as 1 indexed, but it seems to be 0 indexedintcalculate the total record count on last pageintgetter for totalRecordCount: total number of records in the set (you must set this before the tag is called)booleaninitted()see if this bean has been calculatedbooleanif we should cache the total count and not run again if already runbooleanbooleanif cursor field is unique, this should be false.booleanif 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)booleansee if the paging is on first pagebooleansee if the paging is on last pageintnextPageNeeded(int currentPageNumber) based on a paging bean, and a current page, return the next page needed to display (ellipses, button, or label)static QueryPagingpage(int pageSize, int pageNumber, boolean doTotalCount) factory for query pagingstatic QueryPagingpageCursor(int pageSize, Object lastCursorField, boolean cursorFieldIncludesLastRetrieved, boolean doTotalCount) factory for query pagingvoidsetCacheTotalCount(boolean cacheTotalCount1) if we should cache the total count and not run again if already runvoidsetCursorBasedPaging(boolean cursorBasedPaging1) voidsetCursorFieldIncludesLastRetrieved(boolean cursorFieldIncludesLAstRetrieved1) if cursor field is unique, this should be false.voidsetDoTotalCount(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)voidsetFirstIndexOnPage(int startIndex) set the first index on the page, 0 indexed 0 -> 1, pageSize -> 2, 2*pageSize -> 3voidsetLastCursorField(Object lastCursorField1) if paging by cursor, then this is the last field retrievedvoidsetNumberOfPages(int _numberOfPages) setter for numberOfPages: number of pages totalvoidsetPageEndIndex(int _pageEndIndex) setter for pageEndIndex: index (1 indexed) of the last record on the pagevoidsetPageNumber(int _pageNumber) pageNumber: page number indexed by 1 (friendly)voidsetPageSize(int _pageSize) setter for pageSize: the number of records per pagevoidsetPageStartIndex(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 indexedvoidsetPageStartIndexQueryByIndex(int startIndex) set the first index on the page, 0 indexed, dont use pages to query...voidsetTotalRecordCount(int _totalRecordCount) setter for totalRecordCount: total number of records in the set (you must set this before the tag is called)booleanif 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-
-