Class PaginatedSearchUtils

java.lang.Object
de.hybris.platform.servicelayer.search.paginated.util.PaginatedSearchUtils

public final class PaginatedSearchUtils extends Object
Helper class for handling paginated search.
  • Method Details

    • createPaginationData

      public static PaginationData createPaginationData(int pageSize, int currentPage, boolean needsTotal)
      Creates a new instance of PaginationData with specified pagination information
      Parameters:
      pageSize - the pageSize
      currentPage - the currentPage
      needsTotal - the needsTotal flag
      Returns:
      PaginationData with given pagination information
    • createSortData

      public static SortData createSortData(String code, boolean asc)
      Creates a new instance of SortData with specified sort information
      Parameters:
      code - the attribute code to be sorted by
      asc - the flag indicating sort ordering
      Returns:
      SortData with given code and sort order
    • createSearchPageDataWithPagination

      public static <T> SearchPageData<T> createSearchPageDataWithPagination(int pageSize, int currentPage, boolean needsTotal)
      Creates a new instance of SearchPageData with given paginationData parameters.
      Type Parameters:
      T - the SearchPageData result type
      Parameters:
      pageSize - the pageSize to be set in the PaginationData
      currentPage - the currentPage to be set in the PaginationData
      needsTotal - the needsTotal flag to be set in the PaginationData
      Returns:
      a new instance of SearchPageData with given paginationData parameters
    • createSearchPageDataWithPaginationAndSorting

      public static <T> SearchPageData<T> createSearchPageDataWithPaginationAndSorting(int pageSize, int currentPage, boolean needsTotal, Map<String,String> sortMap)
      Creates a new instance of SearchPageData with given paginationData and SortData parameters.

      Please note that this helper method only handles one sort code case.

      Type Parameters:
      T - the SearchPageData result type
      Parameters:
      pageSize - the pageSize to be set in the PaginationData
      currentPage - the currentPage to be set in the PaginationData
      needsTotal - the needsTotal flag to be set in the PaginationData
      sortMap - the map contains sortCode as key and sort ordering as value to generate SortData list
      Returns:
      a new instance of SearchPageData with given paginationData and SortData parameters