Class DefaultSpiPaginationService

java.lang.Object
de.hybris.platform.subscribedproductservices.services.impl.DefaultSpiPaginationService
All Implemented Interfaces:
SpiPaginationService

public class DefaultSpiPaginationService extends Object implements SpiPaginationService
Default implementation of SpiPaginationService.
Since:
2105
  • Constructor Details

    • DefaultSpiPaginationService

      public DefaultSpiPaginationService()
  • Method Details

    • getTotalNumberOfPages

      public Integer getTotalNumberOfPages(Integer noOfItems, Integer limit)
      Description copied from interface: SpiPaginationService
      Computes the total number of pages based on the given number of items in total and items per page.
      Specified by:
      getTotalNumberOfPages in interface SpiPaginationService
      Parameters:
      noOfItems - the total number of items.
      limit - the number of items in a page.
      Returns:
      the number of pages.
    • addEntryWithPaginationDetails

      public void addEntryWithPaginationDetails(org.springframework.util.MultiValueMap<String,String> header, String url, String queryStringWithoutParams, Long totalCount, Integer limit, Integer offset)
      Description copied from interface: SpiPaginationService
      Adds entry with pagination details to the header.
      Specified by:
      addEntryWithPaginationDetails in interface SpiPaginationService
      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 params
      totalCount - 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

      public Integer checkOffset(Integer inputOffset)
      Description copied from interface: SpiPaginationService
      Method will check if the inputOffset is correct, otherwise it will return a default offset.
      Specified by:
      checkOffset in interface SpiPaginationService
      Parameters:
      inputOffset - the offset set by the user.
      Returns:
      inputOffset if input value is correct; 0 otherwise.
    • checkLimit

      public Integer checkLimit(Integer inputLimit)
      Description copied from interface: SpiPaginationService
      Method will check if the inputLimit is correct, otherwise it will return a default limit.
      Specified by:
      checkLimit in interface SpiPaginationService
      Parameters:
      inputLimit - the limit set by the user.
      Returns:
      inputLimit if input value is correct; the DEFAULT_LIMIT value from project properties otherwise.