|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.heckmansoft.surjey.model.datastore.Datastore
Manages object-relational mapping for ValueObject objects.
| Constructor Summary | |
Datastore(java.lang.String tableName,
java.lang.String addTableFields)
Constructor. |
|
| Method Summary | |
protected boolean |
executeDelete(java.lang.String id)
Populate and execute the prepared delete statement. |
protected boolean |
executeInsert(ValueObject vo)
Populate and execute the prepared insert statement. |
protected boolean |
executeUpdate(ValueObject vo)
Populate and execute the prepared update statement. |
protected ValueObject |
extract(java.sql.ResultSet results)
Extract an object from the given result set. |
protected ValueObject |
extract(java.sql.ResultSet results,
ValueObject vo)
Populate a given object using the given result set. |
protected ValueObjectList |
extractList(java.sql.ResultSet results)
Extract a list of objects from a given result set. |
protected ValueObject |
extractSingle(java.sql.ResultSet results)
Extract an object from the given result set. |
ValueObjectList |
findAll()
Finds all objects managed in this datastore. |
protected java.lang.String |
generateDeleteSQL(java.lang.String whereClause)
Generate an SQL delete statement. |
protected java.lang.String |
generateInsertSQL()
Generate an SQL insert statement. |
protected java.lang.String |
generateSelectSQL(java.lang.String whereClause)
Generate an SQL select statement. |
protected java.lang.String |
generateUpdateSQL(java.lang.String whereClause)
Generate an SQL update statement. |
protected java.util.List |
getArgs(ValueObject vo)
From the given object, get a list of arguments to use for constructing a query or update. |
java.sql.Connection |
getConnection()
Get the current connection. |
Transaction |
getTransaction()
Get the current transaction. |
boolean |
insert(ValueObject vo)
Store an object. |
boolean |
insert(ValueObjectList vos)
Store a list of objects. |
protected void |
populateStatement(java.util.List args)
Populate the current prepared statement, using given args. |
boolean |
remove(java.lang.String id)
Remove a stored object with given id. |
boolean |
remove(ValueObject vo)
Remove a stored object. |
boolean |
remove(ValueObjectList vos)
Remove a list of stored objects. |
protected java.sql.ResultSet |
selectAll()
Finds all objects for current table. |
protected java.sql.ResultSet |
selectById(java.lang.String id)
Finds a particular object by its id in the current table. |
protected java.sql.ResultSet |
selectWhere(java.lang.String whereClause,
java.util.List args)
Finds all objects in the current table matching a given set of criteria. |
boolean |
update(ValueObject vo)
Updates a given object that has been stored previously. |
boolean |
update(ValueObjectList vos)
Updates a list of objects that have been stored previously. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public Datastore(java.lang.String tableName,
java.lang.String addTableFields)
tableName - The table being serviced by this datastore.addTableFields - A comma delimited string of additional fields.| Method Detail |
public java.sql.Connection getConnection()
throws DatastoreException
DatastoreException
public Transaction getTransaction()
throws DatastoreException
DatastoreException
public ValueObjectList findAll()
throws DatastoreException
DatastoreException
public boolean insert(ValueObject vo)
throws DatastoreException
vo - The object to be stored.
DatastoreException
public boolean insert(ValueObjectList vos)
throws DatastoreException
vos - A list of objects.
DatastoreException
public boolean update(ValueObject vo)
throws DatastoreException
vo - The object that has been updated.
DatastoreException
public boolean update(ValueObjectList vos)
throws DatastoreException
vos - A list of updated value objects.
DatastoreException
public boolean remove(ValueObject vo)
throws DatastoreException
vo - Object to be removed.
DatastoreException
public boolean remove(java.lang.String id)
throws DatastoreException
id - Id of object to be removed.
DatastoreException
public boolean remove(ValueObjectList vos)
throws DatastoreException
vos - A list of objects to be removed.
DatastoreException
protected java.sql.ResultSet selectAll()
throws DatastoreException
DatastoreException
protected java.sql.ResultSet selectById(java.lang.String id)
throws DatastoreException
id - the id of the object to find.
DatastoreException
protected java.sql.ResultSet selectWhere(java.lang.String whereClause,
java.util.List args)
throws DatastoreException
whereClause - The SQL where clause to use.args - Array of Integers or Strings, with which to
populate the where clause.
DatastoreException
protected boolean executeInsert(ValueObject vo)
throws DatastoreException
vo - The value object to use to populate the insert statement.
java.sql.SQLException
DatastoreException
protected boolean executeUpdate(ValueObject vo)
throws DatastoreException
vo - The value object to use to populate the update statement.
java.sql.SQLException
DatastoreException
protected boolean executeDelete(java.lang.String id)
throws DatastoreException
id - The id to use in populating the statement.
java.sql.SQLException
DatastoreExceptionprotected java.lang.String generateSelectSQL(java.lang.String whereClause)
whereClause - Optional where clause to add to statement.
protected java.lang.String generateInsertSQL()
protected java.lang.String generateUpdateSQL(java.lang.String whereClause)
whereClause - Optional where clause to add to statement.
protected java.lang.String generateDeleteSQL(java.lang.String whereClause)
whereClause - Optional where clause to add to statement.
protected void populateStatement(java.util.List args)
throws DatastoreException
args - An array of Integers and Strings
java.sql.SQLException
DatastoreException
protected ValueObjectList extractList(java.sql.ResultSet results)
throws DatastoreException
results - The result set.
DatastoreException
protected ValueObject extractSingle(java.sql.ResultSet results)
throws DatastoreException
results - The result set.
DatastoreException
protected ValueObject extract(java.sql.ResultSet results,
ValueObject vo)
throws DatastoreException
results - The result set.vo - An object to populate.
DatastoreExceptionprotected java.util.List getArgs(ValueObject vo)
vo - Object containing data to use.
protected ValueObject extract(java.sql.ResultSet results)
throws DatastoreException
results - The result set.
DatastoreException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||