pulse - the web application framework Get pulse at SourceForge.net. Fast, secure and Free Open Source software downloads Ohloh project report for pulse-java

org.torweg.pulse.component.survey.model
Class Survey

java.lang.Object
  extended by org.torweg.pulse.util.entity.AbstractBasicEntity
      extended by org.torweg.pulse.component.survey.model.Survey
All Implemented Interfaces:
java.io.Serializable, INamed

@Entity
public class Survey
extends AbstractBasicEntity
implements INamed

A Survey is a collection of AbstractQuestions.

The Survey will be processed by the SurveyController during the execution of which the following settings of the Survey will be evaluated:

Version:
$Revision: 1586 $
Author:
Daniel Dietz
See Also:
Serialized Form

Constructor Summary
protected Survey()
          Default constructor.
  Survey(java.lang.String n, java.util.List<AbstractQuestion> quests)
          Creates a new Survey with the given name and the given AbstractQuestions.
 
Method Summary
 java.util.Date getEndDate()
          Returns the end-Date.
 java.lang.String getName()
          Returns the name of the Survey.
 AbstractQuestion getQuestion(int index)
          Returns the AbstractQuestion at the specified index.
 java.util.List<Questionnaire> getQuestionnaires(org.hibernate.Session s)
          Returns the Questionnaires associated with the Survey.
 java.util.List<AbstractQuestion> getQuestions()
          Returns the AbstractQuestions of the Survey.
 java.util.Collection<java.lang.Long> getRoleIds()
          Returns the ids of the Roles required to take part in the Survey.
 java.util.Date getStartDate()
          Returns the start-Date.
 boolean isAnonymous()
          Returns the anonymous of the Survey.
 boolean isKeepInSession()
          Indicates whether the Survey (precisely the current SurveyProgress) is to be kept in the session once the Survey is finished.
 boolean isRequireAllRoles()
          Indicates whether all roleIds are required to take part in the Survey or a single one is enough.
 boolean isRequiresRole()
          Returns whether this Survey requires (a) specific Role/s to take part.
 boolean isRequireSurveyToken()
          Returns whether the Survey requires a token to take part.
 boolean isSingleStepSave()
          Returns whether to save the Questionnaires for this survey on every single step.
 void setAnonymous(boolean anon)
          Sets the anonymous for the Survey.
 void setEndDate(java.util.Date end)
          Sets the end-Date.
 void setKeepInSession(boolean keep)
          Sets the keepInSession, which indicates whether the Survey (precisely the current SurveyProgress) is to be kept in the session once the Survey is finished.
 void setRequireAllRoles(boolean requireAllRls)
          Sets the requireAllRoles.
 void setRequireSurveyToken(boolean requireToken)
          Sets the requireSurveyToken for the Survey.
 void setRoleIds(java.util.Collection<java.lang.Long> rIds)
          Sets the ids of the Roles required to take part in the Survey.
 void setSingleStepSave(boolean stepSave)
          Sets the singleStepSave.
 void setStartDate(java.util.Date start)
          Sets the start-Date.
 
Methods inherited from class org.torweg.pulse.util.entity.AbstractBasicEntity
compareTo, equals, getFullQualifiedClassNameJAXB, getId, hashCode
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Survey

protected Survey()
Default constructor.


Survey

public Survey(java.lang.String n,
              java.util.List<AbstractQuestion> quests)
Creates a new Survey with the given name and the given AbstractQuestions.

Parameters:
n - the name to set
quests - the AbstractQuestions to set
Method Detail

getName

public final java.lang.String getName()
Returns the name of the Survey.

Specified by:
getName in interface INamed
Returns:
the name

getQuestions

public final java.util.List<AbstractQuestion> getQuestions()
Returns the AbstractQuestions of the Survey.

Returns:
the AbstractQuestions

getQuestion

public final AbstractQuestion getQuestion(int index)
Returns the AbstractQuestion at the specified index.

Parameters:
index - the index
Returns:
the AbstractQuestion at the specified index

setStartDate

public final void setStartDate(java.util.Date start)
Sets the start-Date.

Parameters:
start - the start-Date to set

getStartDate

public final java.util.Date getStartDate()
Returns the start-Date.

Returns:
the start-Date if set, null otherwise

setEndDate

public final void setEndDate(java.util.Date end)
Sets the end-Date.

Parameters:
end - the end-Date to set

getEndDate

public final java.util.Date getEndDate()
Returns the end-Date.

Returns:
the end-Date if set, null otherwise

setSingleStepSave

public final void setSingleStepSave(boolean stepSave)
Sets the singleStepSave.

Parameters:
stepSave - the singleStepSave to set

isSingleStepSave

public final boolean isSingleStepSave()
Returns whether to save the Questionnaires for this survey on every single step.

Returns:
true to save the Questionnaires for this survey on every single step, false otherwise

setAnonymous

public final void setAnonymous(boolean anon)
Sets the anonymous for the Survey.

Parameters:
anon - the anonymous to set

isAnonymous

public final boolean isAnonymous()
Returns the anonymous of the Survey.

Returns:
the anonymous

setRequireSurveyToken

public final void setRequireSurveyToken(boolean requireToken)
Sets the requireSurveyToken for the Survey.

Parameters:
requireToken - the requireSurveyToken to set

isRequireSurveyToken

public final boolean isRequireSurveyToken()
Returns whether the Survey requires a token to take part.

Returns:
true if the Survey requires a token to take part, false otherwise

setRoleIds

public final void setRoleIds(java.util.Collection<java.lang.Long> rIds)
Sets the ids of the Roles required to take part in the Survey.

Parameters:
rIds - the roleIds to set

getRoleIds

public final java.util.Collection<java.lang.Long> getRoleIds()
Returns the ids of the Roles required to take part in the Survey.

Returns:
the roleIds

isRequiresRole

public final boolean isRequiresRole()
Returns whether this Survey requires (a) specific Role/s to take part.

Returns:
true if this Survey requires (a) Role/s to take part, false otherwise
specifically: !this.roleIds.isEmpty()

setRequireAllRoles

public final void setRequireAllRoles(boolean requireAllRls)
Sets the requireAllRoles.

Parameters:
requireAllRls - the requireAllRoles to set

isRequireAllRoles

public final boolean isRequireAllRoles()
Indicates whether all roleIds are required to take part in the Survey or a single one is enough.

Returns:
true if all roleIds are required to take part in the Survey, false if a single one is enough

setKeepInSession

public final void setKeepInSession(boolean keep)
Sets the keepInSession, which indicates whether the Survey (precisely the current SurveyProgress) is to be kept in the session once the Survey is finished.

Parameters:
keep - the keepInSession to set

isKeepInSession

public final boolean isKeepInSession()
Indicates whether the Survey (precisely the current SurveyProgress) is to be kept in the session once the Survey is finished.

Returns:
true if the Survey (precisely the SurveyProgress) is to be kept in the session, false otherwise

getQuestionnaires

public final java.util.List<Questionnaire> getQuestionnaires(org.hibernate.Session s)
Returns the Questionnaires associated with the Survey.

Parameters:
s - the hibernateTM-Session
Returns:
the Questionnaires associated with the Survey