com.scooterframework.orm.misc
Class PageListSource

java.lang.Object
  extended by com.scooterframework.orm.misc.PageListSource
Direct Known Subclasses:
DataPageListSourceImpl, JdbcPageListSource, SqlPageListSourceImpl

public abstract class PageListSource
extends java.lang.Object

PageListSource class sets up basic framework for retrieving paged data.


Field Summary
protected  java.util.Map<java.lang.String,java.lang.String> inputOptions
           
protected  int limit
          Maximum number of records per page
protected  LogUtil log
           
protected  int offset
          Offset
protected  java.util.List<?> recordList
          paged record list
protected  boolean recount
          Boolean variable to indicate whether to recount total records.
protected  int totalCount
          Total number of records
 
Constructor Summary
PageListSource(java.util.Map<java.lang.String,java.lang.String> inputOptions)
          Constructs a PageListSource object.
PageListSource(java.util.Map<java.lang.String,java.lang.String> inputOptions, boolean recount)
          Constructs a PageListSource object.
 
Method Summary
protected  int checkOffset()
          Checks if offset is still in the reasonable range.
protected abstract  int countTotalRecords()
          Counts total number of records.
protected  void execute()
          Really does the record count and retrieval.
 int getLimitX()
          Returns maximum number of records per page
 int getOffset()
          Returns offset
 java.util.List<?> getRecordList()
          Returns retrieved record list.
 int getTotalCount()
          Returns count of total records.
protected abstract  java.util.List<? extends java.lang.Object> retrieveList()
          Retrieves list of records.
 void setInputs(java.util.Map<java.lang.String,java.lang.String> inputs)
          Merges data from an input map with the existing inputOptions map.
 void setLimit(int limit)
          Sets maximum number of records per page
 void setOffset(int offset)
          Sets offset
 void setRecount(boolean recount)
          Sets recount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

inputOptions

protected java.util.Map<java.lang.String,java.lang.String> inputOptions

limit

protected int limit
Maximum number of records per page


recount

protected boolean recount
Boolean variable to indicate whether to recount total records. True for recount, false for no recount.


offset

protected int offset
Offset


totalCount

protected int totalCount
Total number of records


recordList

protected java.util.List<?> recordList
paged record list


log

protected LogUtil log
Constructor Detail

PageListSource

public PageListSource(java.util.Map<java.lang.String,java.lang.String> inputOptions)
Constructs a PageListSource object.

Parameters:
inputOptions - Map of control information.

PageListSource

public PageListSource(java.util.Map<java.lang.String,java.lang.String> inputOptions,
                      boolean recount)
Constructs a PageListSource object.

Parameters:
inputOptions - Map of control information.
recount - true if recount of total records is allowed; false otherwise.
Method Detail

getOffset

public int getOffset()
Returns offset


setOffset

public void setOffset(int offset)
Sets offset


getLimitX

public int getLimitX()
Returns maximum number of records per page


setLimit

public void setLimit(int limit)
Sets maximum number of records per page


setRecount

public void setRecount(boolean recount)
Sets recount. True for recount; false for no recount.


setInputs

public void setInputs(java.util.Map<java.lang.String,java.lang.String> inputs)
Merges data from an input map with the existing inputOptions map.


getTotalCount

public int getTotalCount()
Returns count of total records.


getRecordList

public java.util.List<?> getRecordList()
Returns retrieved record list.


checkOffset

protected int checkOffset()
Checks if offset is still in the reasonable range. If offset is larger than total number of records, reset it to the beginning of the last page.


execute

protected void execute()
Really does the record count and retrieval.


countTotalRecords

protected abstract int countTotalRecords()
Counts total number of records. May not be invoked if recounted is false.

Returns:
total number of records

retrieveList

protected abstract java.util.List<? extends java.lang.Object> retrieveList()
Retrieves list of records.

Returns:
list of records