use of org.mifos.platform.questionnaire.service.QuestionLinkDetail in project head by mifos.
the class QuestionGroupController method defineQuestionGroup.
@SuppressWarnings({ "ThrowableInstanceNeverThrown" })
public String defineQuestionGroup(QuestionGroupForm questionGroupForm, RequestContext requestContext, boolean createMode) {
String result = "success";
if (!questionGroupHasErrors(questionGroupForm, requestContext)) {
QuestionGroupDetail questionGroupDetail = null;
try {
if (createMode) {
questionGroupForm.setActive(true);
}
if (questionGroupForm.isActive()) {
questionGroupDetail = questionnaireServiceFacade.createActiveQuestionGroup(questionGroupForm.getQuestionGroupDetail());
} else {
questionGroupDetail = questionnaireServiceFacade.createQuestionGroup(questionGroupForm.getQuestionGroupDetail());
}
if (containsCreateLoanEventSource(questionGroupForm.getEventSources()) && questionGroupForm.getApplyToAllLoanProducts()) {
questionnaireServiceFacade.applyToAllLoanProducts(questionGroupDetail.getId());
}
List<QuestionLinkDetail> questionLinkDetails = setFilledQuestionDetailForQuestionLinks(questionGroupForm.getQuestionLinks(), questionGroupDetail);
List<SectionLinkDetail> sectionLinkDetails = setFilledSectionDetailForQuestionLinks(questionGroupForm.getSectionLinks(), questionGroupDetail);
questionnaireServiceFacade.createQuestionLinks(questionLinkDetails);
questionnaireServiceFacade.createSectionLinks(sectionLinkDetails);
} catch (AccessDeniedException e) {
constructAndLogSystemError(requestContext.getMessageContext(), new SystemException(QuestionnaireConstants.MISSING_PERMISSION_TO_ACTIVATE_QG, e));
result = "failure";
} catch (SystemException e) {
constructAndLogSystemError(requestContext.getMessageContext(), e);
result = "failure";
}
} else {
result = "failure";
}
return result;
}
use of org.mifos.platform.questionnaire.service.QuestionLinkDetail in project head by mifos.
the class QuestionGroupController method setQuestionLinkDetail.
public QuestionLinkDetail setQuestionLinkDetail(QuestionGroupForm questionGroupForm, String sourceQuestionId, String affectedQuestionId, String value, String additionalValue, String linkType, String linkTypeDisplay) {
QuestionLinkDetail questionLinkDetail = new QuestionLinkDetail();
SectionQuestionDetail sourceQuestion = findQuestionDetailById(questionGroupForm.getQuestionGroupDetail(), sourceQuestionId);
questionLinkDetail.setSourceQuestion(sourceQuestion);
SectionQuestionDetail affectedQuestion = findQuestionDetailById(questionGroupForm.getQuestionGroupDetail(), affectedQuestionId);
questionLinkDetail.setAffectedQuestion(affectedQuestion);
questionLinkDetail.setValue(value);
questionLinkDetail.setLinkType(Integer.valueOf(linkType));
questionLinkDetail.setLinkTypeDisplay(linkTypeDisplay);
questionLinkDetail.setState(false);
if (additionalValue != null)
questionLinkDetail.setAdditionalValue(additionalValue);
return questionLinkDetail;
}
Aggregations