use of org.mifos.platform.questionnaire.domain.SectionQuestion in project head by mifos.
the class QuestionnaireMapperImpl method mapToSectionLinkDetails.
public List<SectionLinkDetail> mapToSectionLinkDetails(List<SectionLink> sectionLinks) {
List<SectionLinkDetail> sectionLinkDetails = new ArrayList<SectionLinkDetail>();
for (SectionLink sectionLink : sectionLinks) {
SectionLinkDetail sectionLinkDetail = new SectionLinkDetail();
sectionLinkDetail.setValue(sectionLink.getQuestionGroupLink().getValue());
sectionLinkDetail.setAdditionalValue(sectionLink.getQuestionGroupLink().getAdditionalValue());
sectionLinkDetail.setLinkType(sectionLink.getQuestionGroupLink().getConditionTypeId());
sectionLinkDetail.setProperLinkTypeDisplay(sectionLink.getQuestionGroupLink().getConditionType());
sectionLinkDetail.setLinkId(sectionLink.getId());
sectionLinkDetail.setQuestionGroupLinkId(sectionLink.getQuestionGroupLink().getId());
sectionLinkDetail.setState(true);
SectionQuestion sectionQuestion = sectionLink.getQuestionGroupLink().getSourceSectionQuestion();
sectionLinkDetail.setSourceQuestion(mapToSectionQuestionDetail(sectionQuestion, sectionQuestion.isRequired(), sectionQuestion.isShowOnPage(), (mapToQuestionDetail(sectionQuestion.getQuestion(), mapToQuestionType(sectionQuestion.getQuestion().getAnswerTypeAsEnum())))));
sectionLinkDetail.setAffectedSection(mapToSectionDetail(sectionLink.getAffectedSection()));
sectionLinkDetails.add(sectionLinkDetail);
}
return sectionLinkDetails;
}
use of org.mifos.platform.questionnaire.domain.SectionQuestion 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;
}
use of org.mifos.platform.questionnaire.domain.SectionQuestion in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionGroupResponse.
private QuestionGroupResponse mapToQuestionGroupResponse(QuestionGroupInstance questionGroupInstance, QuestionGroupResponseDto questionGroupResponseDto) {
QuestionGroupResponse questionGroupResponse = new QuestionGroupResponse();
questionGroupResponse.setResponse(questionGroupResponseDto.getResponse());
questionGroupResponse.setQuestionGroupInstance(questionGroupInstance);
SectionQuestion sq;
if (sectionQuestionMap.containsKey(questionGroupResponseDto.getSectionQuestionId())) {
sq = sectionQuestionMap.get(questionGroupResponseDto.getSectionQuestionId());
} else {
sq = sectionQuestionDao.getDetails(questionGroupResponseDto.getSectionQuestionId());
sectionQuestionMap.put(questionGroupResponseDto.getSectionQuestionId(), sq);
}
questionGroupResponse.setSectionQuestion(sq);
return questionGroupResponse;
}
use of org.mifos.platform.questionnaire.domain.SectionQuestion in project head by mifos.
the class QuestionnaireMapperImpl method mapToSectionQuestion.
private SectionQuestion mapToSectionQuestion(SectionQuestionDetail sectionQuestionDetail, int seqNum, Section section) {
QuestionDetail questionDetail = sectionQuestionDetail.getQuestionDetail();
SectionQuestion sectionQuestion = getSectionQuestion(questionDetail, section);
sectionQuestion.setRequired(sectionQuestionDetail.isMandatory());
sectionQuestion.setShowOnPage(sectionQuestionDetail.isShowOnPage());
sectionQuestion.setSequenceNumber(sectionQuestionDetail.getSequenceNumber());
if (sectionQuestion.isNewSectionQuestion()) {
sectionQuestion.setQuestion(mapToQuestion(questionDetail));
sectionQuestion.setSequenceNumber(seqNum);
sectionQuestion.setSection(section);
}
return sectionQuestion;
}
use of org.mifos.platform.questionnaire.domain.SectionQuestion in project head by mifos.
the class QuestionnaireMapperImpl method mapToSectionQuestion.
private SectionQuestion mapToSectionQuestion(QuestionDto questionDto, Section section) {
SectionQuestion sectionQuestion = new SectionQuestion();
sectionQuestion.setSection(section);
sectionQuestion.setSequenceNumber(questionDto.getOrder());
sectionQuestion.setRequired(questionDto.isMandatory());
sectionQuestion.setShowOnPage(questionDto.isShowOnPage());
sectionQuestion.setQuestion(mapToQuestion(questionDto));
return sectionQuestion;
}
Aggregations