org.ephman.abra.database
Class DatabaseCursor

java.lang.Object
  |
  +--org.ephman.abra.database.DatabaseCursor
All Implemented Interfaces:
java.io.Serializable

public class DatabaseCursor
extends java.lang.Object
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
(package private)  int hitCount
           
(package private)  int increment
           
(package private)  int lastOid
           
 SortCriteria originalSort
           
(package private)  java.util.Vector searchResults
           
(package private)  GenericFactoryBase theFactory
           
 QueryFilter theSearsh
           
 
Constructor Summary
DatabaseCursor(GenericFactoryBase theFactory, java.util.Vector hits, QueryFilter searsh, SortCriteria originalSort, int hit_count)
           
DatabaseCursor(GenericFactoryBase theFactory, java.util.Vector hits, QueryFilter searsh, SortCriteria originalSort, int hitCount, int increment)
          construct a database cursor which contains a Vector of all the items hit in the last search.
 
Method Summary
 int getHitCount()
           
 java.util.Vector getNextObjects(DatabaseSession dbSess)
           
 java.util.Vector getNextObjects(DatabaseSession dbSess, SortCriteria sc)
           
 java.util.Vector getObjects(DatabaseSession dbSess, int start, int count)
          a routine to get a sub-set of objects from the last query
 int getOidFromSearchResults(int i)
          Return the i-th Oid in the result of the cursor.
 void refreshSearch(DatabaseSession dbSess)
          a routine to refresh the cursor (in case of stale data)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

theFactory

GenericFactoryBase theFactory

lastOid

int lastOid

increment

int increment

theSearsh

public QueryFilter theSearsh

searchResults

java.util.Vector searchResults

hitCount

int hitCount

originalSort

public SortCriteria originalSort
Constructor Detail

DatabaseCursor

public DatabaseCursor(GenericFactoryBase theFactory,
                      java.util.Vector hits,
                      QueryFilter searsh,
                      SortCriteria originalSort,
                      int hitCount,
                      int increment)
construct a database cursor which contains a Vector of all the items hit in the last search.

Parameters:
theFactory - where further lookups should be directed
hits - a list of oids that corresponds to the hits
searsh - the query which produced this list (mostly for tracking)
increment - a default increment for the nextObjects method

DatabaseCursor

public DatabaseCursor(GenericFactoryBase theFactory,
                      java.util.Vector hits,
                      QueryFilter searsh,
                      SortCriteria originalSort,
                      int hit_count)
Method Detail

getOidFromSearchResults

public int getOidFromSearchResults(int i)
Return the i-th Oid in the result of the cursor. If the index "i" is out of range, then 0 is returned - which is not a valid oid.

Parameters:
i - index of the oid to retrieve
Returns:
the i-th oid, or 0 if the index is out of range

getHitCount

public int getHitCount()

refreshSearch

public void refreshSearch(DatabaseSession dbSess)
                   throws java.sql.SQLException
a routine to refresh the cursor (in case of stale data)

Parameters:
dbSess - a session to use..
java.sql.SQLException

getObjects

public java.util.Vector getObjects(DatabaseSession dbSess,
                                   int start,
                                   int count)
                            throws java.sql.SQLException
a routine to get a sub-set of objects from the last query

Parameters:
dbSess - the database Session
start - the initial index (the Java way 0 - (size-1))
count - the maximum number of items to be retrieved (less if not that many available)
Returns:
Vector of the objects returned from the Factory..
Throws:
java.sql.SQLException - if an error occurs while talking to the database

getNextObjects

public java.util.Vector getNextObjects(DatabaseSession dbSess)
                                throws java.sql.SQLException
java.sql.SQLException

getNextObjects

public java.util.Vector getNextObjects(DatabaseSession dbSess,
                                       SortCriteria sc)
                                throws java.sql.SQLException
java.sql.SQLException