Interface PageProvider<T>
-
- Type Parameters:
T- any Serializable item
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
AbstractGroupMemberPageProvider,AbstractGroupsPageProvider,AbstractPageProvider,AbstractUsersPageProvider,AuditPageProvider,CoreQueryAndFetchPageProvider,CoreQueryDocumentPageProvider,DirectoryEntryPageProvider,DocumentHistoryPageProvider,DocumentModelListPageProvider,ElasticSearchNativePageProvider,ElasticSearchNxqlPageProvider,EmptyPageProvider,ESAuditPageProvider,ESDocumentHistoryPageProvider,GroupMemberGroupsPageProvider,GroupMemberUsersPageProvider,GroupsPageProvider,LatestCreatedUsersOrGroupsPageProvider,MongoDBAuditPageProvider,MongoDBDocumentHistoryPageProvider,NuxeoGroupsPageProvider,NuxeoPrincipalsPageProvider,RoutingTaskPageProvider,ShibbolethGroupsPageProvider,UsersPageProvider,UserTaskPageProvider,VFolderPageProvider
public interface PageProvider<T> extends Serializable
Basic interface for a page provider, independent of type of items in the listProvides APIs to navigate between result pages
- Since:
- 5.4
- Author:
- arussel, Anahide Tchertchian
-
-
Field Summary
Fields Modifier and Type Field Description static longDEFAULT_MAX_PAGE_SIZEDefault maximum page size value.static StringDEFAULT_MAX_PAGE_SIZE_RUNTIME_PROPstatic StringHIGHLIGHT_CTX_DATAHighlight context data property name.static longPAGE_LIMIT_UNKNOWNPage limit unknown.static StringSKIP_AGGREGATES_PROPstatic longUNKNOWN_SIZEConstant to express that the total number of result elements is unknown (usually because the query has not been done yet).static longUNKNOWN_SIZE_AFTER_QUERYConstant to express that the total number of result elements is unknown even after performing a query.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddQuickFilter(QuickFilter quickFilter)voidaddSortInfo(String sortColumn, boolean sortAscending)Add the given sort info to the list of sorting infos.voidfirstPage()Go to the first pageList<AggregateDefinition>getAggregateDefinitions()Map<String,Aggregate<? extends Bucket>>getAggregates()List<QuickFilter>getAvailableQuickFilters()TgetCurrentEntry()Returns the current entry.List<T>getCurrentPage()Returns the current page of results.longgetCurrentPageIndex()Returns the current page index as a zero-based integer.longgetCurrentPageOffset()Returns the offset (starting from 0) of the first element in the current page orUNKNOWN_SIZE.longgetCurrentPageSize()Returns the number of elements in current page.StringgetCurrentPageStatus()Returns a simple formatted string for current pagination status.PageSelections<T>getCurrentSelectPage()Returns the current page of results wrapped in aPageSelectionitem.PageProviderDefinitiongetDefinition()ThrowablegetError()StringgetErrorMessage()List<String>getHighlights()longgetMaxPageSize()Returns the max number of results per page.StringgetName()Returns the provider identifierlonggetNumberOfPages()Returns the total number of pages or 0 if number of pages is unknown.longgetPageLimit()Returns the page limit.longgetPageSize()Returns the number of results per page.List<Long>getPageSizeOptions()Returns a list of available page size options to display in the page size selector.Object[]getParameters()Map<String,Serializable>getProperties()Gets properties set on the provider.List<QuickFilter>getQuickFilters()longgetResultsCount()Returns the number of result elements if available or a negative value if it is unknown:UNKNOWN_SIZEif it is unknown as query was not done, and since 5.5,UNKNOWN_SIZE_AFTER_QUERYif it is still unknown after query was done.longgetResultsCountLimit()Limit of number of results beyond which the page provider may not be able to computegetResultsCount()or navigate.DocumentModelgetSearchDocumentModel()SortInfogetSortInfo()Returns the first sorting info for this providerintgetSortInfoIndex(String sortColumn, boolean sortAscending)Returns a positive 0-based integer if given sort information is found on the set sort infos, indicating the sort index, or -1 if this sort information is not found.List<SortInfo>getSortInfos()Returns the complete list of sorting info for this providerbooleanhasAggregateSupport()booleanhasChangedParameters(Object[] parameters)Test if provider parameters have changedbooleanhasError()booleanisLastPageAvailable()Returns a boolean expressing if the last page can be displayed.booleanisNextEntryAvailable()Returns true if there is a next entry.booleanisNextPageAvailable()Returns a boolean expressing if there are further pages.booleanisPreviousEntryAvailable()Returns true if there is a previous entry.booleanisPreviousPageAvailable()Returns a boolean expressing if there is a previous page.booleanisSkipAggregates()booleanisSortable()Returns if this provider is sortablevoidlastPage()Go to the last page.voidnextEntry()Move the current entry to the next one, if applicable.voidnextPage()Go to the next pagevoidpreviousEntry()Move the current entry to the previous one, if applicable.voidpreviousPage()Go to the previous pagevoidrefresh()Forces refresh of the current page.voidsetCurrentEntry(T entry)Sets the current entry.voidsetCurrentEntryIndex(long index)Sets the current entry index.List<T>setCurrentPage(long page)Sets the current page of results to the required one and return it.voidsetCurrentPageIndex(long currentPageIndex)Sets the current page of results to the required one.voidsetCurrentPageOffset(long offset)Sets the current page offset.voidsetDefinition(PageProviderDefinition providerDefinition)voidsetHighlights(List<String> highlights)voidsetMaxPageSize(long pageSize)Sets the max number of results per page.voidsetName(String name)Sets the provider identifiervoidsetPageProviderChangedListener(PageProviderChangedListener listener)Sets thePageProviderChangedListenerfor thisPageProvider.voidsetPageSize(long pageSize)Sets the number of results per page.voidsetPageSizeOptions(List<Long> options)Sets the page size options.voidsetParameters(Object[] parameters)voidsetProperties(Map<String,Serializable> properties)Sets properties set on the provider.voidsetQuickFilters(List<QuickFilter> quickFilters)voidsetResultsCount(long resultsCount)Sets the results count.voidsetSearchDocumentModel(DocumentModel doc)voidsetSelectedEntries(List<T> entries)Sets the list of selected entries to take into account ingetCurrentSelectPage().voidsetSortable(boolean sortable)voidsetSortInfo(String sortColumn, boolean sortAscending, boolean removeOtherSortInfos)Sets the first and only sorting info for this provider if parameter removeOtherSortInfos is true.voidsetSortInfo(SortInfo sortInfo)Sets the first and only sorting info for this provider.voidsetSortInfos(List<SortInfo> sortInfo)Sets the complete list of sorting info for this provider
-
-
-
Field Detail
-
DEFAULT_MAX_PAGE_SIZE_RUNTIME_PROP
static final String DEFAULT_MAX_PAGE_SIZE_RUNTIME_PROP
- See Also:
- Constant Field Values
-
UNKNOWN_SIZE
static final long UNKNOWN_SIZE
Constant to express that the total number of result elements is unknown (usually because the query has not been done yet).- See Also:
- Constant Field Values
-
UNKNOWN_SIZE_AFTER_QUERY
static final long UNKNOWN_SIZE_AFTER_QUERY
Constant to express that the total number of result elements is unknown even after performing a query.- Since:
- 5.5
- See Also:
- Constant Field Values
-
DEFAULT_MAX_PAGE_SIZE
static final long DEFAULT_MAX_PAGE_SIZE
Default maximum page size value.- Since:
- 6.0, default value is 1000.
- See Also:
- Constant Field Values
-
PAGE_LIMIT_UNKNOWN
static final long PAGE_LIMIT_UNKNOWN
Page limit unknown.- Since:
- 5.8
- See Also:
- Constant Field Values
-
HIGHLIGHT_CTX_DATA
static final String HIGHLIGHT_CTX_DATA
Highlight context data property name. Used to store highlights in document context data when fetching ES results- Since:
- 9.1
- See Also:
- Constant Field Values
-
SKIP_AGGREGATES_PROP
static final String SKIP_AGGREGATES_PROP
- Since:
- 10.2
- See Also:
- Constant Field Values
-
-
Method Detail
-
getName
String getName()
Returns the provider identifier
-
setName
void setName(String name)
Sets the provider identifier
-
getProperties
Map<String,Serializable> getProperties()
Gets properties set on the provider.Useful to retrieve a provider specific field attributes after instantiation. Other contextual parameters can be passed through API constructing the result provider.
-
setProperties
void setProperties(Map<String,Serializable> properties)
Sets properties set on the provider.Useful to initialize a provider specific field attributes after instantiation. Other contextual parameters can be passed through API constructing the result provider.
-
getParameters
Object[] getParameters()
-
setParameters
void setParameters(Object[] parameters)
-
getPageSize
long getPageSize()
Returns the number of results per page. 0 means no pagination unlessgetMaxPageSize()is greater than this value, it will be taken into account instead.
-
setPageSize
void setPageSize(long pageSize)
Sets the number of results per page. 0 means no pagination unlessgetMaxPageSize()is greater than this value, it will be taken into account instead.
-
getMaxPageSize
long getMaxPageSize()
Returns the max number of results per page. 0 means no pagination.If page size is greater than this maximum value, it will be taken into account instead.
- Since:
- 5.4.2
-
setMaxPageSize
void setMaxPageSize(long pageSize)
Sets the max number of results per page. 0 means no pagination.If page size is greater than this maximum value, it will be taken into account instead.
- Since:
- 5.4.2
-
getPageSizeOptions
List<Long> getPageSizeOptions()
Returns a list of available page size options to display in the page size selector.Uses an hardcoded list of values, and adds up the page provider initial and current page sizes.
- Since:
- 7.3
-
setPageSizeOptions
void setPageSizeOptions(List<Long> options)
Sets the page size options.- Since:
- 7.3
-
getResultsCount
long getResultsCount()
Returns the number of result elements if available or a negative value if it is unknown:UNKNOWN_SIZEif it is unknown as query was not done, and since 5.5,UNKNOWN_SIZE_AFTER_QUERYif it is still unknown after query was done.
-
setResultsCount
void setResultsCount(long resultsCount)
Sets the results count.- Since:
- 5.5
-
getNumberOfPages
long getNumberOfPages()
Returns the total number of pages or 0 if number of pages is unknown.
-
getPageLimit
long getPageLimit()
Returns the page limit. The n first page we know they exist.- Since:
- 5.7.3
-
getCurrentPage
List<T> getCurrentPage()
Returns the current page of results.This method is designed to be called from higher levels. It therefore ensures cheapness of repeated calls, rather than data consistency. There is a refresh() method for that.
- Returns:
- the current page
-
getCurrentSelectPage
PageSelections<T> getCurrentSelectPage()
Returns the current page of results wrapped in aPageSelectionitem.By default, no entry is selected, unless
setSelectedEntries(List)has been called before.
-
setSelectedEntries
void setSelectedEntries(List<T> entries)
Sets the list of selected entries to take into account ingetCurrentSelectPage().
-
setCurrentPageOffset
void setCurrentPageOffset(long offset)
Sets the current page offset.If the provider keeps information linked to the current page, they should be reset after calling this method.
- Since:
- 5.5
-
setCurrentPageIndex
void setCurrentPageIndex(long currentPageIndex)
Sets the current page of results to the required one.- Parameters:
currentPageIndex- the page index, starting from 0- Since:
- 5.7.3
-
setCurrentPage
List<T> setCurrentPage(long page)
Sets the current page of results to the required one and return it.- Parameters:
page- the page index, starting from 0
-
refresh
void refresh()
Forces refresh of the current page.
-
isNextPageAvailable
boolean isNextPageAvailable()
Returns a boolean expressing if there are further pages.
-
isLastPageAvailable
boolean isLastPageAvailable()
Returns a boolean expressing if the last page can be displayed.- Since:
- 5.5
-
isPreviousPageAvailable
boolean isPreviousPageAvailable()
Returns a boolean expressing if there is a previous page.
-
getCurrentPageSize
long getCurrentPageSize()
Returns the number of elements in current page.
-
getCurrentPageOffset
long getCurrentPageOffset()
Returns the offset (starting from 0) of the first element in the current page orUNKNOWN_SIZE.
-
getCurrentPageIndex
long getCurrentPageIndex()
Returns the current page index as a zero-based integer.
-
getCurrentPageStatus
String getCurrentPageStatus()
Returns a simple formatted string for current pagination status.
-
firstPage
void firstPage()
Go to the first page
-
previousPage
void previousPage()
Go to the previous page
-
nextPage
void nextPage()
Go to the next page
-
lastPage
void lastPage()
Go to the last page. Does not do anything if there is only one page displayed, or if the number of results is unknown.
-
getCurrentEntry
T getCurrentEntry()
Returns the current entry.
-
setCurrentEntry
void setCurrentEntry(T entry)
Sets the current entry.
-
setCurrentEntryIndex
void setCurrentEntryIndex(long index)
Sets the current entry index.
-
isNextEntryAvailable
boolean isNextEntryAvailable()
Returns true if there is a next entry.The next entry might be in next page, except if results count is unknown.
-
isPreviousEntryAvailable
boolean isPreviousEntryAvailable()
Returns true if there is a previous entry.The previous entry might be in previous page.
-
previousEntry
void previousEntry()
Move the current entry to the previous one, if applicable.No exception: this method is intended to be plugged directly at the UI layer. In case there's no previous entry, nothing will happen.
-
nextEntry
void nextEntry()
Move the current entry to the next one, if applicable.If needed and possible, the provider will forward to next page. No special exceptions: this method is intended to be plugged directly at the UI layer. In case there's no next entry, nothing happens.
-
isSortable
boolean isSortable()
Returns if this provider is sortable
-
setSortable
void setSortable(boolean sortable)
-
getSortInfos
List<SortInfo> getSortInfos()
Returns the complete list of sorting info for this provider
-
getSortInfo
SortInfo getSortInfo()
Returns the first sorting info for this providerAlso kept for compatibility with existing code.
-
setSortInfos
void setSortInfos(List<SortInfo> sortInfo)
Sets the complete list of sorting info for this provider
-
setSortInfo
void setSortInfo(SortInfo sortInfo)
Sets the first and only sorting info for this provider.Also kept for compatibility with existing code.
-
setSortInfo
void setSortInfo(String sortColumn, boolean sortAscending, boolean removeOtherSortInfos)
Sets the first and only sorting info for this provider if parameter removeOtherSortInfos is true. Otherwise, adds or changes the sortAscending information according to given direction.
-
addSortInfo
void addSortInfo(String sortColumn, boolean sortAscending)
Add the given sort info to the list of sorting infos.
-
getSortInfoIndex
int getSortInfoIndex(String sortColumn, boolean sortAscending)
Returns a positive 0-based integer if given sort information is found on the set sort infos, indicating the sort index, or -1 if this sort information is not found.
-
getSearchDocumentModel
DocumentModel getSearchDocumentModel()
-
setSearchDocumentModel
void setSearchDocumentModel(DocumentModel doc)
-
hasError
boolean hasError()
-
getErrorMessage
String getErrorMessage()
-
getError
Throwable getError()
-
setDefinition
void setDefinition(PageProviderDefinition providerDefinition)
-
getDefinition
PageProviderDefinition getDefinition()
-
setPageProviderChangedListener
void setPageProviderChangedListener(PageProviderChangedListener listener)
Sets thePageProviderChangedListenerfor thisPageProvider.- Since:
- 5.7
-
hasChangedParameters
boolean hasChangedParameters(Object[] parameters)
Test if provider parameters have changed- Since:
- 5.7
-
getAggregateDefinitions
List<AggregateDefinition> getAggregateDefinitions()
- Since:
- 6.0
-
hasAggregateSupport
boolean hasAggregateSupport()
- Since:
- 6.0
-
isSkipAggregates
boolean isSkipAggregates()
- Since:
- 10.2
-
getQuickFilters
List<QuickFilter> getQuickFilters()
- Since:
- 8.4
-
setQuickFilters
void setQuickFilters(List<QuickFilter> quickFilters)
- Since:
- 8.4
-
addQuickFilter
void addQuickFilter(QuickFilter quickFilter)
- Since:
- 8.4
-
getAvailableQuickFilters
List<QuickFilter> getAvailableQuickFilters()
- Since:
- 8.4
-
getResultsCountLimit
long getResultsCountLimit()
Limit of number of results beyond which the page provider may not be able to computegetResultsCount()or navigate.Requesting results beyond this limit may result in error. When
getResultsCount()is negative, it means there may be more results than this limit.0 means there is no limit.
- Since:
- 9.3
-
-