Class DefaultTmaPaginationFacade

java.lang.Object
de.hybris.platform.b2ctelcofacades.pagination.impl.DefaultTmaPaginationFacade
All Implemented Interfaces:
TmaPaginationFacade
Direct Known Subclasses:
FacetSearchTmaPaginationFacade

public class DefaultTmaPaginationFacade extends Object implements TmaPaginationFacade
Default implementation of TmaPaginationFacade
Since:
1907
  • Constructor Details

    • DefaultTmaPaginationFacade

      public DefaultTmaPaginationFacade()
  • Method Details

    • getTotalNumberOfPages

      public Integer getTotalNumberOfPages(Integer noOfItems, Integer limit)
      Description copied from interface: TmaPaginationFacade
      Computes the total number of pages based on the given number of items in total and items per page.
      Specified by:
      getTotalNumberOfPages in interface TmaPaginationFacade
      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: TmaPaginationFacade
      Adds the x-total-count and pagination links headers to the response.
      Specified by:
      addPaginationHeadersToResponse in interface TmaPaginationFacade
      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.
    • filterListByOffsetAndLimit

      public <T> List<T> filterListByOffsetAndLimit(Integer offset, Integer limit, List<T> inputList)
      Description copied from interface: TmaPaginationFacade
      Will filter a list of items(model or dto) by offset and limit.
      Specified by:
      filterListByOffsetAndLimit in interface TmaPaginationFacade
      Type Parameters:
      T - The type of the objects contained in the list.
      Parameters:
      offset - The offset represents the position in list from where the result list will start.
      limit - The limit represents the number of entries that will be selected for the result list.
      inputList - The initial list of objects to be filtered.
      Returns:
      The filtered list.
    • checkOffset

      public Integer checkOffset(Integer inputOffset)
      Description copied from interface: TmaPaginationFacade
      Method will check if the inputOffset is correct, otherwise it will return a default offset.
      Specified by:
      checkOffset in interface TmaPaginationFacade
      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: TmaPaginationFacade
      Method will check if the inputLimit is correct, otherwise it will return a default limit.
      Specified by:
      checkLimit in interface TmaPaginationFacade
      Parameters:
      inputLimit - the limit set by the user.
      Returns:
      inputLimit if input value is correct; the DEFAULT_LIMIT value from B2ctelcoservicesConstants otherwise.