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

Quick Search    Search Deep

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

java.lang.Object
  extended bycom.RuntimeCollective.questionnaire.bean.SimpleAnswer
All Implemented Interfaces:
Answer, com.RuntimeCollective.webapps.bean.EntityBean, java.io.Serializable
Direct Known Subclasses:
ManyStringAnswer, OneStringAnswer

public abstract class SimpleAnswer
extends java.lang.Object
implements Answer

Basic and incomplete implementation of the Answer interface, which you can subclass at will to create new types of Answers.
In your sub classes, you should define some Fields to store the actual answer content, and override setAnswerGiven and getAnswerGiven, and (most probably) save, delete and the 2 usual constructors.

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

Field Summary
protected  int AnsweredQuestionId
          The AnsweredQuestion
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
protected  int id
          This object's id
protected  int UserAnswersId
          The UserAnswers
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
SimpleAnswer()
          Construct a new blank SimpleAnswer, giving it a new unique ID.
SimpleAnswer(int id)
          Get a current SimpleAnswer from the RuntimeDataSource, given an id.
 
Method Summary
 void delete()
          Delete this bean from the database.
 Question getAnsweredQuestion()
          Get the AnsweredQuestion of this Answer
abstract  java.lang.Object getAnswerGiven()
          Get the AnswerGiven of this Answer
 int getId()
          Get the unique id of this bean instance.
 UserAnswers getUserAnswers()
          Get the UserAnswers of this Answer
 void save()
          Save this bean to the database.
 void setAnsweredQuestion(Question answeredQuestion)
          Set the AnsweredQuestion of this Answer
abstract  void setAnswerGiven(java.lang.Object answerGiven)
          Set the AnswerGiven of this Answer
 void setId(int id)
          Set the unique id of this bean instance.
 void setUserAnswers(UserAnswers userAnswers)
          Set the UserAnswers of this Answer
 
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


UserAnswersId

protected int UserAnswersId
The UserAnswers


AnsweredQuestionId

protected int AnsweredQuestionId
The AnsweredQuestion

Constructor Detail

SimpleAnswer

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


SimpleAnswer

public SimpleAnswer(int id)
Get a current SimpleAnswer 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 Answer

getId

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

Specified by:
getId in interface Answer

save

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

Specified by:
save in interface Answer

delete

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

Specified by:
delete in interface Answer

setUserAnswers

public void setUserAnswers(UserAnswers userAnswers)
Set the UserAnswers of this Answer

Specified by:
setUserAnswers in interface Answer

getUserAnswers

public UserAnswers getUserAnswers()
Get the UserAnswers of this Answer

Specified by:
getUserAnswers in interface Answer

setAnsweredQuestion

public void setAnsweredQuestion(Question answeredQuestion)
Set the AnsweredQuestion of this Answer

Specified by:
setAnsweredQuestion in interface Answer

getAnsweredQuestion

public Question getAnsweredQuestion()
Get the AnsweredQuestion of this Answer

Specified by:
getAnsweredQuestion in interface Answer

setAnswerGiven

public abstract void setAnswerGiven(java.lang.Object answerGiven)
                             throws com.RuntimeCollective.questionnaire.InvalidAnswerException
Set the AnswerGiven of this Answer

Specified by:
setAnswerGiven in interface Answer

getAnswerGiven

public abstract java.lang.Object getAnswerGiven()
Get the AnswerGiven of this Answer

Specified by:
getAnswerGiven in interface Answer