net.smartlab.web.page
Class SQLPaginator

java.lang.Object
  extended by net.smartlab.web.page.Paginator
      extended by net.smartlab.web.page.SQLPaginator
All Implemented Interfaces:
java.util.Iterator

public class SQLPaginator
extends Paginator

TODO documentation

Author:
rlogiacco

Field Summary
protected  org.apache.commons.logging.Log logger
          Logger for this class
 
Fields inherited from class net.smartlab.web.page.Paginator
array, UNDEFINED_PAGE, UNLIMITED_ITEMS, UNLIMITED_PAGES
 
Constructor Summary
SQLPaginator(javax.sql.DataSource pool, java.lang.String query)
          Creates an SQLPaginator instance using an SQL connection pool and a specified query.
SQLPaginator(javax.sql.DataSource pool, java.lang.String query, int size)
          Creates an SQLPaginator with default isolation level and unlimited page size.
SQLPaginator(javax.sql.DataSource pool, java.lang.String query, int size, int pages)
          Creates an SQLPaginator with default isoltaion level.
SQLPaginator(javax.sql.DataSource pool, java.lang.String query, int size, int pages, int isolation)
          Creates an SQLPaginator.
 
Method Summary
protected  java.lang.Object[] getObject(java.sql.ResultSet rows)
          Returns the current row datas.
protected  void setArray()
          TODO documentation
 
Methods inherited from class net.smartlab.web.page.Paginator
getCount, getNext, getPage, getPageCount, getPages, getPageSize, getPrev, getStart, getStop, hasNext, next, remove, reset, setCount, setPage, setPages, setPageSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final org.apache.commons.logging.Log logger
Logger for this class

Constructor Detail

SQLPaginator

public SQLPaginator(javax.sql.DataSource pool,
                    java.lang.String query)
             throws java.sql.SQLException
Creates an SQLPaginator instance using an SQL connection pool and a specified query. The page size is unlimited, the selected page is undefined and the isolation level is the default one.

Parameters:
pool - the SQL connection pool.
query - the selection query for pagination results.
Throws:
java.sql.SQLException - if something unexpected occurs while accessing the database.

SQLPaginator

public SQLPaginator(javax.sql.DataSource pool,
                    java.lang.String query,
                    int size)
             throws java.sql.SQLException
Creates an SQLPaginator with default isolation level and unlimited page size.

Parameters:
pool - the SQL connection pool.
query - the selection query for pagination results.
size - the number of elements composing each page.
Throws:
java.sql.SQLException - if something unexpected occurs while accessing the database.

SQLPaginator

public SQLPaginator(javax.sql.DataSource pool,
                    java.lang.String query,
                    int size,
                    int pages)
             throws java.sql.SQLException
Creates an SQLPaginator with default isoltaion level.

Parameters:
pool - the SQL connection pool.
query - the selection query for pagination results.
size - the number of elements composing each page.
pages - the number of pages composing each page block.
Throws:
java.sql.SQLException - if something unexpected occurs while accessing the database.

SQLPaginator

public SQLPaginator(javax.sql.DataSource pool,
                    java.lang.String query,
                    int size,
                    int pages,
                    int isolation)
             throws java.sql.SQLException
Creates an SQLPaginator.

Parameters:
pool - the SQL connection pool.
query - the selection query for pagination results.
size - the number of elements composing each page.
pages - the number of pages composing each page block.
isolation - the isolation level to be used while accessing the database.
Throws:
java.sql.SQLException - if something unexpected occurs while accessing the database.
Method Detail

setArray

protected void setArray()
Description copied from class: Paginator
TODO documentation

Specified by:
setArray in class Paginator
See Also:
net.smartlab.web.Paginator#setArray()

getObject

protected java.lang.Object[] getObject(java.sql.ResultSet rows)
Returns the current row datas.

Parameters:
rows - the paginated results.
Returns:
the current row datas as an array of objects.


Copyright © 2004-2009 The SmartWeb Team. All Rights Reserved.