Class AbstractPageProvider<T>
- java.lang.Object
-
- org.nuxeo.ecm.platform.query.api.AbstractPageProvider<T>
-
- All Implemented Interfaces:
Serializable
,PageProvider<T>
- Direct Known Subclasses:
AbstractGroupMemberPageProvider
,AbstractGroupsPageProvider
,AbstractUsersPageProvider
,AuditPageProvider
,CoreQueryAndFetchPageProvider
,CoreQueryDocumentPageProvider
,DirectoryEntryPageProvider
,DocumentModelListPageProvider
,ElasticSearchNativePageProvider
,EmptyPageProvider
,ESAuditPageProvider
,LatestCreatedUsersOrGroupsPageProvider
,MongoDBAuditPageProvider
,RoutingTaskPageProvider
,UserTaskPageProvider
,VFolderPageProvider
public abstract class AbstractPageProvider<T> extends Object implements PageProvider<T>
Basic implementation for aPageProvider
.Provides next/prev standard logics, and helper methods for retrieval of items and first/next/prev/last buttons display as well as other display information (number of pages for instance).
Also handles selection by providing a default implementation of
getCurrentSelectPage()
working in conjunction withsetSelectedEntries(List)
.- Author:
- Anahide Tchertchian
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
currentEntryIndex
protected int
currentHigherNonEmptyPageIndex
Integer keeping track of the higher page index giving results.protected PageSelections<T>
currentSelectPage
protected PageProviderDefinition
definition
protected Throwable
error
protected String
errorMessage
protected List<String>
highlights
static Log
log
protected long
maxPageSize
protected String
name
protected long
offset
static String
PAGEPROVIDER_TRACK_PROPERTY_NAME
property used to enable globally tracking : property should contains the list of pageproviders to be trackedprotected PageProviderChangedListener
pageProviderChangedListener
protected long
pageSize
protected List<Long>
pageSizeOptions
protected Object[]
parameters
protected Map<String,Serializable>
properties
protected List<QuickFilter>
quickFilters
protected long
resultsCount
protected DocumentModel
searchDocumentModel
protected List<T>
selectedEntries
protected static List<String>
SKIPPED_SCHEMAS_FOR_SEARCHFIELD
lists schemas prefixes that should be skipped when extracting "search fields" (tracking) from searchDocumentModelprotected boolean
sortable
protected List<SortInfo>
sortInfos
protected Boolean
tracking
-
Fields inherited from interface org.nuxeo.ecm.platform.query.api.PageProvider
DEFAULT_MAX_PAGE_SIZE, DEFAULT_MAX_PAGE_SIZE_RUNTIME_PROP, HIGHLIGHT_CTX_DATA, PAGE_LIMIT_UNKNOWN, SKIP_AGGREGATES_PROP, UNKNOWN_SIZE, UNKNOWN_SIZE_AFTER_QUERY
-
-
Constructor Summary
Constructors Constructor Description AbstractPageProvider()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addQuickFilter(QuickFilter quickFilter)
void
addSortInfo(String sortColumn, boolean sortAscending)
Add the given sort info to the list of sorting infos.protected void
fireSearchEvent(NuxeoPrincipal principal, String query, List<T> entries, Long executionTimeMs)
Send a search event so that PageProvider calls can be tracked by Audit or other statistic gathering processvoid
firstPage()
Go to the first pageList<AggregateDefinition>
getAggregateDefinitions()
Map<String,Aggregate<? extends Bucket>>
getAggregates()
List<QuickFilter>
getAvailableQuickFilters()
protected boolean
getBooleanProperty(String propName, boolean defaultValue)
T
getCurrentEntry()
Returns the current entry.int
getCurrentHigherNonEmptyPageIndex()
Returns an integer keeping track of the higher page index giving results.abstract List<T>
getCurrentPage()
Returns the list of current page items.long
getCurrentPageIndex()
Returns the current page index as a zero-based integer.long
getCurrentPageOffset()
Returns the offset (starting from 0) of the first element in the current page orUNKNOWN_SIZE
.long
getCurrentPageSize()
Returns the number of elements in current page.String
getCurrentPageStatus()
Returns a simple formatted string for current pagination status.PageSelections<T>
getCurrentSelectPage()
Returns the current page of results wrapped in aPageSelection
item.protected long
getDefaultMaxPageSize()
PageProviderDefinition
getDefinition()
Throwable
getError()
String
getErrorMessage()
List<String>
getHighlights()
int
getMaxNumberOfEmptyPages()
Returns the maximum number of empty pages that can be fetched empty (defaults to 1).long
getMaxPageSize()
Returns the max number of results per page.long
getMinMaxPageSize()
Returns the minimal value for the max page size, taking the lower value between the requested page size and the maximum accepted page size.String
getName()
Returns the provider identifierlong
getNumberOfPages()
Returns the total number of pages or 0 if number of pages is unknown.long
getPageLimit()
Returns the page limit.long
getPageSize()
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()
protected boolean
getParametersChanged(Object[] oldParams, Object[] newParams)
Map<String,Serializable>
getProperties()
Gets properties set on the provider.List<QuickFilter>
getQuickFilters()
long
getResultsCount()
Returns the number of result elements if available or a negative value if it is unknown:UNKNOWN_SIZE
if it is unknown as query was not done, and since 5.5,UNKNOWN_SIZE_AFTER_QUERY
if it is still unknown after query was done.long
getResultsCountLimit()
Limit of number of results beyond which the page provider may not be able to computePageProvider.getResultsCount()
or navigate.DocumentModel
getSearchDocumentModel()
SortInfo
getSortInfo()
Returns the first sorting info for this providerint
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.List<SortInfo>
getSortInfos()
Returns the complete list of sorting info for this providerboolean
hasAggregateSupport()
boolean
hasChangedParameters(Object[] parameters)
Test if provider parameters have changedboolean
hasError()
protected void
incorporateAggregates(Map<String,Serializable> eventProps)
Default (dummy) implementation that should be overridden by PageProvider actually dealing with Aggregatesboolean
isLastPageAvailable()
Returns a boolean expressing if the last page can be displayed.boolean
isNextEntryAvailable()
Returns true if there is a next entry.boolean
isNextPageAvailable()
Returns a boolean expressing if there are further pages.boolean
isPreviousEntryAvailable()
Returns true if there is a previous entry.boolean
isPreviousPageAvailable()
Returns a boolean expressing if there is a previous page.boolean
isSkipAggregates()
boolean
isSortable()
Returns if this provider is sortableprotected boolean
isTrackingEnabled()
void
lastPage()
Go to the last page.void
nextEntry()
Move the current entry to the next one, if applicable.void
nextPage()
Go to the next pageprotected void
notifyPageChanged()
Call the registeredPageProviderChangedListener
, if any, to notify that the page provider current page has changed.protected void
notifyRefresh()
Call the registeredPageProviderChangedListener
, if any, to notify that the page provider has refreshed.protected void
pageChanged()
Page change hook, to override for custom behaviorvoid
previousEntry()
Move the current entry to the previous one, if applicable.void
previousPage()
Go to the previous pagevoid
refresh()
Refresh hook, to override for custom behaviorprotected boolean
searchDocumentModelChanged(DocumentModel oldDoc, DocumentModel newDoc)
void
setCurrentEntry(T entry)
Sets the current entry.void
setCurrentEntryIndex(long index)
Sets the current entry index.void
setCurrentHigherNonEmptyPageIndex(int higherFilledPageIndex)
List<T>
setCurrentPage(long page)
Sets the current page of results to the required one and return it.void
setCurrentPageIndex(long currentPageIndex)
Sets the current page of results to the required one.void
setCurrentPageOffset(long offset)
Sets the current page offset.void
setDefinition(PageProviderDefinition providerDefinition)
void
setHighlights(List<String> highlights)
void
setMaxPageSize(long maxPageSize)
Sets the max number of results per page.void
setName(String name)
Sets the provider identifiervoid
setPageProviderChangedListener(PageProviderChangedListener listener)
Sets thePageProviderChangedListener
for thisPageProvider
.void
setPageSize(long pageSize)
Sets the number of results per page.void
setPageSizeOptions(List<Long> options)
Sets the page size options.void
setParameters(Object[] parameters)
void
setProperties(Map<String,Serializable> properties)
Sets properties set on the provider.void
setQuickFilters(List<QuickFilter> quickFilters)
void
setResultsCount(long resultsCount)
Sets the results count.void
setSearchDocumentModel(DocumentModel searchDocumentModel)
void
setSelectedEntries(List<T> entries)
Sets the list of selected entries to take into account inPageProvider.getCurrentSelectPage()
.void
setSortable(boolean sortable)
void
setSortInfo(String sortColumn, boolean sortAscending, boolean removeOtherSortInfos)
Sets the first and only sorting info for this provider if parameter removeOtherSortInfos is true.void
setSortInfo(SortInfo sortInfo)
Sets the first and only sorting info for this provider.void
setSortInfos(List<SortInfo> sortInfo)
Sets the complete list of sorting info for this providerprotected boolean
sortInfoChanged(List<SortInfo> oldSortInfos, List<SortInfo> newSortInfos)
-
-
-
Field Detail
-
log
public static final Log log
-
PAGEPROVIDER_TRACK_PROPERTY_NAME
public static final String PAGEPROVIDER_TRACK_PROPERTY_NAME
property used to enable globally tracking : property should contains the list of pageproviders to be tracked- Since:
- 7.4
- See Also:
- Constant Field Values
-
SKIPPED_SCHEMAS_FOR_SEARCHFIELD
protected static final List<String> SKIPPED_SCHEMAS_FOR_SEARCHFIELD
lists schemas prefixes that should be skipped when extracting "search fields" (tracking) from searchDocumentModel- Since:
- 7.4
-
name
protected String name
-
offset
protected long offset
-
pageSize
protected long pageSize
-
maxPageSize
protected long maxPageSize
-
resultsCount
protected long resultsCount
-
currentEntryIndex
protected int currentEntryIndex
-
currentHigherNonEmptyPageIndex
protected int currentHigherNonEmptyPageIndex
Integer keeping track of the higher page index giving results. Useful for enabling or disabling the nextPage action when number of results cannot be known.- Since:
- 5.5
-
sortable
protected boolean sortable
-
currentSelectPage
protected PageSelections<T> currentSelectPage
-
properties
protected Map<String,Serializable> properties
-
parameters
protected Object[] parameters
-
searchDocumentModel
protected DocumentModel searchDocumentModel
-
quickFilters
protected List<QuickFilter> quickFilters
- Since:
- 8.4
-
errorMessage
protected String errorMessage
-
error
protected Throwable error
-
definition
protected PageProviderDefinition definition
-
pageProviderChangedListener
protected PageProviderChangedListener pageProviderChangedListener
-
tracking
protected Boolean tracking
-
-
Method Detail
-
getCurrentPage
public abstract List<T> getCurrentPage()
Returns the list of current page items.Custom implementation can be added here, based on the page provider properties, parameters and
WhereClauseDefinition
on thePageProviderDefinition
, as well as search document, sort information, etc...Implementation of this method usually consists in setting a non-null value to a field caching current items, and nullifying this field by overriding
pageChanged()
andrefresh()
.Fields
errorMessage
anderror
can also be filled to provide accurate feedback in case an error occurs during the search.When items are retrieved, a call to
setResultsCount(long)
should be made to ensure proper pagination as implemented in this abstract class. The implementation inCoreQueryAndFetchPageProvider
is a good example when the total results count is known.If for performance reasons, for instance, the number of results cannot be known, a fall-back strategy can be applied to provide the "next" button but not the "last" one, by calling
getCurrentHigherNonEmptyPageIndex()
andsetCurrentHigherNonEmptyPageIndex(int)
. In this case,CoreQueryDocumentPageProvider
is a good example.- Specified by:
getCurrentPage
in interfacePageProvider<T>
- Returns:
- the current page
-
pageChanged
protected void pageChanged()
Page change hook, to override for custom behaviorWhen overriding it, call
super.pageChanged()
as last statement to make sure that thePageProviderChangedListener
is called with the up-to-date @{code PageProvider} state.
-
firstPage
public void firstPage()
Description copied from interface:PageProvider
Go to the first page- Specified by:
firstPage
in interfacePageProvider<T>
-
getCurrentPageIndex
public long getCurrentPageIndex()
Description copied from interface:PageProvider
Returns the current page index as a zero-based integer.- Specified by:
getCurrentPageIndex
in interfacePageProvider<T>
-
getCurrentPageOffset
public long getCurrentPageOffset()
Description copied from interface:PageProvider
Returns the offset (starting from 0) of the first element in the current page orUNKNOWN_SIZE
.- Specified by:
getCurrentPageOffset
in interfacePageProvider<T>
-
setCurrentPageOffset
public void setCurrentPageOffset(long offset)
Description copied from interface:PageProvider
Sets the current page offset.If the provider keeps information linked to the current page, they should be reset after calling this method.
- Specified by:
setCurrentPageOffset
in interfacePageProvider<T>
-
getCurrentPageSize
public long getCurrentPageSize()
Description copied from interface:PageProvider
Returns the number of elements in current page.- Specified by:
getCurrentPageSize
in interfacePageProvider<T>
-
getName
public String getName()
Description copied from interface:PageProvider
Returns the provider identifier- Specified by:
getName
in interfacePageProvider<T>
-
getNumberOfPages
public long getNumberOfPages()
Description copied from interface:PageProvider
Returns the total number of pages or 0 if number of pages is unknown.- Specified by:
getNumberOfPages
in interfacePageProvider<T>
-
setCurrentPageIndex
public void setCurrentPageIndex(long currentPageIndex)
Description copied from interface:PageProvider
Sets the current page of results to the required one.- Specified by:
setCurrentPageIndex
in interfacePageProvider<T>
- Parameters:
currentPageIndex
- the page index, starting from 0
-
setCurrentPage
public List<T> setCurrentPage(long page)
Description copied from interface:PageProvider
Sets the current page of results to the required one and return it.- Specified by:
setCurrentPage
in interfacePageProvider<T>
- Parameters:
page
- the page index, starting from 0
-
getPageSize
public long getPageSize()
Description copied from interface:PageProvider
Returns the number of results per page. 0 means no pagination unlessPageProvider.getMaxPageSize()
is greater than this value, it will be taken into account instead.- Specified by:
getPageSize
in interfacePageProvider<T>
-
setPageSize
public void setPageSize(long pageSize)
Description copied from interface:PageProvider
Sets the number of results per page. 0 means no pagination unlessPageProvider.getMaxPageSize()
is greater than this value, it will be taken into account instead.- Specified by:
setPageSize
in interfacePageProvider<T>
-
getPageSizeOptions
public List<Long> getPageSizeOptions()
Description copied from interface:PageProvider
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.
- Specified by:
getPageSizeOptions
in interfacePageProvider<T>
-
setPageSizeOptions
public void setPageSizeOptions(List<Long> options)
Description copied from interface:PageProvider
Sets the page size options.- Specified by:
setPageSizeOptions
in interfacePageProvider<T>
-
getSortInfos
public List<SortInfo> getSortInfos()
Description copied from interface:PageProvider
Returns the complete list of sorting info for this provider- Specified by:
getSortInfos
in interfacePageProvider<T>
-
getSortInfo
public SortInfo getSortInfo()
Description copied from interface:PageProvider
Returns the first sorting info for this providerAlso kept for compatibility with existing code.
- Specified by:
getSortInfo
in interfacePageProvider<T>
-
sortInfoChanged
protected boolean sortInfoChanged(List<SortInfo> oldSortInfos, List<SortInfo> newSortInfos)
-
setQuickFilters
public void setQuickFilters(List<QuickFilter> quickFilters)
- Specified by:
setQuickFilters
in interfacePageProvider<T>
-
getQuickFilters
public List<QuickFilter> getQuickFilters()
- Specified by:
getQuickFilters
in interfacePageProvider<T>
-
getAvailableQuickFilters
public List<QuickFilter> getAvailableQuickFilters()
- Specified by:
getAvailableQuickFilters
in interfacePageProvider<T>
-
addQuickFilter
public void addQuickFilter(QuickFilter quickFilter)
- Specified by:
addQuickFilter
in interfacePageProvider<T>
-
setSortInfos
public void setSortInfos(List<SortInfo> sortInfo)
Description copied from interface:PageProvider
Sets the complete list of sorting info for this provider- Specified by:
setSortInfos
in interfacePageProvider<T>
-
setSortInfo
public void setSortInfo(SortInfo sortInfo)
Description copied from interface:PageProvider
Sets the first and only sorting info for this provider.Also kept for compatibility with existing code.
- Specified by:
setSortInfo
in interfacePageProvider<T>
-
setSortInfo
public void setSortInfo(String sortColumn, boolean sortAscending, boolean removeOtherSortInfos)
Description copied from interface:PageProvider
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.- Specified by:
setSortInfo
in interfacePageProvider<T>
-
addSortInfo
public void addSortInfo(String sortColumn, boolean sortAscending)
Description copied from interface:PageProvider
Add the given sort info to the list of sorting infos.- Specified by:
addSortInfo
in interfacePageProvider<T>
-
getSortInfoIndex
public int getSortInfoIndex(String sortColumn, boolean sortAscending)
Description copied from interface:PageProvider
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.- Specified by:
getSortInfoIndex
in interfacePageProvider<T>
-
getHighlights
public List<String> getHighlights()
- Specified by:
getHighlights
in interfacePageProvider<T>
-
setHighlights
public void setHighlights(List<String> highlights)
- Specified by:
setHighlights
in interfacePageProvider<T>
-
isNextPageAvailable
public boolean isNextPageAvailable()
Description copied from interface:PageProvider
Returns a boolean expressing if there are further pages.- Specified by:
isNextPageAvailable
in interfacePageProvider<T>
-
isLastPageAvailable
public boolean isLastPageAvailable()
Description copied from interface:PageProvider
Returns a boolean expressing if the last page can be displayed.- Specified by:
isLastPageAvailable
in interfacePageProvider<T>
-
isPreviousPageAvailable
public boolean isPreviousPageAvailable()
Description copied from interface:PageProvider
Returns a boolean expressing if there is a previous page.- Specified by:
isPreviousPageAvailable
in interfacePageProvider<T>
-
lastPage
public void lastPage()
Description copied from interface:PageProvider
Go to the last page. Does not do anything if there is only one page displayed, or if the number of results is unknown.- Specified by:
lastPage
in interfacePageProvider<T>
-
nextPage
public void nextPage()
Description copied from interface:PageProvider
Go to the next page- Specified by:
nextPage
in interfacePageProvider<T>
-
previousPage
public void previousPage()
Description copied from interface:PageProvider
Go to the previous page- Specified by:
previousPage
in interfacePageProvider<T>
-
refresh
public void refresh()
Refresh hook, to override for custom behaviorWhen overriding it, call
super.refresh()
as last statement to make sure that thePageProviderChangedListener
is called with the up-to-date @{code PageProvider} state.- Specified by:
refresh
in interfacePageProvider<T>
-
setName
public void setName(String name)
Description copied from interface:PageProvider
Sets the provider identifier- Specified by:
setName
in interfacePageProvider<T>
-
getCurrentPageStatus
public String getCurrentPageStatus()
Description copied from interface:PageProvider
Returns a simple formatted string for current pagination status.- Specified by:
getCurrentPageStatus
in interfacePageProvider<T>
-
isNextEntryAvailable
public boolean isNextEntryAvailable()
Description copied from interface:PageProvider
Returns true if there is a next entry.The next entry might be in next page, except if results count is unknown.
- Specified by:
isNextEntryAvailable
in interfacePageProvider<T>
-
isPreviousEntryAvailable
public boolean isPreviousEntryAvailable()
Description copied from interface:PageProvider
Returns true if there is a previous entry.The previous entry might be in previous page.
- Specified by:
isPreviousEntryAvailable
in interfacePageProvider<T>
-
nextEntry
public void nextEntry()
Description copied from interface:PageProvider
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.
- Specified by:
nextEntry
in interfacePageProvider<T>
-
previousEntry
public void previousEntry()
Description copied from interface:PageProvider
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.
- Specified by:
previousEntry
in interfacePageProvider<T>
-
getCurrentEntry
public T getCurrentEntry()
Description copied from interface:PageProvider
Returns the current entry.- Specified by:
getCurrentEntry
in interfacePageProvider<T>
-
setCurrentEntry
public void setCurrentEntry(T entry)
Description copied from interface:PageProvider
Sets the current entry.- Specified by:
setCurrentEntry
in interfacePageProvider<T>
-
setCurrentEntryIndex
public void setCurrentEntryIndex(long index)
Description copied from interface:PageProvider
Sets the current entry index.- Specified by:
setCurrentEntryIndex
in interfacePageProvider<T>
-
getResultsCount
public long getResultsCount()
Description copied from interface:PageProvider
Returns the number of result elements if available or a negative value if it is unknown:UNKNOWN_SIZE
if it is unknown as query was not done, and since 5.5,UNKNOWN_SIZE_AFTER_QUERY
if it is still unknown after query was done.- Specified by:
getResultsCount
in interfacePageProvider<T>
-
getProperties
public Map<String,Serializable> getProperties()
Description copied from interface:PageProvider
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.
- Specified by:
getProperties
in interfacePageProvider<T>
-
setProperties
public void setProperties(Map<String,Serializable> properties)
Description copied from interface:PageProvider
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.
- Specified by:
setProperties
in interfacePageProvider<T>
-
getBooleanProperty
protected boolean getBooleanProperty(String propName, boolean defaultValue)
- Since:
- 6.0
-
setResultsCount
public void setResultsCount(long resultsCount)
Description copied from interface:PageProvider
Sets the results count.- Specified by:
setResultsCount
in interfacePageProvider<T>
-
setSortable
public void setSortable(boolean sortable)
- Specified by:
setSortable
in interfacePageProvider<T>
-
isSortable
public boolean isSortable()
Description copied from interface:PageProvider
Returns if this provider is sortable- Specified by:
isSortable
in interfacePageProvider<T>
-
getCurrentSelectPage
public PageSelections<T> getCurrentSelectPage()
Description copied from interface:PageProvider
Returns the current page of results wrapped in aPageSelection
item.By default, no entry is selected, unless
PageProvider.setSelectedEntries(List)
has been called before.- Specified by:
getCurrentSelectPage
in interfacePageProvider<T>
-
setSelectedEntries
public void setSelectedEntries(List<T> entries)
Description copied from interface:PageProvider
Sets the list of selected entries to take into account inPageProvider.getCurrentSelectPage()
.- Specified by:
setSelectedEntries
in interfacePageProvider<T>
-
getParameters
public Object[] getParameters()
- Specified by:
getParameters
in interfacePageProvider<T>
-
setParameters
public void setParameters(Object[] parameters)
- Specified by:
setParameters
in interfacePageProvider<T>
-
getSearchDocumentModel
public DocumentModel getSearchDocumentModel()
- Specified by:
getSearchDocumentModel
in interfacePageProvider<T>
-
searchDocumentModelChanged
protected boolean searchDocumentModelChanged(DocumentModel oldDoc, DocumentModel newDoc)
-
setSearchDocumentModel
public void setSearchDocumentModel(DocumentModel searchDocumentModel)
- Specified by:
setSearchDocumentModel
in interfacePageProvider<T>
-
getErrorMessage
public String getErrorMessage()
- Specified by:
getErrorMessage
in interfacePageProvider<T>
-
getError
public Throwable getError()
- Specified by:
getError
in interfacePageProvider<T>
-
hasError
public boolean hasError()
- Specified by:
hasError
in interfacePageProvider<T>
-
getDefinition
public PageProviderDefinition getDefinition()
- Specified by:
getDefinition
in interfacePageProvider<T>
-
setDefinition
public void setDefinition(PageProviderDefinition providerDefinition)
- Specified by:
setDefinition
in interfacePageProvider<T>
-
getMaxPageSize
public long getMaxPageSize()
Description copied from interface:PageProvider
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.
- Specified by:
getMaxPageSize
in interfacePageProvider<T>
-
setMaxPageSize
public void setMaxPageSize(long maxPageSize)
Description copied from interface:PageProvider
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.
- Specified by:
setMaxPageSize
in interfacePageProvider<T>
-
getMinMaxPageSize
public long getMinMaxPageSize()
Returns the minimal value for the max page size, taking the lower value between the requested page size and the maximum accepted page size.- Since:
- 5.4.2
-
getCurrentHigherNonEmptyPageIndex
public int getCurrentHigherNonEmptyPageIndex()
Returns an integer keeping track of the higher page index giving results. Useful for enabling or disabling the nextPage action when number of results cannot be known.- Since:
- 5.5
-
getPageLimit
public long getPageLimit()
Returns the page limit. The n first page we know they exist.- Specified by:
getPageLimit
in interfacePageProvider<T>
- Since:
- 5.8
-
setCurrentHigherNonEmptyPageIndex
public void setCurrentHigherNonEmptyPageIndex(int higherFilledPageIndex)
-
getMaxNumberOfEmptyPages
public int getMaxNumberOfEmptyPages()
Returns the maximum number of empty pages that can be fetched empty (defaults to 1). Can be useful for displaying pages of a provider without results count.- Since:
- 5.5
-
getDefaultMaxPageSize
protected long getDefaultMaxPageSize()
-
setPageProviderChangedListener
public void setPageProviderChangedListener(PageProviderChangedListener listener)
Description copied from interface:PageProvider
Sets thePageProviderChangedListener
for thisPageProvider
.- Specified by:
setPageProviderChangedListener
in interfacePageProvider<T>
-
notifyPageChanged
protected void notifyPageChanged()
Call the registeredPageProviderChangedListener
, if any, to notify that the page provider current page has changed.- Since:
- 5.7
-
notifyRefresh
protected void notifyRefresh()
Call the registeredPageProviderChangedListener
, if any, to notify that the page provider has refreshed.- Since:
- 5.7
-
hasChangedParameters
public boolean hasChangedParameters(Object[] parameters)
Description copied from interface:PageProvider
Test if provider parameters have changed- Specified by:
hasChangedParameters
in interfacePageProvider<T>
-
getParametersChanged
protected boolean getParametersChanged(Object[] oldParams, Object[] newParams)
-
getAggregateDefinitions
public List<AggregateDefinition> getAggregateDefinitions()
- Specified by:
getAggregateDefinitions
in interfacePageProvider<T>
-
getAggregates
public Map<String,Aggregate<? extends Bucket>> getAggregates()
- Specified by:
getAggregates
in interfacePageProvider<T>
-
hasAggregateSupport
public boolean hasAggregateSupport()
- Specified by:
hasAggregateSupport
in interfacePageProvider<T>
-
isTrackingEnabled
protected boolean isTrackingEnabled()
- Since:
- 7.4
-
fireSearchEvent
protected void fireSearchEvent(NuxeoPrincipal principal, String query, List<T> entries, Long executionTimeMs)
Send a search event so that PageProvider calls can be tracked by Audit or other statistic gathering process- Since:
- 7.4
-
incorporateAggregates
protected void incorporateAggregates(Map<String,Serializable> eventProps)
Default (dummy) implementation that should be overridden by PageProvider actually dealing with Aggregates- Since:
- 7.4
-
getResultsCountLimit
public long getResultsCountLimit()
Description copied from interface:PageProvider
Limit of number of results beyond which the page provider may not be able to computePageProvider.getResultsCount()
or navigate.Requesting results beyond this limit may result in error. When
PageProvider.getResultsCount()
is negative, it means there may be more results than this limit.0 means there is no limit.
- Specified by:
getResultsCountLimit
in interfacePageProvider<T>
-
isSkipAggregates
public boolean isSkipAggregates()
- Specified by:
isSkipAggregates
in interfacePageProvider<T>
-
-