use of org.mifos.platform.questionnaire.domain.SectionQuestionLink in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionLinkDetails.
public List<QuestionLinkDetail> mapToQuestionLinkDetails(List<SectionQuestionLink> sectionQuestionLinks) {
List<QuestionLinkDetail> questionLinkDetails = new ArrayList<QuestionLinkDetail>();
for (SectionQuestionLink sectionQuestionLink : sectionQuestionLinks) {
QuestionLinkDetail questionLinkDetail = new QuestionLinkDetail();
questionLinkDetail.setValue(sectionQuestionLink.getQuestionGroupLink().getValue());
questionLinkDetail.setAdditionalValue(sectionQuestionLink.getQuestionGroupLink().getAdditionalValue());
questionLinkDetail.setLinkType(sectionQuestionLink.getQuestionGroupLink().getConditionTypeId());
questionLinkDetail.setProperLinkTypeDisplay(sectionQuestionLink.getQuestionGroupLink().getConditionType());
questionLinkDetail.setLinkId(sectionQuestionLink.getId());
questionLinkDetail.setQuestionGroupLinkId(sectionQuestionLink.getQuestionGroupLink().getId());
questionLinkDetail.setState(true);
SectionQuestion sectionQuestion = sectionQuestionLink.getQuestionGroupLink().getSourceSectionQuestion();
questionLinkDetail.setSourceQuestion(mapToSectionQuestionDetail(sectionQuestion, sectionQuestion.isRequired(), sectionQuestion.isShowOnPage(), (mapToQuestionDetail(sectionQuestion.getQuestion(), mapToQuestionType(sectionQuestion.getQuestion().getAnswerTypeAsEnum())))));
sectionQuestion = sectionQuestionLink.getAffectedSectionQuestion();
questionLinkDetail.setAffectedQuestion(mapToSectionQuestionDetail(sectionQuestion, sectionQuestion.isRequired(), sectionQuestion.isShowOnPage(), (mapToQuestionDetail(sectionQuestion.getQuestion(), mapToQuestionType(sectionQuestion.getQuestion().getAnswerTypeAsEnum())))));
questionLinkDetails.add(questionLinkDetail);
}
return questionLinkDetails;
}
use of org.mifos.platform.questionnaire.domain.SectionQuestionLink 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));
}
use of org.mifos.platform.questionnaire.domain.SectionQuestionLink in project head by mifos.
the class QuestionnaireMapperImpl method mapToQuestionLink.
public SectionQuestionLink mapToQuestionLink(QuestionLinkDetail questionLinkDetail, QuestionGroupLink questionGroupLink) {
SectionQuestionLink sectionQuestionLink = new SectionQuestionLink();
sectionQuestionLink.setQuestionGroupLink(questionGroupLink);
sectionQuestionLink.setAffectedSectionQuestion(getSectionQuestionById(questionLinkDetail.getAffectedQuestion().getId()));
sectionQuestionLink.setId(questionLinkDetail.getLinkId());
return sectionQuestionLink;
}
Aggregations