toolbox.dao
Interface DaoWorker

Package class diagram package DaoWorker
All Known Implementing Classes:
DaoWorkerImpl

public interface DaoWorker

Defines an interface for developing a Data Access Object worker.

Implementations of this interface will provide functionality to populate and retrieve data from a defined data dictionary.


Method Summary
 void destroy()
          Destroy this worker.
 java.util.List executeCallForList(java.lang.String call, java.lang.Object[] params)
          Execute a stored procedure that will return a list of results.
 java.lang.Object[] executeCallForOutput(java.lang.String call, java.lang.Object[] params, java.lang.Object[] outParams, int paramOffSet)
          Execute a stored procedure that will return an array of registered output parameters.
 java.lang.Object executeCallForStatus(java.lang.String call, java.lang.Object[] params)
          Execute a stored procedure that will return the exit status of the procedure.
 java.util.List getAllEntries(java.lang.String tableName)
          Returns all entries from the named table.
 java.util.List getAllEntries(java.lang.String tableName, java.lang.Class returnType)
          Returns all entries from the named table.
 java.util.List getCustomEntries(java.lang.String query, java.lang.Object[] params)
          Executes a custom select statement.
 java.util.List getCustomEntries(java.lang.String query, java.lang.Object[] params, java.lang.Class returnType)
          Executes a custom select statement.
 java.util.List getCustomEntries(java.lang.String query, java.lang.Object[] params, java.lang.Class returnType, int max)
          Executes a custom select statement with a result size limit.
 java.util.List getCustomEntries(java.lang.String query, java.lang.Object[] params, int max)
          Executes a custom select statement with a result size limit.
 java.util.Map getEntryByPrimaryKey(java.lang.String tableName, java.util.Map pkValue)
          Returns an entry from the named table by its primary key.
 java.lang.Object getEntryByPrimaryKey(java.lang.String tableName, java.util.Map pkValue, java.lang.Class returnType)
          Returns an entry from the named table by its primary key.
 java.util.Map getEntryByPrimaryKey(java.lang.String tableName, java.lang.Object pkValue)
          Returns an entry from the named table by its primary key.
 java.lang.Object getEntryByPrimaryKey(java.lang.String tableName, java.lang.Object pkValue, java.lang.Class returnType)
          Return an entry from the named table by it's primary key.
 void init(java.util.Map stmnts, java.util.Map tableDefs, DaoManager manager)
          Initialise the worker with required data dictionary information.
 int insert(java.lang.String tableName, java.util.Map values)
          Inserts the given map of values into the named table.
 int insert(java.lang.String tableName, java.util.Map values, TransactionContext tc)
          Inserts the given map of values into the named table within the given transaction context.
 java.lang.Object insertAndReturnKey(java.lang.String tableName, java.util.Map values)
          Inserts the given map of values into the named table and returns auto-generated key.
 java.lang.Object insertAndReturnKey(java.lang.String tableName, java.util.Map values, TransactionContext tc)
          Inserts the given map of values into the named table and returns auto-generated key within the given transaction context.
 int removeCustomEntries(java.lang.String delete, java.lang.Object[] params)
          Executes a custom delete statement.
 int removeCustomEntries(java.lang.String delete, java.lang.Object[] params, TransactionContext tc)
          Executes a custom delete statement within the given transaction context.
 int removeEntryByPrimaryKey(java.lang.String tableName, java.util.Map pkValue)
          Removes an entry from the named table using the given primary key value.
 int removeEntryByPrimaryKey(java.lang.String tableName, java.util.Map pkValue, TransactionContext tc)
          Removes an entry from the named table using the given primary key value within the given transaction context.
 int removeEntryByPrimaryKey(java.lang.String tableName, java.lang.Object pkValue)
          Removes an entry from the named table using the given primary key value.
 int removeEntryByPrimaryKey(java.lang.String tableName, java.lang.Object pkValue, TransactionContext tc)
          Removes an entry from the named table using the given primary key value within the given transaction context.
 int update(java.lang.String tableName, java.util.Map values)
          Update the named table with the given map of values.
 int update(java.lang.String tableName, java.util.Map values, TransactionContext tc)
          Update the named table with the given map of values within the given transaction context.
 int updateCustomEntries(java.lang.String update, java.lang.Object[] params)
          Executes a custom update statement.
 int updateCustomEntries(java.lang.String update, java.lang.Object[] params, TransactionContext tc)
          Executes a custom update statement within the given transaction context.
 

Method Detail

init

void init(java.util.Map stmnts,
          java.util.Map tableDefs,
          DaoManager manager)
Initialise the worker with required data dictionary information.

Parameters:
stmnts - Map containing generated statements.
tableDefs - Map containing TableDefinitions.
manager - DaoManager that created this worker.

insert

int insert(java.lang.String tableName,
           java.util.Map values)
           throws DaoException
Inserts the given map of values into the named table.

Parameters:
tableName - Name of table to insert values into.
values - Map containig values to insert into the named table.
Returns:
Return the insert count as an int.
Throws:
DaoException - if a database access exception occurs.

insert

int insert(java.lang.String tableName,
           java.util.Map values,
           TransactionContext tc)
           throws DaoException
Inserts the given map of values into the named table within the given transaction context.

Parameters:
tableName - Name of table to insert values into.
values - Map containig values to insert into the named table.
tc - Current transaction context.
Returns:
Return the insert count as an int.
Throws:
DaoException - if a database access exception occurs.

insertAndReturnKey

java.lang.Object insertAndReturnKey(java.lang.String tableName,
                                    java.util.Map values)
                                    throws DaoException
Inserts the given map of values into the named table and returns auto-generated key.

Parameters:
tableName - Name of table to insert values into.
values - Map containig values to insert into the named table.
Returns:
Object containing an auto-generated key.
Throws:
DaoException - if a database access exception occurs.

insertAndReturnKey

java.lang.Object insertAndReturnKey(java.lang.String tableName,
                                    java.util.Map values,
                                    TransactionContext tc)
                                    throws DaoException
Inserts the given map of values into the named table and returns auto-generated key within the given transaction context.

Parameters:
tableName - Name of table to insert values into.
values - Map containig values to insert into the named table.
tc - Current transaction context.
Returns:
Object containing an auto-generated key.
Throws:
DaoException - if a database access exception occurs.

update

int update(java.lang.String tableName,
           java.util.Map values)
           throws DaoException
Update the named table with the given map of values.

Parameters:
tableName - Name of table to insert values into.
values - Map containing update values.
Returns:
Return the update count as an int.
Throws:
DaoException - if a database access exception occurs.

update

int update(java.lang.String tableName,
           java.util.Map values,
           TransactionContext tc)
           throws DaoException
Update the named table with the given map of values within the given transaction context.

Parameters:
tableName - Name of table to insert values into.
values - Map containing update values.
tc - Current transaction context.
Returns:
Return the update count as an int.
Throws:
DaoException - if a database access exception occurs.

getEntryByPrimaryKey

java.util.Map getEntryByPrimaryKey(java.lang.String tableName,
                                   java.lang.Object pkValue)
                                   throws DaoException
Returns an entry from the named table by its primary key.

Parameters:
tableName - Name of table that contains target entry
pkValue - Object containing primary key value.
Returns:
Map containing target entry or null if the entry does not exist.
Throws:
DaoException - if an exception occurs while accessing the database

getEntryByPrimaryKey

java.lang.Object getEntryByPrimaryKey(java.lang.String tableName,
                                      java.lang.Object pkValue,
                                      java.lang.Class returnType)
                                      throws DaoException
Return an entry from the named table by it's primary key.

The returned entry will be wrapped in the specified return type.

Parameters:
tableName - Name of table that contains target entry.
pkValue - Object containing primary key value.
returnType - Class denoting the return type.
Returns:
Object of specified return type.
Throws:
DaoException - if an exception occurs while accessing the database

getEntryByPrimaryKey

java.util.Map getEntryByPrimaryKey(java.lang.String tableName,
                                   java.util.Map pkValue)
                                   throws DaoException
Returns an entry from the named table by its primary key.

Parameters:
tableName - Name of table that contains target entry
pkValue - Map containing primary key value.
Returns:
Map containing target entry or null if the entry does not exist.
Throws:
DaoException - if an exception occurs while accessing the database

getEntryByPrimaryKey

java.lang.Object getEntryByPrimaryKey(java.lang.String tableName,
                                      java.util.Map pkValue,
                                      java.lang.Class returnType)
                                      throws DaoException
Returns an entry from the named table by its primary key.

The returned entry will be wrapped in the specified return type.

Parameters:
tableName - Name of table that contains target entry
pkValue - Map containing primary key value.
returnType - Class denoting the return type.
Returns:
Object containing target entry or null if the entry does not exist.
Throws:
DaoException - if an exception occurs while accessing the database

removeEntryByPrimaryKey

int removeEntryByPrimaryKey(java.lang.String tableName,
                            java.lang.Object pkValue)
                            throws DaoException
Removes an entry from the named table using the given primary key value.

Parameters:
tableName - Name of table that contains target entry.
pkValue - Object containing primary key value.
Returns:
Return the delete count as an int.
Throws:
DaoException - if an exception occurs while accessing the database

removeEntryByPrimaryKey

int removeEntryByPrimaryKey(java.lang.String tableName,
                            java.lang.Object pkValue,
                            TransactionContext tc)
                            throws DaoException
Removes an entry from the named table using the given primary key value within the given transaction context.

Parameters:
tableName - Name of table that contains target entry.
pkValue - Object containing primary key value.
tc - Current transaction context.
Returns:
Return the delete count as an int.
Throws:
DaoException - if an exception occurs while accessing the database

removeEntryByPrimaryKey

int removeEntryByPrimaryKey(java.lang.String tableName,
                            java.util.Map pkValue)
                            throws DaoException
Removes an entry from the named table using the given primary key value.

Parameters:
tableName - Name of table that contains target entry.
pkValue - Map containing primary key value.
Returns:
Return the delete count as an int.
Throws:
DaoException - if an exception occurs while accessing the database

removeEntryByPrimaryKey

int removeEntryByPrimaryKey(java.lang.String tableName,
                            java.util.Map pkValue,
                            TransactionContext tc)
                            throws DaoException
Removes an entry from the named table using the given primary key value within the given transaction context.

Parameters:
tableName - Name of table that contains target entry.
pkValue - Map containing primary key value.
tc - Current transaction context.
Returns:
Return the delete count as an int.
Throws:
DaoException - if an exception occurs while accessing the database

getAllEntries

java.util.List getAllEntries(java.lang.String tableName)
                             throws DaoException
Returns all entries from the named table.

Parameters:
tableName - Name of table.
Returns:
List containing all entries.
Throws:
DaoException - if an exception occurs while accessing the database

getAllEntries

java.util.List getAllEntries(java.lang.String tableName,
                             java.lang.Class returnType)
                             throws DaoException
Returns all entries from the named table.

The returned entries will be wrapped in the specified return type.

Parameters:
tableName - Name of table.
returnType - Class denoting the specified return type.
Returns:
List containing all entries.
Throws:
DaoException - if an exception occurs while accessing the database

executeCallForStatus

java.lang.Object executeCallForStatus(java.lang.String call,
                                      java.lang.Object[] params)
                                      throws DaoException
Execute a stored procedure that will return the exit status of the procedure.

Parameters:
call - String containing procedure call.
params - Object array containing procedure parameters.
Returns:
Object containing the return status.
Throws:
DaoException - if an exception occurs while executing the procedure.

executeCallForOutput

java.lang.Object[] executeCallForOutput(java.lang.String call,
                                        java.lang.Object[] params,
                                        java.lang.Object[] outParams,
                                        int paramOffSet)
                                        throws DaoException
Execute a stored procedure that will return an array of registered output parameters.

Parameters:
call - String containing procedure call.
params - Object array containing procedure parameters.
outParams - Object array containing output parameters.
paramOffSet - Offset where output parameters start.
Returns:
Object arrat containing the output parameter values.
Throws:
DaoException - if an exception occurs while executing the procedure.

executeCallForList

java.util.List executeCallForList(java.lang.String call,
                                  java.lang.Object[] params)
                                  throws DaoException
Execute a stored procedure that will return a list of results.

Parameters:
call - String containing procedure call.
params - Object array containing procedure parameters.
Returns:
List containing procedure output.
Throws:
DaoException - if an exception occurs while executing the procedure.

getCustomEntries

java.util.List getCustomEntries(java.lang.String query,
                                java.lang.Object[] params)
                                throws DaoException
Executes a custom select statement.

Parameters:
query - Custom query to execute.
params - Parameters for query.
Returns:
List containing query results.
Throws:
DaoException - if the custom query cannot be executed.

getCustomEntries

java.util.List getCustomEntries(java.lang.String query,
                                java.lang.Object[] params,
                                java.lang.Class returnType)
                                throws DaoException
Executes a custom select statement.

The returned entries will be wrapped in the specified return type.

Parameters:
query - Custom query to execute.
params - Parameters for query.
returnType - Class denoting the return type.
Returns:
List containing query results.
Throws:
DaoException - if the custom query cannot be executed.

getCustomEntries

java.util.List getCustomEntries(java.lang.String query,
                                java.lang.Object[] params,
                                int max)
                                throws DaoException
Executes a custom select statement with a result size limit.

Parameters:
query - Custom query to execute.
params - Parameters for query.
max - Maximum number entries that may be returned.
Returns:
List containing query results.
Throws:
DaoException - if the custom query cannot be executed.

getCustomEntries

java.util.List getCustomEntries(java.lang.String query,
                                java.lang.Object[] params,
                                java.lang.Class returnType,
                                int max)
                                throws DaoException
Executes a custom select statement with a result size limit.

The returned entries will be wrapped in the specified return type.

Parameters:
query - Custom query to execute.
params - Parameters for query.
returnType - Class denoting the return type.
max - Maximum number entries that may be returned.
Returns:
List containing query results.
Throws:
DaoException - if the custom query cannot be executed.

updateCustomEntries

int updateCustomEntries(java.lang.String update,
                        java.lang.Object[] params)
                        throws DaoException
Executes a custom update statement.

Parameters:
update - Custom update statement.
params - Parameters for update.
Returns:
Return the update count as an int.
Throws:
DaoException - if update cannot be executed.

updateCustomEntries

int updateCustomEntries(java.lang.String update,
                        java.lang.Object[] params,
                        TransactionContext tc)
                        throws DaoException
Executes a custom update statement within the given transaction context.

Parameters:
update - Custom update statement.
params - Parameters for update.
tc - Current transaction context.
Returns:
Return the update count as an int.
Throws:
DaoException - if update cannot be executed.

removeCustomEntries

int removeCustomEntries(java.lang.String delete,
                        java.lang.Object[] params)
                        throws DaoException
Executes a custom delete statement.

Parameters:
delete - Custom delete statement.
params - Parameters for delete statement.
Returns:
Return the delete count as an int.
Throws:
DaoException - if delete cannot be executed.

removeCustomEntries

int removeCustomEntries(java.lang.String delete,
                        java.lang.Object[] params,
                        TransactionContext tc)
                        throws DaoException
Executes a custom delete statement within the given transaction context.

Parameters:
delete - Custom delete statement.
params - Parameters for delete statement.
tc - Current transaction context.
Returns:
Return the delete count as an int.
Throws:
DaoException - if delete cannot be executed.

destroy

void destroy()
Destroy this worker.