org.apache.cayenne.access.jdbc
Class LimitResultIterator

java.lang.Object
  extended by org.apache.cayenne.access.jdbc.LimitResultIterator
All Implemented Interfaces:
ResultIterator

public class LimitResultIterator
extends Object
implements ResultIterator

Since:
3.0

Field Summary
protected  int fetchedSoFar
           
protected  int fetchLimit
           
protected  Map<String,Object> nextDataObjectIds
           
protected  boolean nextRow
           
protected  int offset
           
protected  ResultIterator wrappedIterator
           
 
Constructor Summary
LimitResultIterator(ResultIterator wrappedIterator, int offset, int fetchLimit)
           
 
Method Summary
 void close()
          Closes ResultIterator and associated ResultSet.
 List dataRows(boolean close)
          Returns all unread data rows from ResultSet and closes this iterator if asked to do so.
 int getDataRowWidth()
          Returns the number of columns in the result row.
 boolean hasNextRow()
          Returns true if there is at least one more record that can be read from the iterator.
 Map nextDataRow()
          Returns the next result row as a Map.
 Object nextId(DbEntity entity)
          Reads and returns an id column or columns for the DbEntity.
 Map<String,Object> nextObjectId(DbEntity entity)
          Returns a map of ObjectId values from the next result row.
protected  Map readDataRow()
           
 Object readId(DbEntity entity)
           
 void skipDataRow()
          Skips current data row instead of reading it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wrappedIterator

protected ResultIterator wrappedIterator

nextDataObjectIds

protected Map<String,Object> nextDataObjectIds

fetchLimit

protected int fetchLimit

offset

protected int offset

fetchedSoFar

protected int fetchedSoFar

nextRow

protected boolean nextRow
Constructor Detail

LimitResultIterator

public LimitResultIterator(ResultIterator wrappedIterator,
                           int offset,
                           int fetchLimit)
                    throws CayenneException
Throws:
CayenneException
Method Detail

readDataRow

protected Map readDataRow()
                   throws CayenneException
Throws:
CayenneException

close

public void close()
           throws CayenneException
Description copied from interface: ResultIterator
Closes ResultIterator and associated ResultSet. This method must be called explicitly when the user is finished processing the records. Otherwise unused database resources will not be released properly.

Specified by:
close in interface ResultIterator
Throws:
CayenneException

dataRows

public List dataRows(boolean close)
              throws CayenneException
Description copied from interface: ResultIterator
Returns all unread data rows from ResultSet and closes this iterator if asked to do so.

Specified by:
dataRows in interface ResultIterator
Throws:
CayenneException

getDataRowWidth

public int getDataRowWidth()
Description copied from interface: ResultIterator
Returns the number of columns in the result row.

Specified by:
getDataRowWidth in interface ResultIterator

hasNextRow

public boolean hasNextRow()
                   throws CayenneException
Description copied from interface: ResultIterator
Returns true if there is at least one more record that can be read from the iterator.

Specified by:
hasNextRow in interface ResultIterator
Throws:
CayenneException

nextDataRow

public Map nextDataRow()
                throws CayenneException
Description copied from interface: ResultIterator
Returns the next result row as a Map.

Specified by:
nextDataRow in interface ResultIterator
Throws:
CayenneException

nextId

public Object nextId(DbEntity entity)
              throws CayenneException
Description copied from interface: ResultIterator
Reads and returns an id column or columns for the DbEntity. If an entity has a single column id, the return value is an Object matching the column type (e.g. java.lang.Long). If an entity has a compound PK, the return value is a DataRow (i.e. equivalent to ResultIterator.nextObjectId(DbEntity)).

Specified by:
nextId in interface ResultIterator
Throws:
CayenneException

nextObjectId

public Map<String,Object> nextObjectId(DbEntity entity)
                                throws CayenneException
Description copied from interface: ResultIterator
Returns a map of ObjectId values from the next result row. Primary key columns are determined from the provided DbEntity.

Specified by:
nextObjectId in interface ResultIterator
Throws:
CayenneException

skipDataRow

public void skipDataRow()
                 throws CayenneException
Description copied from interface: ResultIterator
Skips current data row instead of reading it.

Specified by:
skipDataRow in interface ResultIterator
Throws:
CayenneException

readId

public Object readId(DbEntity entity)
              throws CayenneException
Throws:
CayenneException


Copyright © 2001-2008 Apache Cayenne. All Rights Reserved.