org.rimudb
Class AbstractFinder

java.lang.Object
  extended by org.rimudb.AbstractFinder

public class AbstractFinder
extends java.lang.Object

Base class for Finders.

Author:
Simon Ritchie

Field Summary
static int ALL_RECORDS
           
protected  Table table
           
 
Constructor Summary
protected AbstractFinder()
           
  AbstractFinder(CompoundDatabase compoundDatabase, java.lang.Class<? extends DataObject> dataObjectClass)
          Construct a Finder.
  AbstractFinder(Database database, java.lang.Class<? extends DataObject> dataObjectClass)
          Construct a Finder.
 
Method Summary
 int deleteAll()
          Delete all of the records in the table.
 int deleteAll(KeyList keylist)
          Deprecated. Use DeleteAll(WhereList) instead
 int deleteAll(WhereList whereList)
          Delete all of the records matching the WhereList.
 int deleteAllUsingTransaction(Session session, KeyList keylist)
          Deprecated. Use deleteAllUsingTransaction(Session, WhereList) instead
 int deleteAllUsingTransaction(Session session, WhereList whereList)
          Delete all of the records matching the WhereList within a session.
 int deleteByPrimaryKey(KeyList primaryKeyList)
          Deprecated. Use deleteByPrimaryKey(WhereList) instead
 int deleteByPrimaryKey(WhereList primaryWhereList)
          Delete the record that matches the values in the primaryWhereList.
 DataObject find(KeyList primaryKeyList, Lock lockType)
          Deprecated. Use find(WhereList primaryWhereList, Lock lockType) instead
 DataObject find(WhereList primaryWhereList, Lock lockType)
          Read the database table and return the data object that matches the primary WhereList.
 Database getDatabase()
          Returns the database.
 int getRecordCount()
          Return the number of records in the table.
 int getRecordCount(KeyList keyList)
          Deprecated. Use getRecordCount(WhereList) instead
 int getRecordCount(WhereList whereList)
          Return the count of records that match the WhereList.
protected  Table getTable()
           
 java.util.List<? extends DataObject> selectAsList(WhereList whereList, OrderByList orderByList, int maxRecords)
          Read the database and return a List of data objects that match the criteria of the WhereList and are sorted in the order of the OrderByList.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ALL_RECORDS

public static final int ALL_RECORDS
See Also:
Constant Field Values

table

protected Table table
Constructor Detail

AbstractFinder

protected AbstractFinder()

AbstractFinder

public AbstractFinder(Database database,
                      java.lang.Class<? extends DataObject> dataObjectClass)
               throws RimuDBException
Construct a Finder.

Parameters:
database - Database
dataObjectClass - Class
Throws:
RimuDBException

AbstractFinder

public AbstractFinder(CompoundDatabase compoundDatabase,
                      java.lang.Class<? extends DataObject> dataObjectClass)
               throws RimuDBException
Construct a Finder.

Parameters:
compoundDatabase - CompoundDatabase
dataObjectClass - Class
Throws:
RimuDBException
Method Detail

getTable

protected Table getTable()

getDatabase

public Database getDatabase()
Returns the database.

Returns:
Database

find

public DataObject find(WhereList primaryWhereList,
                       Lock lockType)
                throws RimuDBException
Read the database table and return the data object that matches the primary WhereList.

Parameters:
primaryWhereList - WhereList
lockType - Lock
Returns:
DataObject
Throws:
RimuDBException

find

@Deprecated
public DataObject find(KeyList primaryKeyList,
                                  Lock lockType)
                throws RimuDBException
Deprecated. Use find(WhereList primaryWhereList, Lock lockType) instead

Read the database and return the data object that matches the primary key list.

Parameters:
primaryKeyList -
lockType -
Returns:
DataObject
Throws:
RimuDBException

selectAsList

public java.util.List<? extends DataObject> selectAsList(WhereList whereList,
                                                         OrderByList orderByList,
                                                         int maxRecords)
                                                  throws RimuDBException
Read the database and return a List of data objects that match the criteria of the WhereList and are sorted in the order of the OrderByList. If maxRecords > 0 then the first maxRecords will be returned. If the parameter orderByList is a null or the special value OrderByList.PRIMARY_KEY, the SQL statement will use the primary keys for the ORDER BY clause. If the parameter orderByList is the special value OrderByList.NONE, the SQL statement will not include an ORDER BY clause. If the orderByList has no entries, it is treated the same as if the caller passed the special value OrderByList.NONE, which will result in no ORDER BY clause in the SQL statement. Specify the maximum number of records to be returned or use AbstractFinder.ALL_RECORDS to indicate that no maximum should be used.

Parameters:
whereList -
orderByList -
maxRecords -
Returns:
List
Throws:
RimuDBException

deleteByPrimaryKey

public int deleteByPrimaryKey(WhereList primaryWhereList)
                       throws RimuDBException
Delete the record that matches the values in the primaryWhereList. Returns the number of deleted records.

Parameters:
primaryWhereList - WhereList
Returns:
int The number of records deleted
Throws:
RimuDBException

deleteByPrimaryKey

@Deprecated
public int deleteByPrimaryKey(KeyList primaryKeyList)
                       throws RimuDBException
Deprecated. Use deleteByPrimaryKey(WhereList) instead

Delete the record that matches the values in the primaryKeyList. Returns the number of deleted records.

Parameters:
primaryKeyList - KeyList
Returns:
int The number of records deleted
Throws:
RimuDBException

deleteAll

public int deleteAll()
              throws RimuDBException
Delete all of the records in the table.

Returns:
int The number of records deleted
Throws:
RimuDBException

deleteAll

@Deprecated
public int deleteAll(KeyList keylist)
              throws RimuDBException
Deprecated. Use DeleteAll(WhereList) instead

Delete all of the records matching the keylist. Returns the number of deleted records.

Parameters:
keylist - KeyList
Returns:
int The number of records deleted
Throws:
RimuDBException

deleteAllUsingTransaction

@Deprecated
public int deleteAllUsingTransaction(Session session,
                                                KeyList keylist)
                              throws RimuDBException
Deprecated. Use deleteAllUsingTransaction(Session, WhereList) instead

Delete all of the records matching the KeyList within a session. Returns the number of deleted records.

Parameters:
session - Session
keylist - KeyList
Returns:
int The number of records deleted
Throws:
RimuDBException

deleteAllUsingTransaction

public int deleteAllUsingTransaction(Session session,
                                     WhereList whereList)
                              throws RimuDBException
Delete all of the records matching the WhereList within a session. Returns the number of deleted records.

Parameters:
session - Session
whereList - WhereList
Returns:
int The number of records deleted
Throws:
RimuDBException

getRecordCount

@Deprecated
public int getRecordCount(KeyList keyList)
                   throws RimuDBException
Deprecated. Use getRecordCount(WhereList) instead

Return the count of records that match the keyList.

Parameters:
keyList - KeyList
Returns:
int The count of records.
Throws:
RimuDBException

getRecordCount

public int getRecordCount(WhereList whereList)
                   throws RimuDBException
Return the count of records that match the WhereList.

Parameters:
whereList - WhereList
Returns:
int The count of records.
Throws:
RimuDBException

getRecordCount

public int getRecordCount()
                   throws RimuDBException
Return the number of records in the table.

Returns:
int The count of records
Throws:
RimuDBException

deleteAll

public int deleteAll(WhereList whereList)
              throws RimuDBException
Delete all of the records matching the WhereList. Returns the number of deleted records.

Parameters:
whereList - WhereList
Returns:
int The number of records deleted
Throws:
RimuDBException


Copyright © 2008-2011 Simon Ritchie. All Rights Reserved.