com.scooterframework.orm.misc
Class SqlPageListSourceImpl

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

public class SqlPageListSourceImpl
extends PageListSource

SqlPageListSourceImpl class retrieves paged record list by using a predefined finder SQL query.

Finder SQL query example:

                SELECT * FROM employees
 

This class is responsible for adding page limit constraint in the query.

The caller of this class is responsible for setting proper values for limit, offset, recount, and inputs map. Default values will be used when they are not set. The default value for limit is defined in DataProcessor.DEFAULT_PAGINATION_LIMIT. The default value for offset is zero. The default value for recount is true./


Field Summary
protected  java.lang.String connName
           
protected  java.lang.String finderSql
           
 
Fields inherited from class com.scooterframework.orm.misc.PageListSource
inputOptions, limit, log, offset, recordList, recount, totalCount
 
Constructor Summary
SqlPageListSourceImpl(java.lang.String connName, java.lang.String finderSql)
          Constructs a PageListSource object.
SqlPageListSourceImpl(java.lang.String connName, java.lang.String finderSql, java.util.Map<java.lang.String,java.lang.String> inputOptions)
          Constructs a PageListSource object.
SqlPageListSourceImpl(java.lang.String connName, java.lang.String finderSql, java.util.Map<java.lang.String,java.lang.String> inputOptions, boolean recount)
          Constructs a PageListSource object.
 
Method Summary
protected  int countTotalRecords()
          Counts total number of records.
protected  java.util.List<RowData> retrieveList()
          Retrieves list of records.
 
Methods inherited from class com.scooterframework.orm.misc.PageListSource
checkOffset, execute, getLimitX, getOffset, getRecordList, getTotalCount, setInputs, setLimit, setOffset, setRecount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connName

protected java.lang.String connName

finderSql

protected java.lang.String finderSql
Constructor Detail

SqlPageListSourceImpl

public SqlPageListSourceImpl(java.lang.String connName,
                             java.lang.String finderSql)
Constructs a PageListSource object. If database connection name connName is empty, default connection as defined in database properties file is used.

Parameters:
connName - database connection name.
finderSql - the sql query for finding records.

SqlPageListSourceImpl

public SqlPageListSourceImpl(java.lang.String connName,
                             java.lang.String finderSql,
                             java.util.Map<java.lang.String,java.lang.String> inputOptions)
Constructs a PageListSource object. If database connection name connName is empty, default connection as defined in database properties file is used.

Parameters:
connName - database connection name.
finderSql - the SQL query for finding records.
inputOptions - Map of control information.

SqlPageListSourceImpl

public SqlPageListSourceImpl(java.lang.String connName,
                             java.lang.String finderSql,
                             java.util.Map<java.lang.String,java.lang.String> inputOptions,
                             boolean recount)
Constructs a PageListSource object. If database connection name connName is empty, default connection as defined in database properties file is used.

Parameters:
connName - database connection name.
finderSql - the SQL query for finding records.
inputOptions - Map of control information.
recount - true if recount of total records is allowed; false otherwise.
Method Detail

countTotalRecords

protected int countTotalRecords()
Description copied from class: PageListSource
Counts total number of records. May not be invoked if recounted is false.

Specified by:
countTotalRecords in class PageListSource
Returns:
total number of records

retrieveList

protected java.util.List<RowData> retrieveList()
Description copied from class: PageListSource
Retrieves list of records.

Specified by:
retrieveList in class PageListSource
Returns:
list of records