use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class LoanPrdAction method setSelectedQuestionGroupsOnSession.
// Intentionally made public to aid testing !!!
public void setSelectedQuestionGroupsOnSession(HttpServletRequest request, LoanOfferingBO loanOffering, QuestionnaireServiceFacade questionnaireServiceFacade) throws PageExpiredException {
Set<QuestionGroupReference> questionGroupReferences = loanOffering.getQuestionGroups();
if (questionnaireServiceFacade != null && CollectionUtils.isNotEmpty(questionGroupReferences)) {
List<QuestionGroupDetail> questionGroupDetails = new ArrayList<QuestionGroupDetail>();
for (QuestionGroupReference questionGroupReference : questionGroupReferences) {
Integer questionGroupId = questionGroupReference.getQuestionGroupId();
QuestionGroupDetail questionGroupDetail = questionnaireServiceFacade.getQuestionGroupDetailForLoanPrd(questionGroupId);
if (questionGroupDetail != null && questionGroupDetail.isActive()) {
questionGroupDetails.add(questionGroupDetail);
}
}
SessionUtils.setCollectionAttribute(ProductDefinitionConstants.SELECTEDQGLIST, questionGroupDetails, request);
}
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class ImportLoansSavingsFacadeWebTier method saveLoans.
@Override
public ParsedLoansDto saveLoans(ParsedLoansDto parsedLoansDto) {
List<CreateAccountFeeDto> defaultAccountFees = new ArrayList<CreateAccountFeeDto>();
List<QuestionGroupDetail> questionGroupDetails = new ArrayList<QuestionGroupDetail>();
List<CreateAccountPenaltyDto> defaultPenalties = new ArrayList<CreateAccountPenaltyDto>();
for (ImportedLoanDetail detail : parsedLoansDto.getSuccessfullyParsedRows()) {
LoanCreationLoanDetailsDto lcldd = loanAccountServiceFacade.retrieveLoanDetailsForLoanAccountCreation(detail.getCustomerId(), detail.getPrdOfferingId(), false);
RecurringSchedule recurringSchedule = null;
MeetingDto meetingDto = lcldd.getCustomerMeetingDetail();
int meetingEvery = (lcldd.isRepaymentIndependentOfMeetingEnabled()) ? lcldd.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getEvery() : meetingDto.getMeetingDetailsDto().getEvery();
int loanRecurrenceTypeId = (lcldd.isRepaymentIndependentOfMeetingEnabled()) ? lcldd.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getRecurrenceTypeId() : meetingDto.getMeetingDetailsDto().getRecurrenceTypeId();
if (loanRecurrenceTypeId == 1) {
recurringSchedule = new WeeklySchedule(meetingEvery, meetingDto.getMeetingDetailsDto().getRecurrenceDetails().getDayOfWeek());
} else if (loanRecurrenceTypeId == 2) {
if (meetingDto.getMeetingDetailsDto().getRecurrenceDetails().getWeekOfMonth().equals(0)) {
recurringSchedule = new MonthlyOnDayOfMonthSchedule(meetingEvery, meetingDto.getMeetingDetailsDto().getRecurrenceDetails().getDayNumber());
} else {
recurringSchedule = new MonthlyOnWeekOfMonthSchedule(meetingEvery, meetingDto.getMeetingDetailsDto().getRecurrenceDetails().getWeekOfMonth(), meetingDto.getMeetingDetailsDto().getRecurrenceDetails().getDayOfWeek());
}
} else if (loanRecurrenceTypeId == 3) {
recurringSchedule = new DailySchedule(meetingEvery);
}
CreateLoanAccount cla = new CreateLoanAccount(detail.getCustomerId(), new Integer(detail.getPrdOfferingId()), new Integer(detail.getStatus()), detail.getLoanAmount(), lcldd.getMinLoanAmount(), lcldd.getMaxLoanAmount(), detail.getInterestRate().doubleValue(), new LocalDate(detail.getDisbursalDate().getTime()), null, detail.getNumberOfInstallments(), lcldd.getMinNumberOfInstallments(), lcldd.getMaxNumberOfInstallments(), detail.getGracePeriod(), detail.getSourceOfFundId(), detail.getLoanPurposeId(), detail.getCollateralTypeId(), detail.getCollateralNotes(), detail.getExternalId(), lcldd.isRepaymentIndependentOfMeetingEnabled(), recurringSchedule, defaultAccountFees, defaultPenalties);
cla.setPredefinedAccountNumber(detail.getAccountNumber());
cla.setFlagId(detail.getFlag());
this.loanAccountServiceFacade.createLoan(cla, questionGroupDetails, null);
}
return null;
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class LoanAccountActionTest method getQuestionGroupDetail.
private QuestionGroupDetail getQuestionGroupDetail(String title, List<String> answerChoices) {
QuestionGroupDetail questionGroupDetail = new QuestionGroupDetail();
questionGroupDetail.setTitle(title);
questionGroupDetail.setId(123);
questionGroupDetail.setSectionDetails(asList(getSectionDetail("Section1", "Question1", answerChoices)));
return questionGroupDetail;
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class QuestionGroupFilterForLoanTest method shouldDoFilterForNoQuestionGroupDetails.
@Test
public void shouldDoFilterForNoQuestionGroupDetails() {
QuestionGroupFilterForLoan questionGroupFilterForLoan = new QuestionGroupFilterForLoan();
LoanOfferingBO loanOfferingBO = new LoanProductBuilder().buildForUnitTests();
loanOfferingBO.setQuestionGroups(getQustionGroups(2, 4));
questionGroupFilterForLoan.setLoanOfferingBO(loanOfferingBO);
List<QuestionGroupDetail> filteredQuestionGroupDetails = questionGroupFilterForLoan.doFilter(null, null);
assertThat(filteredQuestionGroupDetails, is(nullValue()));
}
use of org.mifos.platform.questionnaire.service.QuestionGroupDetail in project head by mifos.
the class QuestionnaireServiceImpl method removeInActiveSectionsAndQuestions.
private void removeInActiveSectionsAndQuestions(List<QuestionGroupDetail> questionGroupDetails) {
for (Iterator<QuestionGroupDetail> questionGroupDetailIterator = questionGroupDetails.iterator(); questionGroupDetailIterator.hasNext(); ) {
QuestionGroupDetail questionGroupDetail = questionGroupDetailIterator.next();
removeInActiveSectionsAndQuestions(questionGroupDetail);
if (questionGroupDetail.hasNoActiveSectionsAndQuestions()) {
questionGroupDetailIterator.remove();
}
}
}
Aggregations