com.heckmansoft.surjey.model.datastore
Class ResponseAnswerDatastore

java.lang.Object
  extended bycom.heckmansoft.surjey.model.datastore.Datastore
      extended bycom.heckmansoft.surjey.model.datastore.ResponseAnswerDatastore

public class ResponseAnswerDatastore
extends Datastore

Manages object-relational mapping for ResponseAnswer objects.


Constructor Summary
ResponseAnswerDatastore()
          Constructor.
 
Method Summary
protected  ResponseAnswer createResponseAnswer()
          Create a new response.
protected  ValueObject extract(java.sql.ResultSet results)
          Extract an object from the given result set.
 ResponseAnswer findById(java.lang.String id)
          Finds a particular question.
 ValueObjectList findByResponseId(java.lang.String id)
          Finds all answers for a particular response.
protected  java.util.List getArgs(ValueObject vo)
          From the given object, get a list of arguments to use for constructing a query or update.
 boolean removeByResponseId(java.lang.String id)
          Removes all answers for given response id.
 
Methods inherited from class com.heckmansoft.surjey.model.datastore.Datastore
executeDelete, executeInsert, executeUpdate, extract, extractList, extractSingle, findAll, generateDeleteSQL, generateInsertSQL, generateSelectSQL, generateUpdateSQL, getConnection, getTransaction, insert, insert, populateStatement, remove, remove, remove, selectAll, selectById, selectWhere, update, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResponseAnswerDatastore

public ResponseAnswerDatastore()
Constructor.

Method Detail

findById

public ResponseAnswer findById(java.lang.String id)
                        throws DatastoreException
Finds a particular question.

Parameters:
id - the id of the question to find.
Returns:
A Question instance, or null if no match found
Throws:
DatastoreException

findByResponseId

public ValueObjectList findByResponseId(java.lang.String id)
                                 throws DatastoreException
Finds all answers for a particular response.

Parameters:
id - Id of the response containing the answers to find.
Returns:
A list of matching Answer instances
Throws:
DatastoreException

removeByResponseId

public boolean removeByResponseId(java.lang.String id)
                           throws DatastoreException
Removes all answers for given response id.

Parameters:
id - Id of answer to be removed.
Returns:
true if a matching answer is found and removed
Throws:
DatastoreException

getArgs

protected java.util.List getArgs(ValueObject vo)
From the given object, get a list of arguments to use for constructing a query or update.

Overrides:
getArgs in class Datastore
Parameters:
vo - Object containing data to use.
Returns:
A list of arguments.

extract

protected ValueObject extract(java.sql.ResultSet results)
                       throws DatastoreException
Extract an object from the given result set.

Overrides:
extract in class Datastore
Parameters:
results - The result set.
Returns:
The newly extracted object.
Throws:
DatastoreException

createResponseAnswer

protected ResponseAnswer createResponseAnswer()
Create a new response.

Returns:
newly created response.