コード例 #1
0
  @Override
  protected PageStructure createPageStructure(
      RandomizationStrategy randomizationStrategy,
      List<SectionBreadcrumb> breadcrumbs,
      Map<String, Object> answers) {
    PageStructure nextPage = super.createPageStructure(randomizationStrategy, breadcrumbs, answers);
    Breadcrumb active = breadcrumbs.get(0);

    SectionBreadcrumb sectionBreadcrumb = (SectionBreadcrumb) active;
    Builder builder = Section.with();
    if (!randomizationStrategy.equals(RandomizationStrategy.QUESTIONS_RANDOMIZATION)) {
      builder.id(sectionBreadcrumb.getSection().getId());
    }
    Section section = builder.build();
    for (QuestionBreadcrumb questionBreadcrumb : sectionBreadcrumb.getBreadcrumbs()) {
      section.addQuestion(
          Question.with()
              .id(questionBreadcrumb.getQuestion().getId())
              .number(questionBreadcrumb.getQuestionNumber())
              .build());
    }
    nextPage.addSection(section);
    return nextPage;
  }
コード例 #2
0
 private Integer extractLastQuestionNumberDisplayed(SectionBreadcrumb lastBreadcrumb) {
   int questionsCount = lastBreadcrumb.getBreadcrumbs().size();
   return lastBreadcrumb.getBreadcrumbs().get(questionsCount - 1).getQuestionNumber();
 }