Package nz.org.riskscape.wizard.survey2
Class BaseSurvey
java.lang.Object
nz.org.riskscape.wizard.survey2.BaseSurvey
- All Implemented Interfaces:
nz.org.riskscape.engine.Identified
,Survey
- Direct Known Subclasses:
EmptySurvey
,ModelSurvey2
Convenient super class for a phase-based Survey
.
Can also be instantiated, but that should be limited to test cases - sub classing makes it easier to organize your survey.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final String
protected final nz.org.riskscape.engine.i18n.MessageSource
Fields inherited from interface nz.org.riskscape.wizard.Survey
EMPTY_SURVEY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiongetApplicableQuestionSets
(IncrementalBuildState buildState) getId()
A unique identifier for this survey.nz.org.riskscape.engine.i18n.MessageSource
AMessageSource
that is specific to this survey.getPhaseOfType
(Class<T> clazz) Look up a Phase by its implementing class (Assuming they are unique).getPipelineChange
(IncrementalBuildState buildState, Answer answer) Returns aPipelineChange
that is created by applying an answer a build state.getQuestionTree
(IncrementalBuildState buildState) boolean
isFinished
(IncrementalBuildState buildState) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface nz.org.riskscape.engine.Identified
getIdentifiedClass
Methods inherited from interface nz.org.riskscape.wizard.Survey
getAnalysisOutputStepName, getDescription, getNextQuestion, getVersion, isQuestionSetReplayOrdered, skip
-
Field Details
-
id
-
messageSource
protected final nz.org.riskscape.engine.i18n.MessageSource messageSource -
phases
-
-
Constructor Details
-
BaseSurvey
-
-
Method Details
-
getApplicableQuestionSets
- Specified by:
getApplicableQuestionSets
in interfaceSurvey
- Returns:
- a list of the currently applicable QuestionSets, i.e. the sets of questions that are able to be answered next
-
getPipelineChange
Description copied from interface:Survey
Returns a
PipelineChange
that is created by applying an answer a build state.- Specified by:
getPipelineChange
in interfaceSurvey
- Parameters:
buildState
- the build state to get a change to.answer
- the answer to apply. This answer must be for a question that came back fromSurvey.getNextQuestion(IncrementalBuildState)
using the given build state, or weird things might happen
-
getQuestionTree
- Specified by:
getQuestionTree
in interfaceSurvey
- Returns:
- the set of questions that can be asked next. The controller code can use this question tree as a source of questions until it is empty - it shouldn't keep asking the survey for the tree between questions.
-
getPhaseOfType
Look up a Phase by its implementing class (Assuming they are unique). This has been added mostly so that test cases can find elements of the survey after construction.
-
isFinished
- Specified by:
isFinished
in interfaceSurvey
- Returns:
- true if the survey is 'finished enough' to now run something (even if more optional question-sets remain).
-
getDefinedPhases
- Specified by:
getDefinedPhases
in interfaceSurvey
- Returns:
- a list of the phases this survey goes through, in sequence order.
-
getId
Description copied from interface:Survey
A unique identifier for this survey.
-
getMessageSource
public nz.org.riskscape.engine.i18n.MessageSource getMessageSource()Description copied from interface:Survey
A
MessageSource
that is specific to this survey. Should contain i18n text for the various choices and text associated with this survey.- Specified by:
getMessageSource
in interfaceSurvey
-
getPhases
-