Class PagerData

java.lang.Object
com.jalios.jcms.restv2.PagerData
All Implemented Interfaces:
Iterable<Object>

public class PagerData extends Object implements Iterable<Object>
This object contains the business logic that takes parameters in j2eeRequest and create the pagerHandler associated. It is iterable, and the iteration is done through objects contained in the colelction set by setCollection() and for the scope computed by the parameters.
Since:
JCMS-6.0
Author:
dissert
  • Constructor Details

    • PagerData

      public PagerData(javax.ws.rs.core.UriInfo uriInfo, javax.servlet.http.HttpServletRequest j2eeRequest)
  • Method Details

    • initFromFormParameters

      public void initFromFormParameters(LinkedHashMap<String,List<String>> parametersMap)
    • initFromRequestBody

      public void initFromRequestBody(PagingDTO params)
    • getPageSize

      public int getPageSize()
    • isPagerAll

      public boolean isPagerAll()
    • hasRequestPagerData

      public boolean hasRequestPagerData()
    • getStart

      public int getStart()
    • setStart

      public void setStart(int start)
    • getSort

      public String getSort()
    • setSort

      public void setSort(String sort)
    • isReverse

      public boolean isReverse()
    • setReverse

      public void setReverse(boolean reverse)
    • isCollection

      public boolean isCollection()
    • setFromPageResult

      public void setFromPageResult(PageResult<?> pageResult)
      Set the paginated result from a PageResult instance.

      Warning : this method will apply sorting of the specified result by invoking the comparator retrieved from ComparatorManager. use setFromPageResult(PageResult, boolean) to skip this ordering if your collection is already sorted.

      Parameters:
      pageResult - the PageResult computed by your API
    • setFromPageResult

      public void setFromPageResult(PageResult<?> pageResult, boolean collectionAlreaySorted)
      Set the paginated result from a PageResult instance.
      Parameters:
      pageResult - the PageResult computed by your API
      collectionAlreaySorted - true to indicate the PageResult is already sorted, false to apply sort order (comparator) on collection
      Since:
      10.0.9 / JCMS-11310
    • setCollection

      public void setCollection(Collection collection)
      Set the collection associated with this page, the collection must be sorted, so a sort is done by default inside. if another sort should be done, see setCollection(Collection, boolean) method to disable internalm
      Parameters:
      collection - the Collection (if the paramter is an instance of QueryResultSet, the collectionAlreaySorted is ignored and sort is always done on QueryResultSet sort)
    • setCollection

      public void setCollection(Collection collection, boolean collectionAlreaySorted)
      Set the collection associated with this page, the collection must be sorted, so a sort is done by default. The collectionAlreaySorted parameter is present to disable the default sort if needed.
      Parameters:
      collection - the Collection (if the paramter is an instance of QueryResultSet, the collectionAlreaySorted is ignored and sort is always done on QueryResultSet sort)
      collectionAlreaySorted - false is the Collection is a Data collection which has already been sorted previously
    • getCollectionTagName

      public String getCollectionTagName()
    • setCollectionTagName

      public void setCollectionTagName(String collectionTagName)
    • getCollectionTagAttributeMap

      public Map<String,String> getCollectionTagAttributeMap()
    • setCollectionTagAttributeMap

      public void setCollectionTagAttributeMap(Map<String,String> collectionAttributeMap)
    • getCollectionTagAttributes

      public String getCollectionTagAttributes()
    • getItemTagName

      public String getItemTagName()
    • setItemTagName

      public void setItemTagName(String itemTagName)
    • iterator

      public Iterator iterator()
      Specified by:
      iterator in interface Iterable<Object>
    • getTotal

      public int getTotal()