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
Class SurveyProgress

java.lang.Object
  extended by org.torweg.pulse.component.survey.SurveyProgress
All Implemented Interfaces:
java.io.Serializable

public class SurveyProgress
extends java.lang.Object
implements java.io.Serializable

A SurveyProgress is a JAXB-able Object to monitor the current Surveys progress.

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

Constructor Summary
protected SurveyProgress()
          Default constructor.
  SurveyProgress(Survey sur, Questionnaire quest)
          Creates a new SurveyProgress with the given Survey and the given Questionnaire.
 
Method Summary
 void answer(int index, ServiceRequest request)
          Adds an {@code AbstractTypedAnswer<?
 int getLastSuccessfulQuestionIndex()
          Returns the index of the last successfully answered AbstractQuestion of the Survey.
 java.lang.Long getProgressPercent()
          Returns the progress-percentage of the SurveyProgress by setting of the {@code AbstractTypedAnswer<?
 Questionnaire getQuestionnaire()
          Returns the Questionnaire of the SurveyProgress .
 Survey getSurvey()
          Returns the Survey of the SurveyProgress.
 SurveyToken getToken()
          Returns the SurveyToken of the SurveyProgress.
 SurveyProgress gotoPreviousLastSuccessfulQuestionIndex()
          Sets the index of the last successfully answered question of the SurveyProgress to the previous question.
 boolean isValid()
          Indicates if the last AbstractQuestion's AbstractTypedAnswer was valid.
protected  void setQuestionnaire(Questionnaire quest)
          Sets the Questionnaire for the SurveyProgress.
protected  void setSurvey(Survey sur)
          Sets the Survey for the SurveyProgress.
 void setSurveyToken(SurveyToken surveyTok)
          Sets the given SurveyToken for the SurveyProgres and adds it to the Questionnaire.
 void setValid(boolean valid)
          Sets the isValid.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SurveyProgress

protected SurveyProgress()
Default constructor.


SurveyProgress

public SurveyProgress(Survey sur, Questionnaire quest)
Creates a new SurveyProgress with the given Survey and the given Questionnaire.

Parameters:
sur - the Survey
quest - the Questionnaire
Method Detail

setSurvey

protected final void setSurvey(Survey sur)
Sets the Survey for the SurveyProgress.

Parameters:
sur - the Survey to set

getSurvey

public final Survey getSurvey()
Returns the Survey of the SurveyProgress.

Returns:
the Survey

setQuestionnaire

protected final void setQuestionnaire(Questionnaire quest)
Sets the Questionnaire for the SurveyProgress.

Parameters:
quest - the Questionnaire to set

getQuestionnaire

public final Questionnaire getQuestionnaire()
Returns the Questionnaire of the SurveyProgress .

Returns:
the Questionnaire of the SurveyProgress

setValid

public final void setValid(boolean valid)
Sets the isValid.

Parameters:
valid - the value to set

isValid

public final boolean isValid()
Indicates if the last AbstractQuestion's AbstractTypedAnswer was valid.

Returns:
the isValid

getLastSuccessfulQuestionIndex

public final int getLastSuccessfulQuestionIndex()
Returns the index of the last successfully answered AbstractQuestion of the Survey.

Returns:
the lastSuccessfulQuestionIndex

gotoPreviousLastSuccessfulQuestionIndex

public final SurveyProgress gotoPreviousLastSuccessfulQuestionIndex()
Sets the index of the last successfully answered question of the SurveyProgress to the previous question.

Returns:
the modified SurveyProgress

getProgressPercent

public final java.lang.Long getProgressPercent()
Returns the progress-percentage of the SurveyProgress by setting of the AbstractTypedAnswer&lt;?&gt;s of the Questionnaire against the AbstractQuestions of the Survey.

Returns:
the progress-percentage of the SurveyProgress

answer

public final void answer(int index, ServiceRequest request)
Adds an AbstractTypedAnswer&lt;?&gt; to the Questionnaire of the SurveyProgress.

Parameters:
index - the index of the question to answer
request - the ServiceRequest

setSurveyToken

public final void setSurveyToken(SurveyToken surveyTok)
Sets the given SurveyToken for the SurveyProgres and adds it to the Questionnaire.

Parameters:
surveyTok - the SurveyToken

getToken

public final SurveyToken getToken()
Returns the SurveyToken of the SurveyProgress.

Returns:
the SurveyToken of the SurveyProgress