com.heckmansoft.surjey.model.datastore
Class QuestionDatastore

java.lang.Object
  extended bycom.heckmansoft.surjey.model.datastore.Datastore
      extended bycom.heckmansoft.surjey.model.datastore.QuestionDatastore
Direct Known Subclasses:
QuestionManager

public class QuestionDatastore
extends Datastore

Manages object-relational mapping for Question objects.


Constructor Summary
QuestionDatastore()
          Constructor.
 
Method Summary
protected  Question createQuestion()
          Create a new question.
protected  ValueObject extract(java.sql.ResultSet results)
          Extract an object from the given result set.
 Question findById(java.lang.String id)
          Finds a particular question.
 ValueObjectList findBySectionId(java.lang.String id)
          Finds all questions for a particular section.
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 removeBySectionId(java.lang.String id)
          Removes all questions for a given section.
 
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

QuestionDatastore

public QuestionDatastore()
Constructor.

Method Detail

findById

public Question 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

findBySectionId

public ValueObjectList findBySectionId(java.lang.String id)
                                throws DatastoreException
Finds all questions for a particular section.

Parameters:
id - Id of the section containing the questions to find.
Returns:
A list of matching Question instances
Throws:
DatastoreException

removeBySectionId

public boolean removeBySectionId(java.lang.String id)
                          throws DatastoreException
Removes all questions for a given section.

Parameters:
id - Id of section for which sections are to be removed.
Returns:
true if all matching questions are 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

createQuestion

protected Question createQuestion()
Create a new question.

Returns:
newly created question.