Class DefaultAgrPaginationService
java.lang.Object
de.hybris.platform.agreementservices.services.impl.DefaultAgrPaginationService
- All Implemented Interfaces:
AgrPaginationService
Default implementation of
AgrPaginationService.- Since:
- 2108
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPaginationHeadersToResponse(org.springframework.util.MultiValueMap<String, String> header, String url, String queryStringWithoutParams, Long totalCount, Integer limit, Integer offset) Adds the x-total-count and pagination links headers to the response.checkLimit(Integer inputLimit) Method will check if the inputLimit is correct, otherwise it will return a default limit.checkOffset(Integer inputOffset) Method will check if the inputOffset is correct, otherwise it will return a default offset.getTotalNumberOfPages(Integer noOfItems, Integer limit) Computes the total number of pages based on the given number of items in total and items per page.
-
Constructor Details
-
DefaultAgrPaginationService
public DefaultAgrPaginationService()
-
-
Method Details
-
getTotalNumberOfPages
Description copied from interface:AgrPaginationServiceComputes the total number of pages based on the given number of items in total and items per page.- Specified by:
getTotalNumberOfPagesin interfaceAgrPaginationService- Parameters:
noOfItems- the total number of items.limit- the number of items in a page.- Returns:
- the number of pages.
-
addPaginationHeadersToResponse
public void addPaginationHeadersToResponse(org.springframework.util.MultiValueMap<String, String> header, String url, String queryStringWithoutParams, Long totalCount, Integer limit, Integer offset) Description copied from interface:AgrPaginationServiceAdds the x-total-count and pagination links headers to the response.- Specified by:
addPaginationHeadersToResponsein interfaceAgrPaginationService- Parameters:
header- The header that will be used in response.url- The Url of the http request.queryStringWithoutParams- The url string without the offset and limit paramstotalCount- The total number of resources of the requested type that exist in the system.limit- The limit represents the number of entries that will be selected for the result list.offset- The offset represents the position in list from where the result list will start.
-
checkOffset
Description copied from interface:AgrPaginationServiceMethod will check if the inputOffset is correct, otherwise it will return a default offset.- Specified by:
checkOffsetin interfaceAgrPaginationService- Parameters:
inputOffset- the offset set by the user.- Returns:
- inputOffset if input value is correct; 0 otherwise.
-
checkLimit
Description copied from interface:AgrPaginationServiceMethod will check if the inputLimit is correct, otherwise it will return a default limit.- Specified by:
checkLimitin interfaceAgrPaginationService- Parameters:
inputLimit- the limit set by the user.- Returns:
- inputLimit if input value is correct; the DEFAULT_LIMIT value from project properties otherwise.
-