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

Quick Search    Search Deep

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

java.lang.Object
  extended bycom.RuntimeCollective.questionnaire.bean.UserAnswers
All Implemented Interfaces:
com.RuntimeCollective.webapps.bean.EntityBean, java.io.Serializable

public class UserAnswers
extends java.lang.Object
implements com.RuntimeCollective.webapps.bean.EntityBean

The UserAnswers class, which is basically a set of Answers given by a User to a Questionnaire.

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

Field Summary
static java.lang.String ANSWER_TABLE
           
protected  java.util.Date AnswerDate
          The AnswerDate
protected  int AnsweredQuestionnaireId
          The AnsweredQuestionnaire
protected  int AnsweringUserId
          The AnsweringUser
(package private)  java.util.ArrayList Answers
          The Answers
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
protected  int id
          This object's id
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
UserAnswers()
          Construct a new blank UserAnswers, giving it a new unique ID.
UserAnswers(int id)
          Get a current UserAnswers from the RuntimeDataSource, given an id.
 
Method Summary
 void addAnswer(Answer answer)
          Add an Answer to this UserAnswers
 void addAnswer(int questionIndex, java.lang.Object answer)
          Register a new Answer in this UserAnswers, for the question whose index/position is given, with a given Object answer.
 void delete()
          Delete this bean from the database.
 void deleteWithAnswers()
          Delete the UserAnswers and all the Answers.
 Answer getAnswer(int position)
          Get an Answer from this UserAnswers
 java.util.Date getAnswerDate()
          Get the AnswerDate
 Questionnaire getAnsweredQuestionnaire()
          Get the AnsweredQuestionnaire
 com.RuntimeCollective.webapps.bean.User getAnsweringUser()
          Get the AnsweringUser
 java.util.Iterator getAnswers()
          Get all Answers from this UserAnswers
 int getId()
          Get the unique id of this bean instance.
 int getIndexOfAnswer(Answer answer)
          Get the (first) index of a Answer in this UserAnswers
 void removeAnswer(Answer answer)
          Remove an Answer from this UserAnswers
 void save()
          Save this bean to the database.
 void setAnswer(int position, Answer answer)
          Set an Answer in this UserAnswers
 void setAnswerDate(java.util.Date date)
          Set the AnswerDate
 void setAnsweredQuestionnaire(Questionnaire questionnaire)
          Set the AnsweredQuestionnaire
 void setAnsweringUser(com.RuntimeCollective.webapps.bean.User user)
          Set the AnsweringUser
 void setId(int id)
          Set the unique id of this bean instance.
 
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

ANSWER_TABLE

public static final java.lang.String ANSWER_TABLE
See Also:
Constant Field Values

id

protected int id
This object's id


AnsweringUserId

protected int AnsweringUserId
The AnsweringUser


AnsweredQuestionnaireId

protected int AnsweredQuestionnaireId
The AnsweredQuestionnaire


AnswerDate

protected java.util.Date AnswerDate
The AnswerDate


Answers

java.util.ArrayList Answers
The Answers

Constructor Detail

UserAnswers

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


UserAnswers

public UserAnswers(int id)
Get a current UserAnswers 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 com.RuntimeCollective.webapps.bean.EntityBean

getId

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

Specified by:
getId in interface com.RuntimeCollective.webapps.bean.EntityBean

save

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

Specified by:
save in interface com.RuntimeCollective.webapps.bean.EntityBean

delete

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

Specified by:
delete in interface com.RuntimeCollective.webapps.bean.EntityBean

deleteWithAnswers

public void deleteWithAnswers()
Delete the UserAnswers and all the Answers. This calls ebs.delete on itself.


setAnsweringUser

public void setAnsweringUser(com.RuntimeCollective.webapps.bean.User user)
Set the AnsweringUser


getAnsweringUser

public com.RuntimeCollective.webapps.bean.User getAnsweringUser()
Get the AnsweringUser


setAnsweredQuestionnaire

public void setAnsweredQuestionnaire(Questionnaire questionnaire)
Set the AnsweredQuestionnaire


getAnsweredQuestionnaire

public Questionnaire getAnsweredQuestionnaire()
Get the AnsweredQuestionnaire


setAnswerDate

public void setAnswerDate(java.util.Date date)
Set the AnswerDate


getAnswerDate

public java.util.Date getAnswerDate()
Get the AnswerDate


addAnswer

public void addAnswer(Answer answer)
Add an Answer to this UserAnswers


removeAnswer

public void removeAnswer(Answer answer)
Remove an Answer from this UserAnswers


getAnswer

public Answer getAnswer(int position)
Get an Answer from this UserAnswers


setAnswer

public void setAnswer(int position,
                      Answer answer)
Set an Answer in this UserAnswers


getIndexOfAnswer

public int getIndexOfAnswer(Answer answer)
Get the (first) index of a Answer in this UserAnswers


getAnswers

public java.util.Iterator getAnswers()
Get all Answers from this UserAnswers


addAnswer

public void addAnswer(int questionIndex,
                      java.lang.Object answer)
               throws com.RuntimeCollective.questionnaire.InvalidAnswerException
Register a new Answer in this UserAnswers, for the question whose index/position is given, with a given Object answer.
This will find the question, ask it to create a new Answer, and save it.