Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.util.pager
Class Pager

java.lang.Object
  extended by org.hyperic.util.pager.Pager

public class Pager
extends java.lang.Object

Implements a generic pager. What is a pager? Let's say you have a large collection of objects, perhaps a long list of EJB Local Interfaces. You're interested in breaking the mammoth list out into a number pages, each with 25 items on it. You're interested in returning page #17 of such a collection. Why bother implementing the "skip past a bunch of things, then return pagesize items in the resultant colleciton" over and over again. You can also have the elements go through a _processor that you supply as they move from the source collection to the destination collection.


Field Summary
static java.lang.String DEFAULT_PROCESSOR_CLASSNAME
           
 
Method Summary
static Pager getDefaultPager()
           
static Pager getPager(java.lang.String className)
          Get a pager based on the PagerProcessor supplied.
 PageList processAll(PageList source)
          Process all objects in the source page list and return the destination page list with the same total size
 java.lang.Object processOne(java.lang.Object one)
           
 void seek(java.util.Collection source, java.util.Collection dest, int pagenum, int pagesize)
          Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection.
 int seek(java.util.Collection source, java.util.Collection dest, int pagenum, int pagesize, java.lang.Object procData)
          Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection.
 PageList seek(java.util.Collection source, int pagenum, int pagesize)
          Seek to the specified pagenum in the source collection and return pagsize numberof of elements in the List.
 PageList seek(java.util.Collection source, int pagenum, int pagesize, java.lang.Object procData)
          Seek to the specified pagenum in the source collection and return pagsize numberof of elements in the List.
 PageList seek(java.util.Collection source, PageControl pc)
          Seek to the specified pagenum in the source collection and return pagsize numberof of elements in the List, as specified the PageControl object.
 PageList seek(java.util.Collection source, PageControl pc, java.lang.Object procData)
           
 int seekAll(java.util.Collection source, java.util.Collection dest, int pagenum, int pagesize, java.lang.Object procData)
          Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection.
 PageList seekAll(java.util.Collection source, int pagenum, int pagesize, java.lang.Object procData)
          Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_PROCESSOR_CLASSNAME

public static final java.lang.String DEFAULT_PROCESSOR_CLASSNAME
Method Detail

getDefaultPager

public static Pager getDefaultPager()

getPager

public static Pager getPager(java.lang.String className)
                      throws java.lang.InstantiationException,
                             java.lang.IllegalAccessException,
                             java.lang.ClassNotFoundException
Get a pager based on the PagerProcessor supplied.

Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.ClassNotFoundException

seek

public PageList seek(java.util.Collection source,
                     int pagenum,
                     int pagesize)
Seek to the specified pagenum in the source collection and return pagsize numberof of elements in the List. If pagenum or pagesize is -1, then everything in the source collection will be returned.

Parameters:
source - The source collection to seek through.
pagenum - The page number to seek to. If there not enough pages in the collection, then an empty list will be returned.
pagesize - The size of each page.
Returns:
PageList containing results of seek.

seek

public PageList seek(java.util.Collection source,
                     PageControl pc)
Seek to the specified pagenum in the source collection and return pagsize numberof of elements in the List, as specified the PageControl object. If pagenum or pagesize is -1, then everything in the source collection will be returned.

Parameters:
source - The source collection to seek through.
pc - The PageControl object to use to control paging.
Returns:
PageList containing results of seek.

seek

public PageList seek(java.util.Collection source,
                     PageControl pc,
                     java.lang.Object procData)

seek

public PageList seek(java.util.Collection source,
                     int pagenum,
                     int pagesize,
                     java.lang.Object procData)
Seek to the specified pagenum in the source collection and return pagsize numberof of elements in the List. If pagenum or pagesize is -1, then everything in the source collection will be returned.

Parameters:
source - The source collection to seek through.
pagenum - The page number to seek to. If there not enough pages in the collection, then an empty list will be returned.
pagesize - The size of each page.
procData - - any data object required by the _processor.
Returns:
PageList containing results of seek.

seek

public void seek(java.util.Collection source,
                 java.util.Collection dest,
                 int pagenum,
                 int pagesize)
Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection. If pagenum or pagesize is -1, then everything in the source collection will be placed in the dest collection.

Parameters:
source - The source collection to seek through.
dest - The collection to place results into.
pagenum - The page number to seek to. If there not enough pages in the collection, then an empty list will be returned.
pagesize - The size of each page.

seek

public int seek(java.util.Collection source,
                java.util.Collection dest,
                int pagenum,
                int pagesize,
                java.lang.Object procData)
Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection. If pagenum or pagesize is -1, then everything in the source collection will be placed in the dest collection.

Parameters:
source - The source collection to seek through.
dest - The collection to place results into.
pagenum - The page number to seek to. If there not enough pages in the collection, then an empty list will be returned.
pagesize - The size of each page.
procData - any object required to process the item.

seekAll

public PageList seekAll(java.util.Collection source,
                        int pagenum,
                        int pagesize,
                        java.lang.Object procData)
Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection. Unlike, seek(), all items are passed to the Processor or ProcessorExt regardless whether they are placed in dest collection. If pagenum or pagesize is -1, then everything in the source collection will be placed in the dest collection.

Parameters:
source - The source collection to seek through.
pagenum - The page number to seek to. If there not enough pages in the collection, then an empty list will be returned.
pagesize - The size of each page.
procData - any object required to process the item.

seekAll

public int seekAll(java.util.Collection source,
                   java.util.Collection dest,
                   int pagenum,
                   int pagesize,
                   java.lang.Object procData)
Seek to the specified pagenum in the source collection and place pagesize number of elements into the dest collection. Unlike, seek(), all items are passed to the Processor or ProcessorExt regardless whether they are placed in dest collection. If pagenum or pagesize is -1, then everything in the source collection will be placed in the dest collection.

Parameters:
source - The source collection to seek through.
dest - The collection to place results into.
pagenum - The page number to seek to. If there not enough pages in the collection, then an empty list will be returned.
pagesize - The size of each page.
procData - any object required to process the item.

processAll

public PageList processAll(PageList source)
Process all objects in the source page list and return the destination page list with the same total size


processOne

public java.lang.Object processOne(java.lang.Object one)

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.