Class PagerFilter<T>

java.lang.Object
com.atlassian.jira.web.bean.PagerFilter<T>
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
GroupBrowserFilter, UserBrowserFilter, UserPickerFilter

@PublicApi public class PagerFilter<T> extends Object implements Serializable
This is a super class that implements paging for browsers.

Most other filters (which want paging ability) will extend this. It defines bounds from start to start + max, making max the page size.

See Also:
  • Field Details

  • Constructor Details

    • PagerFilter

      public PagerFilter()
    • PagerFilter

      public PagerFilter(PagerFilter old)
    • PagerFilter

      public PagerFilter(int max)
      A pager that will return max objects
      Parameters:
      max - the maximum number of results in a page
    • PagerFilter

      public PagerFilter(int start, int max)
      A pager that will return objects from start to start + max
      Parameters:
      start - the starting point for the page
      max - the maximum number of results in a page
  • Method Details

    • getUnlimitedFilter

      @Deprecated(forRemoval=true) public static PagerFilter getUnlimitedFilter()
      Deprecated, for removal: This API element is subject to removal in a future version.
      Unlimited filters are discouraged due to potential performance issues. Use SearchService.streamSearch(com.atlassian.jira.user.ApplicationUser, com.atlassian.query.Query) for unlimited results.
      A pager that will return unlimited number of objects.

      Deprecation warning: Unlimited pagers are not supported by SearchPlatform.OPENSEARCH. The default maximum results for OpenSearch is 10,000. To fetch more than 10,000 results, use SearchService.streamSearch(com.atlassian.jira.user.ApplicationUser, com.atlassian.query.Query) instead.

      Returns:
      A PagerFilter with max results set to Integer.MAX_VALUE
    • newPageAlignedFilter

      public static PagerFilter newPageAlignedFilter(int index, int max)
      A pager that has its start aligned to the page containing the index.
      Parameters:
      index - the index of a result whose page you want the pager to start at
      max - the maximum number of results in a page
      Returns:
      a new pager aligned to the page containing the index
      Throws:
      IllegalArgumentException - if index is less than 0
    • getCurrentPage

      public List<T> getCurrentPage(List<T> itemsCol)
      Gets the current page out of a list of objects.
      Returns:
      the sublist that is the current page.
    • getPages

      public List<Page> getPages(Collection<T> itemsCol)
    • getPages

      public List<Page> getPages(int itemCount)
    • getPages

      protected Collection<Page> getPages()
    • generatePages

      public List<Page> generatePages(Collection<T> items)
      generates a collection of page objects which keep track of the pages for display
      Parameters:
      items - the items to be paged
    • generatePages

      public List<Page> generatePages(int itemCount)
      generates a collection of page objects which keep track of the pages for display
      Parameters:
      itemCount - the number of items to be paged
    • restrictPages

      public List<Page> restrictPages(Collection<Page> pages, int size)
      Restrict the pagers to a certain number of pages on either side of the current page.

      The number of pages to list is stored in PAGES_TO_LIST.

    • getMax

      public int getMax()
    • getPageSize

      public int getPageSize()
    • setMax

      public void setMax(int max)
    • getStart

      public int getStart()
    • setStart

      public void setStart(int start)
    • getEnd

      public int getEnd()
    • getNextStart

      public int getNextStart()
    • getPreviousStart

      public int getPreviousStart()
    • toString

      public String toString()
      Overrides:
      toString in class Object