Class DefaultQuestionSet2

java.lang.Object
nz.org.riskscape.wizard.BaseQuestionSet
nz.org.riskscape.wizard.survey2.DefaultQuestionSet2
All Implemented Interfaces:
QuestionSet

public class DefaultQuestionSet2 extends BaseQuestionSet

A QuestionSet that work on a static list of Questions and BuildPoints to satisfy the API contract

  • Constructor Details

    • DefaultQuestionSet2

      public DefaultQuestionSet2(String id, Phase phase)
    • DefaultQuestionSet2

      public DefaultQuestionSet2(String name, String discriminator, Phase phase)
  • Method Details

    • addBuildPoint

      public void addBuildPoint(BuildPoint point)

      Adds a potential build point to the question set, i.e. if certain conditions are met then apply a given pipeline change.

    • addQuestion

      public <T> AddQuestion<T> addQuestion(String name, Class<T> parameterType)

      Start adding a question to this question set. Note that AddQuestion.then must be called to actually add it

      Parameters:
      name - the name of the question
      parameterType - the type of the response wanted for this question
    • addHiddenQuestion

      public AddQuestion<Question.Hidden> addHiddenQuestion(String name)

      Adds a hidden question (Question.hidden()) to the set

    • get

      public Question get(String questionName)
    • remove

      public boolean remove(Question question)
    • contains

      public boolean contains(Question question)
    • getParameters

      public List<nz.org.riskscape.engine.bind.Parameter> getParameters()

      Returns Parameters that represent this set of questions. Note that this is the full set of Questions (i.e. it doesn't exclude any mutually exclusive questions).

    • getQuestions

      public List<Question> getQuestions()
      Description copied from interface: QuestionSet

      The list of questions that this question set contains.

      These questions should be partially ordered such that if question b comes after question a then they should be ordered so that a is before b in the list.

      Previously, there was potential for this list to change as the build state changed, and so this method was removed from the QuestionSet interface. But this possibility is being dropped with the new survey2 api in favour of a static list of questions per set, but allowing a dynamic set of question sets.

    • getPipelineChange

      public PipelineChange getPipelineChange(IncrementalBuildState buildState, Answer answer)
      Description copied from interface: QuestionSet

      Returns a PipelineChange that is created by applying an answer a build state.

      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 from #getNextQuestions(IncrementalBuildState) using the given build state, or weird things might happen
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getPhase

      public Phase getPhase()
      Returns:
      the phase this QuestionSet belongs to
    • getBuildPoints

      public List<BuildPoint> getBuildPoints()
    • getDefaultLocation

      public ChangeLocation getDefaultLocation()

      A default location that gets assigned to Questions added via the addQuestion method when they are added to this set. Defaults to the same thing as Question defaults to

    • setDefaultLocation

      public void setDefaultLocation(ChangeLocation defaultLocation)

      A default location that gets assigned to Questions added via the addQuestion method when they are added to this set. Defaults to the same thing as Question defaults to