public class CoreQueryDocumentPageProvider extends AbstractPageProvider<DocumentModel>
It builds the query at each call so that it can refresh itself when the query changes.
The page provider property named CORE_SESSION_PROPERTY is used to pass the CoreSession instance that
will perform the query. The optional property CHECK_QUERY_CACHE_PROPERTY can be set to "true" to avoid
performing the query again if it did not change.
Since 6.0, the page provider property named USE_UNRESTRICTED_SESSION_PROPERTY allows specifying whether the
query should be run as unrestricted. When such a property is set to "true", the additional property
DETACH_DOCUMENTS_PROPERTY is used to detach documents (defaults to true when session is unrestricted).
| Modifier and Type | Field and Description |
|---|---|
static String |
CHECK_QUERY_CACHE_PROPERTY |
static String |
CORE_SESSION_PROPERTY |
protected List<DocumentModel> |
currentPageDocuments |
static String |
DEFAULT_NAVIGATION_RESULTS_KEY |
static String |
DEFAULT_NAVIGATION_RESULTS_PROPERTY |
static String |
DEFAULT_NAVIGATION_RESULTS_VALUE |
static String |
DETACH_DOCUMENTS_PROPERTY
Boolean property stating that documents should be detached, only useful when property
USE_UNRESTRICTED_SESSION_PROPERTY is set to true. |
static String |
MAX_RESULTS_PROPERTY |
protected Long |
maxResults |
static String |
PAGE_SIZE_RESULTS_KEY |
protected String |
query |
static String |
USE_UNRESTRICTED_SESSION_PROPERTY
Boolean property stating that query should be unrestricted.
|
currentEntryIndex, currentHigherNonEmptyPageIndex, currentSelectPage, definition, error, errorMessage, highlights, maxPageSize, name, offset, PAGEPROVIDER_TRACK_PROPERTY_NAME, pageProviderChangedListener, pageSize, pageSizeOptions, parameters, properties, quickFilters, resultsCount, searchDocumentModel, selectedEntries, SKIPPED_SCHEMAS_FOR_SEARCHFIELD, sortable, sortInfos, trackingDEFAULT_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 and Description |
|---|
CoreQueryDocumentPageProvider() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
buildQuery(CoreSession coreSession) |
protected void |
checkQueryCache() |
protected boolean |
detachDocuments() |
protected CoreSession |
getCoreSession() |
List<DocumentModel> |
getCurrentPage()
Returns the list of current page items.
|
String |
getCurrentQuery() |
PageSelections<DocumentModel> |
getCurrentSelectPage()
Returns the current page of results wrapped in a
PageSelection item. |
protected Filter |
getFilter()
Filter to use when processing results.
|
long |
getMaxResults()
Returns the maximum number of results or
0 |
long |
getPageLimit()
Returns the page limit.
|
long |
getResultsCountLimit()
Limit of number of results beyond which the page provider may not be able to compute
#getResultsCount())
or navigate. |
protected void |
pageChanged()
Page change hook, to override for custom behavior
|
void |
refresh()
Refresh hook, to override for custom behavior
|
protected void |
rewindSelectablePage()
Fetch a page that can be selected.
|
void |
setMaxResults(long maxResults)
Sets the maximum number of result elements.
|
protected boolean |
useUnrestrictedSession() |
addQuickFilter, addSortInfo, fireSearchEvent, firstPage, getAggregateDefinitions, getAggregates, getAvailableQuickFilters, getBooleanProperty, getCurrentEntry, getCurrentHigherNonEmptyPageIndex, getCurrentPageIndex, getCurrentPageOffset, getCurrentPageSize, getCurrentPageStatus, getDefaultMaxPageSize, getDefinition, getError, getErrorMessage, getHighlights, getMaxNumberOfEmptyPages, getMaxPageSize, getMinMaxPageSize, getName, getNumberOfPages, getPageSize, getPageSizeOptions, getParameters, getParametersChanged, getProperties, getQuickFilters, getResultsCount, getSearchDocumentModel, getSortInfo, getSortInfoIndex, getSortInfos, hasAggregateSupport, hasChangedParameters, hasError, incorporateAggregates, isLastPageAvailable, isNextEntryAvailable, isNextPageAvailable, isPreviousEntryAvailable, isPreviousPageAvailable, isSkipAggregates, isSortable, isTrackingEnabled, lastPage, nextEntry, nextPage, notifyPageChanged, notifyRefresh, previousEntry, previousPage, searchDocumentModelChanged, setCurrentEntry, setCurrentEntryIndex, setCurrentHigherNonEmptyPageIndex, setCurrentPage, setCurrentPageIndex, setCurrentPageOffset, setDefinition, setHighlights, setMaxPageSize, setName, setPageProviderChangedListener, setPageSize, setPageSizeOptions, setParameters, setProperties, setQuickFilters, setResultsCount, setSearchDocumentModel, setSelectedEntries, setSortable, setSortInfo, setSortInfo, setSortInfos, sortInfoChangedpublic static final String CORE_SESSION_PROPERTY
public static final String MAX_RESULTS_PROPERTY
public static final String DEFAULT_NAVIGATION_RESULTS_KEY
public static final String PAGE_SIZE_RESULTS_KEY
public static final String DEFAULT_NAVIGATION_RESULTS_PROPERTY
public static final String DEFAULT_NAVIGATION_RESULTS_VALUE
public static final String CHECK_QUERY_CACHE_PROPERTY
public static final String USE_UNRESTRICTED_SESSION_PROPERTY
public static final String DETACH_DOCUMENTS_PROPERTY
USE_UNRESTRICTED_SESSION_PROPERTY is set to true.
When an unrestricted session is used, this property defaults to true.
protected List<DocumentModel> currentPageDocuments
protected Long maxResults
public CoreQueryDocumentPageProvider()
public List<DocumentModel> getCurrentPage()
AbstractPageProvider
Custom implementation can be added here, based on the page provider properties, parameters and
WhereClauseDefinition on the PageProviderDefinition, 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 AbstractPageProvider.pageChanged() and AbstractPageProvider.refresh().
Fields AbstractPageProvider.errorMessage and AbstractPageProvider.error can also be filled to provide accurate feedback in case an error
occurs during the search.
When items are retrieved, a call to AbstractPageProvider.setResultsCount(long) should be made to ensure proper pagination as
implemented in this abstract class. The implementation in CoreQueryAndFetchPageProvider 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
AbstractPageProvider.getCurrentHigherNonEmptyPageIndex() and AbstractPageProvider.setCurrentHigherNonEmptyPageIndex(int). In this case,
CoreQueryDocumentPageProvider is a good example.
getCurrentPage in interface PageProvider<DocumentModel>getCurrentPage in class AbstractPageProvider<DocumentModel>protected void buildQuery(CoreSession coreSession)
protected void checkQueryCache()
protected boolean useUnrestrictedSession()
protected boolean detachDocuments()
protected CoreSession getCoreSession()
public long getMaxResults()
0 if there is no limit.public long getResultsCountLimit()
PageProvider#getResultsCount())
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.
getResultsCountLimit in interface PageProvider<DocumentModel>getResultsCountLimit in class AbstractPageProvider<DocumentModel>public long getPageLimit()
getPageLimit in interface PageProvider<DocumentModel>getPageLimit in class AbstractPageProvider<DocumentModel>public void setMaxResults(long maxResults)
public PageSelections<DocumentModel> getCurrentSelectPage()
PageProviderPageSelection item.
By default, no entry is selected, unless PageProvider.setSelectedEntries(List) has been called before.
getCurrentSelectPage in interface PageProvider<DocumentModel>getCurrentSelectPage in class AbstractPageProvider<DocumentModel>public String getCurrentQuery()
protected void rewindSelectablePage()
protected Filter getFilter()
Defaults to null (no filter applied), method to be overridden by subclasses.
protected void pageChanged()
AbstractPageProvider
When overriding it, call super.pageChanged() as last statement to make sure that the
PageProviderChangedListener is called with the up-to-date @{code PageProvider} state.
pageChanged in class AbstractPageProvider<DocumentModel>public void refresh()
AbstractPageProvider
When overriding it, call super.refresh() as last statement to make sure that the
PageProviderChangedListener is called with the up-to-date @{code PageProvider} state.
refresh in interface PageProvider<DocumentModel>refresh in class AbstractPageProvider<DocumentModel>Copyright © 2018 Nuxeo. All rights reserved.