net.sourceforge.jsurveyor
Class Questionnaire

java.lang.Object
  extended bynet.sourceforge.jsurveyor.Questionnaire

public class Questionnaire
extends java.lang.Object

Class to model questionnaires. The main responsibility for this class it to handle which usergroups are allowed to answer it, along with a list of the pages in the questionnaire.

Version:
1.0
Author:
Claus Methmann Christensen, Anders Spliid Hansen, Esben Iversen Hansen, Lars H Jensen, Marcus Overheu, Thomas Ramdal, Peter Thomsen

Constructor Summary
Questionnaire()
          Constructor for Questionnaire
Questionnaire(int questionnaireID, java.lang.String owner, java.lang.String questionnaireName, boolean state, java.util.ArrayList refUserGroups, java.util.ArrayList refQuestionPages, java.lang.String introText)
          Constructor for Questionnaire, use through DataAccess.
Questionnaire(java.lang.String owner)
          Constructor for Questionnaire
Questionnaire(java.lang.String owner, java.lang.String questionnaireName)
          Constructor for Questionnaire
 
Method Summary
 void addQuestionPage(QuestionPage questionPage)
          Adds a page of questions to the Questionnaire
 void addQuestionPageAtPosition(QuestionPage questionPage, int position)
          Adds a page of questions at a specific position in the Questionnaire.
 void addUserGroup(UserGroup userGroup)
          Adds a UserGroup and hereby allowing them to answer this Questionnaire
 java.lang.String getIntroText()
          Returns the intro text of the questionnaire.
 java.lang.String getOwner()
          Returns the owner of the questionnaire.
 int getQuestionnaireID()
          Returns the id of the questionnaire.
 java.lang.String getQuestionnaireName()
          Returns the name of the questionnaire.
 java.util.ArrayList getRefQuestionPages()
          Returns an ArrayList with toString representations of the added questionPages.
 java.util.ArrayList getRefUserGroups()
          Returns an ArrayList with toString representations of the userGroups that are allowed to answer the questionnaire.
 boolean getState()
          Returns whether or not the questionnaire is active.
 void removeQuestionPage(QuestionPage questionPage)
          Removes a page of questions from the Questionnaire.
 void removeUserGroup(UserGroup userGroup)
          Removes a usergroup from the Questionnaire, so that they no longer can answer it.
 void setActive()
          Activates the Questionnaire
 void setInactive()
          Deactivates the Questionnaire
 void setIntroText(java.lang.String introText)
          Sets an intro text for the questionnaire.
 void setOwner(java.lang.String owner)
          Sets the owner of the questionnaire.
 void setQuestionnaireID(int questionnaireIDInput)
          Sets an ID for the questionnaire
 void setQuestionnaireName(java.lang.String questionnaireName)
          Sets a name for the questionnaire.
 java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Questionnaire

public Questionnaire()
Constructor for Questionnaire


Questionnaire

public Questionnaire(java.lang.String owner)
Constructor for Questionnaire

Parameters:
owner - String

Questionnaire

public Questionnaire(java.lang.String owner,
                     java.lang.String questionnaireName)
Constructor for Questionnaire

Parameters:
owner - String
questionnaireName - String

Questionnaire

public Questionnaire(int questionnaireID,
                     java.lang.String owner,
                     java.lang.String questionnaireName,
                     boolean state,
                     java.util.ArrayList refUserGroups,
                     java.util.ArrayList refQuestionPages,
                     java.lang.String introText)
Constructor for Questionnaire, use through DataAccess.

Parameters:
questionnaireID - int
owner - String
questionnaireName - String
state - boolean
refUserGroups - ArrayList
refQuestionPages - ArrayList
introText - String
Method Detail

addUserGroup

public void addUserGroup(UserGroup userGroup)
Adds a UserGroup and hereby allowing them to answer this Questionnaire

Parameters:
userGroup - UserGroup
PRE condition:
the usergroup is not already added.

removeUserGroup

public void removeUserGroup(UserGroup userGroup)
Removes a usergroup from the Questionnaire, so that they no longer can answer it.

Parameters:
userGroup - UserGroup
PRE condition:
the usergroup is added

addQuestionPage

public void addQuestionPage(QuestionPage questionPage)
Adds a page of questions to the Questionnaire

Parameters:
questionPage - QuestionPage
PRE condition:
the questionPage is not already added., the questionnaire is inactive

addQuestionPageAtPosition

public void addQuestionPageAtPosition(QuestionPage questionPage,
                                      int position)
Adds a page of questions at a specific position in the Questionnaire.

Parameters:
questionPage - QuestionPage
position - int
PRE condition:
the questionPage is not already added, the questionnaire is inactive

removeQuestionPage

public void removeQuestionPage(QuestionPage questionPage)
Removes a page of questions from the Questionnaire.

Parameters:
questionPage - QuestionPage
PRE condition:
the questionPage is added to the questionnaire, the questionnaire is inactive.

setInactive

public void setInactive()
Deactivates the Questionnaire

PRE condition:
the questionnaire is active

setActive

public void setActive()
Activates the Questionnaire

PRE condition:
the questionnaire is inactive., the questionnaire is non-empty, ie. questionPages has been added.

getState

public boolean getState()
Returns whether or not the questionnaire is active.

Returns:
boolean

setQuestionnaireID

public void setQuestionnaireID(int questionnaireIDInput)
Sets an ID for the questionnaire

Parameters:
questionnaireIDInput - int

getQuestionnaireID

public int getQuestionnaireID()
Returns the id of the questionnaire.

Returns:
int

setOwner

public void setOwner(java.lang.String owner)
Sets the owner of the questionnaire.

Parameters:
owner - String

getOwner

public java.lang.String getOwner()
Returns the owner of the questionnaire.

Returns:
String

setQuestionnaireName

public void setQuestionnaireName(java.lang.String questionnaireName)
Sets a name for the questionnaire.

Parameters:
questionnaireName - String

getQuestionnaireName

public java.lang.String getQuestionnaireName()
Returns the name of the questionnaire.

Returns:
String

setIntroText

public void setIntroText(java.lang.String introText)
Sets an intro text for the questionnaire.

Parameters:
introText - String

getIntroText

public java.lang.String getIntroText()
Returns the intro text of the questionnaire.

Returns:
String

getRefUserGroups

public java.util.ArrayList getRefUserGroups()
Returns an ArrayList with toString representations of the userGroups that are allowed to answer the questionnaire.

Returns:
ArrayList

getRefQuestionPages

public java.util.ArrayList getRefQuestionPages()
Returns an ArrayList with toString representations of the added questionPages.

Returns:
ArrayList

toString

public java.lang.String toString()
Returns a string representation of the object.

Returns:
String