Interface PaginationService
- All Known Implementing Classes:
PaginationServiceImpl
-
Method Summary
Modifier and TypeMethodDescription<T extends AbstractRestModel>
@NotNull RestPageModel<T>getExpandablePage
(@NotNull PageRequest pageRequest, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull String pageLocation) Constructs aRestPageModel
which is an empty page with a self link.<W,
T extends AbstractRestModel>
@NotNull RestPageModel<T>getPage
(@NotNull Iterable<W> input, @NotNull PageRequest pageRequest, @NotNull Expansion expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestConversionFunction<? super W, T> transformer) Transforms a list of domain objects toAbstractRestModel
s and constructs aRestPageModel
from the result.<W,
T extends AbstractRestModel>
@NotNull RestPageModel<T>getPage
(@NotNull Iterable<W> input, @NotNull PageRequest pageRequest, @NotNull Expansion expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestConversionFunction<? super W, T> transformer, @NotNull String pageLocation) Transforms a list of domain objects toAbstractRestModel
s and constructs aRestPageModel
from the result.<W,
T extends AbstractRestModel>
@NotNull RestPageModel<T>getPage
(@NotNull Stream<W> input, @NotNull PageRequest pageRequest, @NotNull Expansion expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestConversionFunction<? super W, T> transformer) Transforms a list of domain objects toAbstractRestModel
s and constructs aRestPageModel
from the result.<W,
T extends AbstractRestModel>
@NotNull RestPageModel<T>getPage
(@NotNull Stream<W> input, @NotNull PageRequest pageRequest, @NotNull Expansion expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestConversionFunction<? super W, T> transformer, @NotNull String pageLocation) Transforms a list of domain objects toAbstractRestModel
s and constructs aRestPageModel
from the result.<W,
T extends AbstractRestModel>
RestPageModel<T>transformPage
(@NotNull PageRequest pageRequest, @NotNull Expansion expansion, @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull RestConversionFunction<? super W, T> transformer, @NotNull Function<Integer, Collection<W>> daoFunction) Gets paginated set of objects from database and transforms toAbstractRestModel
s and constructs aRestPageModel
.
-
Method Details
-
getPage
@NotNull <W,T extends AbstractRestModel> @NotNull RestPageModel<T> getPage(@NotNull @NotNull Iterable<W> input, @NotNull @NotNull PageRequest pageRequest, @NotNull @NotNull Expansion expansion, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestConversionFunction<? super W, T> transformer) Transforms a list of domain objects to
AbstractRestModel
s and constructs aRestPageModel
from the result. Assumes input is the full list of possible objects. Will only transform the required number of objects as defined by thePageRequest
. TheRestPageModel
will include page links.DO NOT USE FOR EXPANDED PAGES
This method assumes the uriInfo represents the page being requested and uses it to construct the page's self link. Use
getPage(Iterable, PageRequest, Expansion, UriInfo, RestConversionFunction, String)
to specify the page location if the current request does not represent the page being transformed (e.g. resource expansion may need to construct a page of sub-resources).- Type Parameters:
W
- domain objectT
- rest object- Parameters:
input
- full list of domain objectspageRequest
- which page of information requiredexpansion
- The expansion to use when transforming the objectsuriInfo
- URI info from the request used to construct the page's self linktransformer
- to convert domain object into rest object- Returns:
- Single page of rest objects
-
getPage
@NotNull <W,T extends AbstractRestModel> @NotNull RestPageModel<T> getPage(@NotNull @NotNull Stream<W> input, @NotNull @NotNull PageRequest pageRequest, @NotNull @NotNull Expansion expansion, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestConversionFunction<? super W, T> transformer) Transforms a list of domain objects to
AbstractRestModel
s and constructs aRestPageModel
from the result. Assumes input is the full list of possible objects. Will only transform the required number of objects as defined by thePageRequest
. TheRestPageModel
will include page links.DO NOT USE FOR EXPANDED PAGES
This method assumes the uriInfo represents the page being requested and uses it to construct the page's self link. Use
getPage(Iterable, PageRequest, Expansion, UriInfo, RestConversionFunction, String)
to specify the page location if the current request does not represent the page being transformed (e.g. resource expansion may need to construct a page of sub-resources).- Type Parameters:
W
- domain objectT
- rest object- Parameters:
input
- full list of domain objectspageRequest
- which page of information requiredexpansion
- The expansion to use when transforming the objectsuriInfo
- URI info from the request used to construct the page's self linktransformer
- to convert domain object into rest object- Returns:
- Single page of rest objects
-
getPage
@NotNull <W,T extends AbstractRestModel> @NotNull RestPageModel<T> getPage(@NotNull @NotNull Iterable<W> input, @NotNull @NotNull PageRequest pageRequest, @NotNull @NotNull Expansion expansion, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestConversionFunction<? super W, T> transformer, @NotNull @NotNull String pageLocation) Transforms a list of domain objects toAbstractRestModel
s and constructs aRestPageModel
from the result. Assumes input is the full list of possible objects. Will only transform the required number of objects as defined by thePageRequest
. TheRestPageModel
will include page links.- Type Parameters:
W
- domain objectT
- rest object- Parameters:
input
- full list of domain objectspageRequest
- which page of information requiredexpansion
- The expansion to use when transforming the objectsuriInfo
- URI info from the requesttransformer
- to convert domain object into rest objectpageLocation
- The relative URI path used to construct the page's self link- Returns:
- Single page of rest objects
-
getPage
@NotNull <W,T extends AbstractRestModel> @NotNull RestPageModel<T> getPage(@NotNull @NotNull Stream<W> input, @NotNull @NotNull PageRequest pageRequest, @NotNull @NotNull Expansion expansion, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestConversionFunction<? super W, T> transformer, @NotNull @NotNull String pageLocation) Transforms a list of domain objects toAbstractRestModel
s and constructs aRestPageModel
from the result. Assumes input is the full list of possible objects. Will only transform the required number of objects as defined by thePageRequest
. TheRestPageModel
will include page links.- Type Parameters:
W
- domain objectT
- rest object- Parameters:
input
- full list of domain objectspageRequest
- which page of information requiredexpansion
- The expansion to use when transforming the objectsuriInfo
- URI info from the requesttransformer
- to convert domain object into rest objectpageLocation
- The relative URI path used to construct the page's self link- Returns:
- Single page of rest objects
-
getExpandablePage
@NotNull <T extends AbstractRestModel> @NotNull RestPageModel<T> getExpandablePage(@NotNull @NotNull PageRequest pageRequest, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull String pageLocation) Constructs aRestPageModel
which is an empty page with a self link.- Type Parameters:
T
- rest object- Parameters:
pageRequest
- which page of information requireduriInfo
- URI info from the requestpageLocation
- The relative URI path used to construct the page's self link- Returns:
- Empty page with self link
-
transformPage
<W,T extends AbstractRestModel> RestPageModel<T> transformPage(@NotNull @NotNull PageRequest pageRequest, @NotNull @NotNull Expansion expansion, @NotNull @NotNull javax.ws.rs.core.UriInfo uriInfo, @NotNull @NotNull RestConversionFunction<? super W, T> transformer, @NotNull @NotNull Function<Integer, Collection<W>> daoFunction) Gets paginated set of objects from database and transforms to
AbstractRestModel
s and constructs aRestPageModel
. TheRestPageModel
will include page links.This method assumes the uriInfo represents the page being requested and uses it to construct the page's self link.
- Type Parameters:
W
- domain objectT
- rest object- Parameters:
pageRequest
- which page of information requiredexpansion
- The expansion to use when transforming the objectsuriInfo
- URI info from the request used to construct the page's self linktransformer
- to convert domain object into rest objectdaoFunction
- function which allows get subset of objects from database. Takes limit arg to define max length of the subset.- Returns:
- Single page of rest objects
-