Search in sources :

Example 1 with QuestionType

use of org.mifos.platform.questionnaire.service.QuestionType in project head by mifos.

the class QuestionnaireMapperImpl method mapToSectionDetail.

private SectionDetail mapToSectionDetail(Section section) {
    SectionDetail sectionDetail = new SectionDetail();
    sectionDetail.setId(section.getId());
    sectionDetail.setName(section.getName());
    if (section.getSequenceNumber() != null) {
        sectionDetail.setSequenceNumber(section.getSequenceNumber());
    }
    for (SectionQuestion sectionQuestion : section.getQuestions()) {
        QuestionEntity question = sectionQuestion.getQuestion();
        QuestionType type = mapToQuestionType(question.getAnswerTypeAsEnum());
        boolean required = sectionQuestion.isRequired();
        QuestionDetail questionDetail = mapToQuestionDetail(question, type);
        sectionDetail.addQuestion(mapToSectionQuestionDetail(sectionQuestion, required, sectionQuestion.isShowOnPage(), questionDetail));
    }
    return sectionDetail;
}
Also used : SectionQuestion(org.mifos.platform.questionnaire.domain.SectionQuestion) QuestionEntity(org.mifos.platform.questionnaire.domain.QuestionEntity) QuestionType(org.mifos.platform.questionnaire.service.QuestionType) SectionDetail(org.mifos.platform.questionnaire.service.SectionDetail) QuestionDetail(org.mifos.platform.questionnaire.service.QuestionDetail) SectionQuestionDetail(org.mifos.platform.questionnaire.service.SectionQuestionDetail)

Aggregations

QuestionEntity (org.mifos.platform.questionnaire.domain.QuestionEntity)1 SectionQuestion (org.mifos.platform.questionnaire.domain.SectionQuestion)1 QuestionDetail (org.mifos.platform.questionnaire.service.QuestionDetail)1 QuestionType (org.mifos.platform.questionnaire.service.QuestionType)1 SectionDetail (org.mifos.platform.questionnaire.service.SectionDetail)1 SectionQuestionDetail (org.mifos.platform.questionnaire.service.SectionQuestionDetail)1