use of org.mifos.platform.questionnaire.domain.Section in project head by mifos.
the class QuestionnaireMapperImpl method mapToSection.
private Section mapToSection(SectionDto sectionDto) {
Section section = new Section();
section.setName(sectionDto.getName());
section.setSequenceNumber(sectionDto.getOrder());
section.setQuestions(mapToSectionQuestionsFromDtos(sectionDto.getQuestions(), section));
return section;
}
use of org.mifos.platform.questionnaire.domain.Section in project head by mifos.
the class QuestionnaireMapperImpl method mapToSection.
private Section mapToSection(QuestionGroupDetail questionGroupDetail, SectionDetail sectionDetail) {
Section section = getSection(questionGroupDetail, sectionDetail);
section.setQuestions(mapToSectionQuestions(sectionDetail.getQuestions(), section));
if (sectionDetail.getSequenceNumber() != null) {
section.setSequenceNumber(sectionDetail.getSequenceNumber());
}
return section;
}
use of org.mifos.platform.questionnaire.domain.Section in project head by mifos.
the class QuestionnaireMapperTest method assertSectionsForExistingQuestion.
private void assertSectionsForExistingQuestion(List<Section> sections) {
assertThat(sections, is(notNullValue()));
assertThat(sections.size(), is(1));
Section section = sections.get(0);
assertThat(section.getName(), is("Misc"));
List<SectionQuestion> questions = section.getQuestions();
assertThat(questions, is(notNullValue()));
assertThat(questions.size(), is(2));
assertThat(questions.get(0).getQuestionText(), is("Ques1"));
assertThat(questions.get(0).getId(), is(333));
assertThat(questions.get(0).getQuestion().getQuestionId(), is(999));
assertThat(questions.get(1).getQuestionText(), is("Ques2"));
}
use of org.mifos.platform.questionnaire.domain.Section in project head by mifos.
the class QuestionnaireMapperTest method assertSections.
private void assertSections(List<Section> sections) {
assertThat(sections, notNullValue());
assertThat(sections.size(), is(2));
Section section1 = sections.get(0);
assertThat(section1.getName(), is("S1"));
assertSectionQuestions(section1.getQuestions());
Section section2 = sections.get(1);
assertThat(section2.getName(), is("S2"));
assertSectionQuestions(section2.getQuestions());
}
use of org.mifos.platform.questionnaire.domain.Section in project head by mifos.
the class QuestionnaireMapperTest method getSection.
private Section getSection(String sectionName, int questionId) {
Section section = new Section(sectionName);
SectionQuestion sectionQuestion = new SectionQuestion();
QuestionEntity question = new QuestionEntity();
question.setQuestionId(questionId);
question.setQuestionText(sectionName);
question.setAnswerType(AnswerType.DATE);
question.setChoices(new LinkedList<QuestionChoiceEntity>());
sectionQuestion.setQuestion(question);
section.setQuestions(asList(sectionQuestion));
return section;
}
Aggregations