Package org.silverpeas.core.util
Class Pagination<T>
- java.lang.Object
-
- org.silverpeas.core.util.Pagination<T>
-
public class Pagination<T> extends Object
- Author:
- silveryocha
-
-
Constructor Summary
Constructors Constructor Description Pagination(PaginationPage paginationPage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SilverpeasList<T>
execute()
Execute the process of paginated data querying.Pagination<T>
factor(int factor)
The factor applied on page size on the paginated data source in order to retrieve more data in the aime to get enough for filtering operation.Pagination<T>
filter(UnaryOperator<SilverpeasList<T>> filter)
Applying a filtering operation on data querying from the data source.boolean
isNbMaxDataSourceCallLimitReached()
Indicates if the limit of number of data source call has been reached.Pagination<T>
limitDataSourceCallsTo(int nbMaxDataSourceCalls)
The maximum number of data source calls must be done.Pagination<T>
paginatedDataSource(Function<PaginationPage,SilverpeasList<T>> paginatedDataSource)
Gets data by applying a pagination clause.Pagination<T>
withMinPerPage(int minPerPage)
The minimum of data per page retrieved from a paginated datasource call.
-
-
-
Constructor Detail
-
Pagination
public Pagination(PaginationPage paginationPage)
-
-
Method Detail
-
factor
public Pagination<T> factor(int factor)
The factor applied on page size on the paginated data source in order to retrieve more data in the aime to get enough for filtering operation.- Parameters:
factor
- a positive integer.- Returns:
- the process instance itself.
-
withMinPerPage
public Pagination<T> withMinPerPage(int minPerPage)
The minimum of data per page retrieved from a paginated datasource call.- Parameters:
minPerPage
- a minimum per page.- Returns:
- the process instance itself.
-
limitDataSourceCallsTo
public Pagination<T> limitDataSourceCallsTo(int nbMaxDataSourceCalls)
The maximum number of data source calls must be done.zero or negative value means no limit.
- Parameters:
nbMaxDataSourceCalls
- a maximum data source calls.- Returns:
- the process instance itself.
-
paginatedDataSource
public Pagination<T> paginatedDataSource(Function<PaginationPage,SilverpeasList<T>> paginatedDataSource)
Gets data by applying a pagination clause.- Parameters:
paginatedDataSource
- the directive of data querying with pagination clause.- Returns:
- the process instance itself.
-
filter
public Pagination<T> filter(UnaryOperator<SilverpeasList<T>> filter)
Applying a filtering operation on data querying from the data source.- Parameters:
filter
- the filtering directive.- Returns:
- the process instance itself.
-
execute
public SilverpeasList<T> execute()
Execute the process of paginated data querying.- Returns:
- the result
SilverpeasList
.
-
isNbMaxDataSourceCallLimitReached
public boolean isNbMaxDataSourceCallLimitReached()
Indicates if the limit of number of data source call has been reached.- Returns:
- true if reached, false otherwise.
- See Also:
limitDataSourceCallsTo(int)
-
-