-
Type: Sub-task
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.4
-
Component/s: Web Common
-
Tags:
-
Upgrade notes:
The current result provider interface would need to be updated to:
- handle other kinds of objects than DocumentModel instances
- provide next/prev entry features (instead of just next/prev page features)
- handle selection of elements, so that we do not need to create a
SelectDataModel instance when rendering a given page => provide additional
APIs like "List<SelectDataModelRow<T>> getCurrentPage()" ?
New interface definition:
/**
- Basic interface for a paged provider, independant of type of items in the
- list
- <p>
- Provides APIs to navigate between result pages
* - @author arussel
- @author Anahide Tchertchian
* - @param <T> any Serializable item
*/
public interface PagedListProvider<T extends Serializable> extends
Serializable { /** * Constant to express that the total number of result elements is unknown. */ long UNKNOWN_SIZE = -1; /** * Returns the provider identifier */ String getName(); /** * Sets the provider identifier */ void setName(String name); /** * Returns the number of requested page size. */ long getPageSize(); /** * Returns the number of result elements if available or * <code>UNKNOWN_SIZE</code> if it is unknown */ long getResultsCount(); /** * Returns the total number of pages */ long getNumberOfPages(); /** * Returns the current page of results. * <p> * This method is designed to be called from JSF. It therefore ensures * cheapness of repeated calls, rather than data consistency. There is a * refresh() method for that. * <p> * * @return the current page */ List<T> getCurrentPage(); /** * Sets the current page of results to the required one and return it. * * @param page the page index, starting from 0 */ List<T> getPage(long page); /** * Forces refresh of the current page. */ void refresh(); /** * Returns a boolean expressing if there are further pages. */ boolean isNextPageAvailable(); /** * Returns a boolean expressing if there is a previous page. */ boolean isPreviousPageAvailable(); /** * Returns the number of elements in current page. */ long getCurrentPageSize(); /** * Returns the offset (starting from 0) of the first element in the current * page or <code>UNKNOWN_SIZE</code> */ long getCurrentPageOffset(); /** * Returns the current page index as a zero-based integer. */ long getCurrentPageIndex(); /** * Returns a simple formatted string for current pagination status. */ String getCurrentPageStatus(); /* Easy navigation API */ /** * Go to the first page */ void rewind(); /** * Go to the previous page */ void previous(); /** * Go to the next page */ void next(); /** * Go to the last page */ void last(); // TODO: isNextEntryAvailable, isPreviousEntryAvailable // TODO: first/prev/next/last for current entry in given page /** * Returns if this provider is sortable */ boolean isSortable(); /** * Returns the sorting info for this provider */ List<SortInfo> getSortInfo(); /** * Sets the sorting info for this provider */ void setSortInfo(List<SortInfo> sortInfo); }
The Farm mechanism, although it would need to be simplified, is currently
useful => do not touch it for now, because anyway Studio will make it easy
to define it.
The simplifaction of selection of elements, through Seam remoting, may also
be addressed later.
These changes will be done directly in Nuxeo classes, deprecating old methods using a PagedDocumentsProvider (like QueryModel and some seam components)