Expresso 5-6

com.jcorporate.expresso.core.misc
Class RecordPaginator

java.lang.Object
  extended bycom.jcorporate.expresso.core.misc.RecordPaginator
All Implemented Interfaces:
Serializable

public class RecordPaginator
extends Object
implements Serializable

Copyright: Copyright (c) 2001-2002 JCorporate Ltd.

This class takes care of the low-level logic for when dealing with "e;pages"e; of data. It is used in the Download Controller to allow paging through masses of download files, as well as in DBMaint for paging through the data records.

Author:
Michael Rimov
See Also:
Serialized Form

Constructor Summary
RecordPaginator()
           
 
Method Summary
 int getEndRecordNumber()
          Returns the end record number for a particular page.
 int getPageCount()
          Get the number of pages [using recorg pagination] that exist for this record.
 int getPageNumber()
           
 int getStartRecordNumber()
          Modified code based upon xin lee.
 long getTotalRecordCount()
          Returns the total record count retrieved for this database search
 boolean isCountRecords()
          Returns true if the system is expected to get the total record count.
 boolean isMoreRecords()
           
 boolean isPreviousRecords()
           
 ArrayList searchAndRetrieve(DataObject searchCriteria, String sortKey)
          Returns a search and retrieve list from the DBObject who's criteria you have set.
 List searchAndRetrieve(MultiDBObject searchCriteria, String sortKey)
          Returns a search and retrieve list from the DBObject who's criteria you have set.
 void setCountRecords(boolean newCountRecords)
          Sets whether or not the total record count should be used or not.
 void setEndRecordNumber(int newEndRecordNumber)
          Sets the ending record number
 void setMoreRecords(boolean newMoreRecords)
           
protected  void setPageLimitAttribute(DataObject dbObj)
          Sets the size of the page limit.
protected  void setPageLimitAttribute(MultiDBObject dbObj)
          Sets the size of the page limit.
 void setPageNumber(ControllerRequest request)
          Sets the page number based upon the controller request object.
 void setPageNumber(int newPageNumber)
           
 void setPreviousRecords(boolean newPreviousRecords)
           
 void setStartRecordNumber(int newStartRecordNumber)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordPaginator

public RecordPaginator()
Method Detail

setMoreRecords

public void setMoreRecords(boolean newMoreRecords)

isMoreRecords

public boolean isMoreRecords()

setPreviousRecords

public void setPreviousRecords(boolean newPreviousRecords)

isPreviousRecords

public boolean isPreviousRecords()

setPageNumber

public void setPageNumber(int newPageNumber)

getPageNumber

public int getPageNumber()

setStartRecordNumber

public void setStartRecordNumber(int newStartRecordNumber)

getStartRecordNumber

public int getStartRecordNumber()
Modified code based upon xin lee.

Returns:
the Start Record Number

setEndRecordNumber

public void setEndRecordNumber(int newEndRecordNumber)
Sets the ending record number

Parameters:
newEndRecordNumber - int for the new end record number

getEndRecordNumber

public int getEndRecordNumber()
Returns the end record number for a particular page.

Returns:
integer >= 0

setCountRecords

public void setCountRecords(boolean newCountRecords)
Sets whether or not the total record count should be used or not.

Parameters:
newCountRecords - true if you wish for the recordset to retrieve a total record count.

isCountRecords

public boolean isCountRecords()
Returns true if the system is expected to get the total record count.

Returns:
true if the record count will be active.

getTotalRecordCount

public long getTotalRecordCount()
Returns the total record count retrieved for this database search

Returns:
total record count as long.

getPageCount

public int getPageCount()
Get the number of pages [using recorg pagination] that exist for this record.

Returns:

searchAndRetrieve

public ArrayList searchAndRetrieve(DataObject searchCriteria,
                                   String sortKey)
                            throws DBException
Returns a search and retrieve list from the DBObject who's criteria you have set. Also sets its internal attributes such as start record number etc.

Parameters:
searchCriteria - The DBObject to search against
sortKey - the field to search against.
Returns:
an ArrayList of DBObjects retrieved by the searchCriteria
Throws:
DBException

searchAndRetrieve

public List searchAndRetrieve(MultiDBObject searchCriteria,
                              String sortKey)
                       throws DBException
Returns a search and retrieve list from the DBObject who's criteria you have set. Also sets its internal attributes such as start record number etc.

Parameters:
searchCriteria - The DBObject to search against
sortKey - the field to search against.
Returns:
an ArrayList of DBObjects retrieved by the searchCriteria
Throws:
DBException

setPageLimitAttribute

protected void setPageLimitAttribute(DataObject dbObj)
                              throws DBException
Sets the size of the page limit. It uses the DBObject Limit to define how many records per page are displayed

Parameters:
dbObj - The dbobject to set for.
Throws:
DBException

setPageLimitAttribute

protected void setPageLimitAttribute(MultiDBObject dbObj)
                              throws DBException
Sets the size of the page limit. It uses the DBObject Limit to define how many records per page are displayed

Parameters:
dbObj - The dbobject to set for.
Throws:
DBException

setPageNumber

public void setPageNumber(ControllerRequest request)
                   throws ControllerException
Sets the page number based upon the controller request object. If the page parameters is not included with the request, then page is set to zero.

Parameters:
request - The controller request fed to the controller from which the function can extract the page= controller parameter.
Throws:
ControllerException - if page= is not a number.

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.