Nuxeo Enterprise Platform 5.4

org.nuxeo.ecm.platform.query.api
Interface PageProvider<T>

Type Parameters:
T - any Serializable item
All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
AbstractPageProvider, CoreQueryAndFetchPageProvider, CoreQueryDocumentPageProvider, EmptyPageProvider

public interface PageProvider<T>
extends java.io.Serializable

Basic interface for a page provider, independent of type of items in the list

Provides APIs to navigate between result pages

Since:
5.4
Author:
arussel, Anahide Tchertchian

Field Summary
static long UNKNOWN_SIZE
          Constant to express that the total number of result elements is unknown.
 
Method Summary
 void addSortInfo(java.lang.String sortColumn, boolean sortAscending)
          Add the given sort info to the list of sorting infos.
 void firstPage()
          Go to the first page
 T getCurrentEntry()
          Returns the current entry.
 java.util.List<T> getCurrentPage()
          Returns the current page of results.
 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 or UNKNOWN_SIZE.
 long getCurrentPageSize()
          Returns the number of elements in current page.
 java.lang.String getCurrentPageStatus()
          Returns a simple formatted string for current pagination status.
 PageSelections<T> getCurrentSelectPage()
          Returns the current page of results wrapped in a PageSelection item.
 PageProviderDefinition getDefinition()
           
 java.lang.Throwable getError()
           
 java.lang.String getErrorMessage()
           
 java.lang.String getName()
          Returns the provider identifier
 long getNumberOfPages()
          Returns the total number of pages
 long getPageSize()
          Returns the number of results per page. 0 means no pagination.
 java.lang.Object[] getParameters()
           
 java.util.Map<java.lang.String,java.io.Serializable> getProperties()
          Gets properties set on the provider.
 long getResultsCount()
          Returns the number of result elements if available or UNKNOWN_SIZE if it is unknown.
 DocumentModel getSearchDocumentModel()
           
 SortInfo getSortInfo()
          Returns the first sorting info for this provider Also kept for compatibility with existing code.
 int getSortInfoIndex(java.lang.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.
 java.util.List<SortInfo> getSortInfos()
          Returns the complete list of sorting info for this provider
 boolean hasError()
           
 boolean isNextEntryAvailable()
          Tells if there is a next entry.
 boolean isNextPageAvailable()
          Returns a boolean expressing if there are further pages.
 boolean isPreviousEntryAvailable()
          Tells if there is a previous entry.
 boolean isPreviousPageAvailable()
          Returns a boolean expressing if there is a previous page.
 boolean isSortable()
          Returns if this provider is sortable
 void lastPage()
          Go to the last page
 void nextEntry()
          Move the current entry to the next one, if applicable If needed and possible, the provider will forward to next page.
 void nextPage()
          Go to the next page
 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.
 void previousPage()
          Go to the previous page
 void refresh()
          Forces refresh of the current page.
 void setCurrentEntry(T entry)
          Sets the current entry.
 void setCurrentEntryIndex(long index)
          Sets the current entry index.
 java.util.List<T> setCurrentPage(long page)
          Sets the current page of results to the required one and return it.
 void setDefinition(PageProviderDefinition providerDefinition)
           
 void setName(java.lang.String name)
          Sets the provider identifier
 void setPageSize(long pageSize)
          Sets the number results per page. 0 means no pagination.
 void setParameters(java.lang.Object[] parameters)
           
 void setProperties(java.util.Map<java.lang.String,java.io.Serializable> properties)
          Sets properties set on the provider.
 void setResultsCount(long resultsCount)
           
 void setSearchDocumentModel(DocumentModel doc)
           
 void setSelectedEntries(java.util.List<T> entries)
          Sets the list of selected entries to take into account in getCurrentSelectPage().
 void setSortable(boolean sortable)
           
 void setSortInfo(SortInfo sortInfo)
          Sets the first and only sorting info for this provider.
 void setSortInfo(java.lang.String sortColumn, boolean sortAscending, boolean removeOtherSortInfos)
          Sets the first and only sorting info for this provider if parameter removeOtherSortInfos is true.
 void setSortInfos(java.util.List<SortInfo> sortInfo)
          Sets the complete list of sorting info for this provider
 

Field Detail

UNKNOWN_SIZE

static final long UNKNOWN_SIZE
Constant to express that the total number of result elements is unknown.

See Also:
Constant Field Values
Method Detail

getName

java.lang.String getName()
Returns the provider identifier


setName

void setName(java.lang.String name)
Sets the provider identifier


getProperties

java.util.Map<java.lang.String,java.io.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(java.util.Map<java.lang.String,java.io.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

java.lang.Object[] getParameters()

setParameters

void setParameters(java.lang.Object[] parameters)

getPageSize

long getPageSize()
Returns the number of results per page. 0 means no pagination.


setPageSize

void setPageSize(long pageSize)
Sets the number results per page. 0 means no pagination.


getResultsCount

long getResultsCount()
Returns the number of result elements if available or UNKNOWN_SIZE if it is unknown.


setResultsCount

void setResultsCount(long resultsCount)

getNumberOfPages

long getNumberOfPages()
Returns the total number of pages


getCurrentPage

java.util.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 a PageSelection item.

By default, no entry is selected, unless setSelectedEntries(List) has been called before.


setSelectedEntries

void setSelectedEntries(java.util.List<T> entries)
Sets the list of selected entries to take into account in getCurrentSelectPage().


setCurrentPage

java.util.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.


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 or UNKNOWN_SIZE.


getCurrentPageIndex

long getCurrentPageIndex()
Returns the current page index as a zero-based integer.


getCurrentPageStatus

java.lang.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


getCurrentEntry

T getCurrentEntry()
Returns the current entry.


setCurrentEntry

void setCurrentEntry(T entry)
                     throws ClientException
Sets the current entry.

Throws:
ClientException - if entry is not found within current page.

setCurrentEntryIndex

void setCurrentEntryIndex(long index)
                          throws ClientException
Sets the current entry index.

Throws:
ClientException - if index is not found within current page.

isNextEntryAvailable

boolean isNextEntryAvailable()
Tells if there is a next entry.

The next entry might be in next page. If no current entry is set, this returns false.


isPreviousEntryAvailable

boolean isPreviousEntryAvailable()
Tells if there is a previous entry.

The next entry might be in next page. If no current entry is set, this returns false.


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

java.util.List<SortInfo> getSortInfos()
Returns the complete list of sorting info for this provider


getSortInfo

SortInfo getSortInfo()
Returns the first sorting info for this provider

Also kept for compatibility with existing code.


setSortInfos

void setSortInfos(java.util.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(java.lang.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(java.lang.String sortColumn,
                 boolean sortAscending)
Add the given sort info to the list of sorting infos.


getSortInfoIndex

int getSortInfoIndex(java.lang.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

java.lang.String getErrorMessage()

getError

java.lang.Throwable getError()

setDefinition

void setDefinition(PageProviderDefinition providerDefinition)

getDefinition

PageProviderDefinition getDefinition()

Nuxeo Enterprise Platform 5.4

Copyright © 2010 Nuxeo SAS. All Rights Reserved.