Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.questionnaire.bean
Class SimpleQuestion  view SimpleQuestion download SimpleQuestion.java

java.lang.Object
  extended bycom.RuntimeCollective.questionnaire.bean.SimpleQuestion
All Implemented Interfaces:
com.RuntimeCollective.webapps.bean.EntityBean, Question, java.io.Serializable
Direct Known Subclasses:
XInManyStringsQuestion

public abstract class SimpleQuestion
extends java.lang.Object
implements Question

Basic and incomplete implementation of the Question interface, which you can subclass at will to create new types of Questions.
In your sub classes, you should define some Fields to store the possible answers (*not* Answers), and override isAnswerValid and makeNewAnswer, and (most probably) save, delete and the 2 usual constructors.

Version:
$Id: SimpleQuestion.java,v 1.9 2003/09/30 15:12:53 joe Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
protected  java.lang.String Description
          The Description of this SimpleQuestion
protected  int id
          This object's id
protected  java.lang.String Name
          The Name of this SimpleQuestion
protected  int QuestionnaireId
          The Questionnaire
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
SimpleQuestion()
          Construct a new blank SimpleQuestion, giving it a new unique ID.
SimpleQuestion(int id)
          Get a current SimpleQuestion from the RuntimeDataSource, given an id.
 
Method Summary
 void delete()
          Delete this bean from the database.
 java.lang.String getDescription()
          Get the Description of this SimpleQuestion
 int getId()
          Get the unique id of this bean instance.
 java.lang.String getName()
          Get the Name of this SimpleQuestion
 Questionnaire getQuestionnaire()
          Get the Questionnaire of this Question
abstract  boolean isAnswerValid(java.lang.Object answer)
          Check the validity of a raw Object answer for this Question.
abstract  Answer makeNewAnswer(java.lang.Object answer)
          Make a new Answer to this Question, based on a row answer Object.
 void save()
          Save this bean to the database.
 void setDescription(java.lang.String description)
          Set the Description of this SimpleQuestion
 void setId(int id)
          Set the unique id of this bean instance.
 void setName(java.lang.String name)
          Set the Name of this SimpleQuestion
 void setQuestionnaire(Questionnaire questionnaire)
          Set the Questionnaire of this Question
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

id

protected int id
This object's id


Name

protected java.lang.String Name
The Name of this SimpleQuestion


Description

protected java.lang.String Description
The Description of this SimpleQuestion


QuestionnaireId

protected int QuestionnaireId
The Questionnaire

Constructor Detail

SimpleQuestion

public SimpleQuestion()
Construct a new blank SimpleQuestion, giving it a new unique ID.


SimpleQuestion

public SimpleQuestion(int id)
Get a current SimpleQuestion from the RuntimeDataSource, given an id.

Method Detail

setId

public void setId(int id)
Set the unique id of this bean instance.

Specified by:
setId in interface Question

getId

public int getId()
Get the unique id of this bean instance.

Specified by:
getId in interface Question

save

public void save()
Save this bean to the database.

Specified by:
save in interface Question

delete

public void delete()
Delete this bean from the database.

Specified by:
delete in interface Question

setName

public void setName(java.lang.String name)
Set the Name of this SimpleQuestion

Specified by:
setName in interface Question

getName

public java.lang.String getName()
Get the Name of this SimpleQuestion

Specified by:
getName in interface Question

setDescription

public void setDescription(java.lang.String description)
Set the Description of this SimpleQuestion

Specified by:
setDescription in interface Question

getDescription

public java.lang.String getDescription()
Get the Description of this SimpleQuestion

Specified by:
getDescription in interface Question

setQuestionnaire

public void setQuestionnaire(Questionnaire questionnaire)
Set the Questionnaire of this Question

Specified by:
setQuestionnaire in interface Question

getQuestionnaire

public Questionnaire getQuestionnaire()
Get the Questionnaire of this Question

Specified by:
getQuestionnaire in interface Question

makeNewAnswer

public abstract Answer makeNewAnswer(java.lang.Object answer)
                              throws com.RuntimeCollective.questionnaire.InvalidAnswerException
Make a new Answer to this Question, based on a row answer Object.
This checks the validity of the raw Object answer.

Specified by:
makeNewAnswer in interface Question

isAnswerValid

public abstract boolean isAnswerValid(java.lang.Object answer)
Check the validity of a raw Object answer for this Question.

Specified by:
isAnswerValid in interface Question