Class PageRequest
- java.lang.Object
-
- de.digitalcollections.model.list.ListRequest
-
- de.digitalcollections.model.list.paging.PageRequest
-
- All Implemented Interfaces:
Serializable
public class PageRequest extends ListRequest
Container for paging, sorting, filtering and searching params:- pageNumber: which page to be returned
- pageSize: how many items on one page
- sorting: container for sorting order of result list
- filtering: container for filter criterias of result list
- searchTerm: searchTerm term for simple query term to be searched for
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
PageRequest.Builder
-
Field Summary
-
Fields inherited from class de.digitalcollections.model.list.ListRequest
filtering, searchTerm, sorting
-
-
Constructor Summary
Constructors Constructor Description PageRequest()
PageRequest(int pageNumber, int pageSize)
Creates a newPageRequest
.PageRequest(int pageNumber, int pageSize, Direction direction, String... properties)
Creates a newPageRequest
with sorting parameters applied.PageRequest(int pageNumber, int pageSize, Sorting sorting)
PageRequest(int pageNumber, int pageSize, Sorting sorting, Filtering filtering)
PageRequest(int pageNumber, int pageSize, Sorting sorting, Filtering filtering, String searchTerm)
Creates a newPageRequest
with sorting parameters applied.PageRequest(String searchTerm, int pageNumber, int pageSize)
PageRequest(String searchTerm, int pageNumber, int pageSize, Sorting sorting)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static PageRequest.Builder
builder()
boolean
equals(Object obj)
PageRequest
first()
int
getOffset()
int
getPageNumber()
int
getPageSize()
int
hashCode()
boolean
hasPrevious()
Returns whether there's a previousPageRequest
we can access from the current one.protected void
init()
PageRequest
next()
PageRequest
previous()
Returns thePageResponse
requesting the previous page.PageRequest
previousOrFirst()
void
setPageNumber(int pageNumber)
void
setPageSize(int pageSize)
String
toString()
-
Methods inherited from class de.digitalcollections.model.list.ListRequest
add, add, getFiltering, getSearchTerm, getSorting, hasFiltering, hasSorting, setFiltering, setSearchTerm, setSorting
-
-
-
-
Constructor Detail
-
PageRequest
public PageRequest()
-
PageRequest
public PageRequest(int pageNumber, int pageSize)
Creates a newPageRequest
. Pages are zero indexed, thus providing 0 forpage
will return the first page.- Parameters:
pageNumber
- zero-based page index.pageSize
- the size of the page to be returned.
-
PageRequest
public PageRequest(int pageNumber, int pageSize, Direction direction, String... properties)
Creates a newPageRequest
with sorting parameters applied.- Parameters:
pageNumber
- zero-based page index.pageSize
- the size of the page to be returned.direction
- the direction of theSorting
to be specified, can be null.properties
- the properties to sorting by, must not be null or empty.
-
PageRequest
public PageRequest(int pageNumber, int pageSize, Sorting sorting)
-
PageRequest
public PageRequest(String searchTerm, int pageNumber, int pageSize)
-
PageRequest
public PageRequest(int pageNumber, int pageSize, Sorting sorting, Filtering filtering, String searchTerm)
Creates a newPageRequest
with sorting parameters applied.- Parameters:
pageNumber
- zero-based page index, must not be less than zero.pageSize
- the size of the page to be returned, must not be less than one.sorting
- can be nullfiltering
- contains list of filter criteriassearchTerm
- searchTerm term for simple query term to be searched for
-
-
Method Detail
-
builder
public static PageRequest.Builder builder()
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classListRequest
-
first
public PageRequest first()
- Returns:
- the
PageRequest
requesting the first page
-
getOffset
public int getOffset()
- Returns:
- the offset to be taken according to the underlying page and page size.
-
getPageNumber
public int getPageNumber()
- Returns:
- the page to be returned.
-
getPageSize
public int getPageSize()
- Returns:
- the number of items of that page
-
hasPrevious
public boolean hasPrevious()
Returns whether there's a previousPageRequest
we can access from the current one. Will return false in case the currentPageRequest
already refers to the first page.- Returns:
- whether there's a previous PageRequest
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classListRequest
-
init
protected void init()
- Overrides:
init
in classListRequest
-
next
public PageRequest next()
- Returns:
- the
PageRequest
requesting the next page
-
previous
public PageRequest previous()
Returns thePageResponse
requesting the previous page.- Returns:
- the PageResponse requesting the previous page
-
previousOrFirst
public PageRequest previousOrFirst()
- Returns:
- the previous
PageRequest
or the firstPageRequest
if the current one already is the first one
-
setPageNumber
public void setPageNumber(int pageNumber)
- Parameters:
pageNumber
- the page to be returned
-
setPageSize
public void setPageSize(int pageSize)
- Parameters:
pageSize
- the number of items of that page
-
toString
public String toString()
- Overrides:
toString
in classListRequest
-
-