use of org.mifos.platform.questionnaire.domain.SectionLink 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.SectionLink in project head by mifos.
the class QuestionnaireMapperImpl method mapToSectionLink.
public SectionLink mapToSectionLink(SectionLinkDetail sectionLinkDetail, QuestionGroupLink questionGroupLink) {
SectionLink sectionLink = new SectionLink();
sectionLink.setAffectedSection(getSectionById(sectionLinkDetail.getAffectedSection().getId()));
sectionLink.setQuestionGroupLink(questionGroupLink);
sectionLink.setId(sectionLinkDetail.getLinkId());
return sectionLink;
}
use of org.mifos.platform.questionnaire.domain.SectionLink in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionGroupDetail.
@Override
public QuestionGroupDetail mapToQuestionGroupDetail(QuestionGroup questionGroup) {
List<SectionDetail> sectionDetails = mapToSectionDetails(questionGroup.getSections());
List<SectionLink> sectionLinks = new ArrayList<SectionLink>();
List<SectionQuestionLink> sectionQuestionLinks = new ArrayList<SectionQuestionLink>();
for (SectionDetail sectionDetail : sectionDetails) {
for (SectionQuestionDetail sectionQuestionDetail : sectionDetail.getQuestionDetails()) {
if (!sectionLinkDao.retrieveDependentSectionLinksFromQuestion(sectionQuestionDetail.getId()).isEmpty())
sectionLinks.addAll(sectionLinkDao.retrieveDependentSectionLinksFromQuestion(sectionQuestionDetail.getId()));
if (!sectionQuestionLinkDao.retrieveDependentSectionQuestionLinksFromQuestion(sectionQuestionDetail.getId()).isEmpty())
sectionQuestionLinks.addAll(sectionQuestionLinkDao.retrieveDependentSectionQuestionLinksFromQuestion(sectionQuestionDetail.getId()));
}
}
List<EventSourceDto> eventSourceDtos = mapToEventSource(questionGroup.getEventSources());
return new QuestionGroupDetail(questionGroup.getId(), questionGroup.getTitle(), eventSourceDtos, sectionDetails, questionGroup.isEditable(), QuestionGroupState.ACTIVE.equals(questionGroup.getState()), questionGroup.isPpi(), mapToQuestionLinkDetails(sectionQuestionLinks), mapToSectionLinkDetails(sectionLinks));
}
Aggregations