use of org.mifos.platform.questionnaire.service.SectionQuestionDetail 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.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupController method getAllSectionQuestions.
public List<SectionQuestionDetail> getAllSectionQuestions(QuestionGroupForm questionGroupForm) {
List<SectionQuestionDetail> sectionQuestionDetails = new ArrayList<SectionQuestionDetail>();
List<Integer> questionIds = questionGroupForm.getQuestionGroupDetail().getAllQuestionIds();
List<QuestionDetail> questionDetails = questionnaireServiceFacade.getAllActiveQuestions(questionIds);
if (questionDetails != null) {
for (QuestionDetail questionDetail : questionDetails) {
sectionQuestionDetails.add(new SectionQuestionDetail(questionDetail, false));
}
}
return sectionQuestionDetails;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupForm method addNewQuestion.
private void addNewQuestion() {
currentQuestion.setChoices();
SectionQuestionDetail sectionQuestionDetail = new SectionQuestionDetail(currentQuestion.getQuestionDetail(), false);
currentSection.addSectionQuestion(sectionQuestionDetail);
Integer newQuestionId = getNewQuestionId();
sectionQuestionDetail.getQuestionDetail().setId(newQuestionId);
currentQuestion = new Question(new QuestionDetail());
questionsToAdd.add(newQuestionId);
updateSequenceNumbers();
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupForm method getNewQuestionId.
private Integer getNewQuestionId() {
Integer minId = 0;
List<SectionQuestionDetail> sectionQuestionDetails = currentSection.getSectionQuestionDetails();
for (SectionQuestionDetail sectionQuestionDetail : sectionQuestionDetails) {
if (sectionQuestionDetail.getQuestionId() < minId) {
minId = sectionQuestionDetail.getQuestionId();
}
}
return minId - 1;
}
use of org.mifos.platform.questionnaire.service.SectionQuestionDetail in project head by mifos.
the class QuestionGroupForm method markQuestionsOptionalAndReturnToPool.
private void markQuestionsOptionalAndReturnToPool(SectionDetail sectionDetail) {
List<SectionQuestionDetail> sectionQuestionDetails = sectionDetail.getQuestions();
for (SectionQuestionDetail sectionQuestionDetail : sectionQuestionDetails) {
sectionQuestionDetail.setMandatory(false);
questionPool.add(sectionQuestionDetail);
}
}
Aggregations