Class PageableList<R>
- java.lang.Object
-
- com.hybris.cockpitng.search.data.pageable.PageableList<R>
-
- All Implemented Interfaces:
IdentifiableSearchQuery,Pageable<R>
public class PageableList<R> extends java.lang.Object implements Pageable<R>
Implementation ofPageablewhich can be instantiated fromListand an integer value indicating the page size.
-
-
Constructor Summary
Constructors Constructor Description PageableList(PageableList<R> source)Copy constructor.PageableList(java.util.List<R> allResults, int pageSize)Creates a newPageableListbased on theListand the pageSize.PageableList(java.util.List<R> allResults, int pageSize, java.lang.String typeCode)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<R>getAllResults()Returns all results on all pages.java.util.List<R>getCurrentPage()Gets the entries of the current record.intgetPageNumber()Returns the active page number.intgetPageSize()Returns the page size.java.lang.StringgetQueryId()SortDatagetSortData()Returns sort related informationintgetTotalCount()Returns count of all items in the collection that is being paged.java.lang.StringgetTypeCode()Returns the "common" type code of all entries.booleanhasNextPage()Determines if there is a next page.booleanhasPreviousPage()Determines if there is a previous page.java.util.List<R>nextPage()Gets the entries of the next record page and updates the current page number (seePageable.getCurrentPage()).java.util.List<R>previousPage()Get the entries of the previous page and updates the current page number (seePageable.getCurrentPage()).voidrefresh()Refreshes current page.voidsetPageNumber(int pageNo)Sets the active page number.java.util.List<R>setPageSize(int _pageSize)Changes the page size and returns the current page with a new page size.voidsetQueryId(java.lang.String queryId)voidsetSortData(SortData sortData)voidsetTypeCode(java.lang.String typeCode)
-
-
-
Constructor Detail
-
PageableList
public PageableList(java.util.List<R> allResults, int pageSize)
Creates a newPageableListbased on theListand the pageSize.- Parameters:
allResults- -Listof elements that you want to page.pageSize-
-
PageableList
public PageableList(java.util.List<R> allResults, int pageSize, java.lang.String typeCode)
-
PageableList
public PageableList(PageableList<R> source)
Copy constructor. Creates deep copy of givenPageableListobject with shallow copy ofallResultslist.- Parameters:
source- object to copy
-
-
Method Detail
-
refresh
public void refresh()
Description copied from interface:PageableRefreshes current page.
-
getCurrentPage
public java.util.List<R> getCurrentPage()
Description copied from interface:PageableGets the entries of the current record.- Specified by:
getCurrentPagein interfacePageable<R>- Returns:
- all entries of the current record page
-
nextPage
public java.util.List<R> nextPage()
Description copied from interface:PageableGets the entries of the next record page and updates the current page number (seePageable.getCurrentPage()).- Specified by:
nextPagein interfacePageable<R>- Returns:
- all entries of the next record page or an empty list if
Pageable.hasNextPage()returns false
-
previousPage
public java.util.List<R> previousPage()
Description copied from interface:PageableGet the entries of the previous page and updates the current page number (seePageable.getCurrentPage()).- Specified by:
previousPagein interfacePageable<R>- Returns:
- List of
RESULTor empty list ifPageable.hasPreviousPage()returns false.
-
hasNextPage
public boolean hasNextPage()
Description copied from interface:PageableDetermines if there is a next page.- Specified by:
hasNextPagein interfacePageable<R>- Returns:
- boolean
-
hasPreviousPage
public boolean hasPreviousPage()
Description copied from interface:PageableDetermines if there is a previous page.- Specified by:
hasPreviousPagein interfacePageable<R>- Returns:
- boolean
-
setPageNumber
public void setPageNumber(int pageNo)
Description copied from interface:PageableSets the active page number.- Specified by:
setPageNumberin interfacePageable<R>
-
getPageSize
public int getPageSize()
Description copied from interface:PageableReturns the page size.- Specified by:
getPageSizein interfacePageable<R>- Returns:
- integer
-
getTypeCode
public java.lang.String getTypeCode()
Description copied from interface:PageableReturns the "common" type code of all entries.- Specified by:
getTypeCodein interfacePageable<R>- Returns:
- the common type code or null if no common type code can be applied
-
setTypeCode
public void setTypeCode(java.lang.String typeCode)
-
setPageSize
public java.util.List<R> setPageSize(int _pageSize)
Description copied from interface:PageableChanges the page size and returns the current page with a new page size.- Specified by:
setPageSizein interfacePageable<R>- Parameters:
_pageSize- - new page size- Returns:
ListofRESULTor empty list.
-
getTotalCount
public int getTotalCount()
Description copied from interface:PageableReturns count of all items in the collection that is being paged.- Specified by:
getTotalCountin interfacePageable<R>- Returns:
- total items count
-
getPageNumber
public int getPageNumber()
Description copied from interface:PageableReturns the active page number.- Specified by:
getPageNumberin interfacePageable<R>- Returns:
- the active page number
-
getSortData
public SortData getSortData()
Description copied from interface:PageableReturns sort related information- Specified by:
getSortDatain interfacePageable<R>- Returns:
- sort related information
-
setSortData
public void setSortData(SortData sortData)
- Specified by:
setSortDatain interfacePageable<R>- Parameters:
sortData- sort related information
-
getAllResults
public java.util.List<R> getAllResults()
Description copied from interface:PageableReturns all results on all pages. May be a long lasting operation for big data sets, therefore should be used carefully.- Specified by:
getAllResultsin interfacePageable<R>- Returns:
-
getQueryId
public java.lang.String getQueryId()
- Specified by:
getQueryIdin interfaceIdentifiableSearchQuery- Returns:
- identifier of a query. Queries with same identifiers are assumed to perform same request to data source
-
setQueryId
public void setQueryId(java.lang.String queryId)
- Specified by:
setQueryIdin interfacePageable<R>- Parameters:
queryId- Queries with same identifiers are assumed to perform same request to data source
-
-