Search in sources :

Example 1 with NoOfInstallFromLastLoanAmountBO

use of org.mifos.accounts.productdefinition.business.NoOfInstallFromLastLoanAmountBO in project head by mifos.

the class LoanPrdAction method setDataIntoActionForm.

private void setDataIntoActionForm(LoanOfferingBO loanProduct, LoanPrdActionForm loanPrdActionForm, HttpServletRequest request) throws Exception {
    logger.debug("start setDataIntoActionForm method of Loan Product Action ");
    loanPrdActionForm.setPrdOfferingId(getStringValue(loanProduct.getPrdOfferingId()));
    loanPrdActionForm.setPrdOfferingName(loanProduct.getPrdOfferingName());
    loanPrdActionForm.setPrdOfferingShortName(loanProduct.getPrdOfferingShortName());
    loanPrdActionForm.setPrdCategory(getStringValue(loanProduct.getPrdCategory().getProductCategoryID()));
    loanPrdActionForm.setPrdStatus(getStringValue(loanProduct.getStatus().getValue()));
    loanPrdActionForm.setPrdApplicableMaster(loanProduct.getPrdApplicableMasterEnum());
    loanPrdActionForm.setStartDate(DateUtils.getUserLocaleDate(getUserContext(request).getPreferredLocale(), DateUtils.toDatabaseFormat(loanProduct.getStartDate())));
    loanPrdActionForm.setEndDate(loanProduct.getEndDate() != null ? DateUtils.getUserLocaleDate(getUserContext(request).getPreferredLocale(), DateUtils.toDatabaseFormat(loanProduct.getEndDate())) : null);
    loanPrdActionForm.setDescription(loanProduct.getDescription());
    loanPrdActionForm.setGracePeriodType(getStringValue(loanProduct.getGracePeriodType().getId()));
    loanPrdActionForm.setGracePeriodDuration(getStringValue(loanProduct.getGracePeriodDuration()));
    loanPrdActionForm.setInterestTypes(getStringValue(loanProduct.getInterestTypes().getId()));
    loanPrdActionForm.setMaxInterestRate(getDoubleStringForInterest(loanProduct.getMaxInterestRate()));
    loanPrdActionForm.setMinInterestRate(getDoubleStringForInterest(loanProduct.getMinInterestRate()));
    loanPrdActionForm.setDefInterestRate(getDoubleStringForInterest(loanProduct.getDefInterestRate()));
    loanPrdActionForm.setIntDedDisbursementFlag(getStringValue(loanProduct.isIntDedDisbursement()));
    loanPrdActionForm.setPrinDueLastInstFlag(getStringValue(loanProduct.isPrinDueLastInst()));
    loanPrdActionForm.setLoanCounter(getStringValue(loanProduct.isIncludeInLoanCounter()));
    loanPrdActionForm.setWaiverInterest(getStringValue(loanProduct.isInterestWaived()));
    loanPrdActionForm.setRecurAfter(getStringValue(loanProduct.getLoanOfferingMeeting().getMeeting().getMeetingDetails().getRecurAfter()));
    loanPrdActionForm.setFreqOfInstallments(getStringValue(loanProduct.getLoanOfferingMeeting().getMeeting().getMeetingDetails().getRecurrenceType().getRecurrenceId()));
    loanPrdActionForm.setPrincipalGLCode(getStringValue(loanProduct.getPrincipalGLcode().getGlcodeId()));
    loanPrdActionForm.setInterestGLCode(getStringValue(loanProduct.getInterestGLcode().getGlcodeId()));
    setVariableInstallmentDetailsOnLoanProductForm(loanPrdActionForm, loanProduct);
    loanPrdActionForm.setIsFixedRepaymentSchedule(loanProduct.isFixedRepaymentSchedule());
    loanPrdActionForm.setIsRoundingDifferenceInFirstPayment(loanProduct.isRoundingDifferenceInFirstPayment());
    loanPrdActionForm.setCashFlowValidation(loanProduct.isCashFlowCheckEnabled());
    CashFlowDetail cashFlowDetail = loanProduct.getCashFlowDetail();
    if (cashFlowDetail != null) {
        Double cashFlowThreshold = cashFlowDetail.getCashFlowThreshold();
        if (cashFlowThreshold != null) {
            loanPrdActionForm.setCashFlowThreshold(String.valueOf(cashFlowThreshold));
        }
        Double indebtednessRatio = cashFlowDetail.getIndebtednessRatio();
        if (indebtednessRatio != null) {
            loanPrdActionForm.setIndebtednessRatio(String.valueOf(indebtednessRatio));
        }
        Double repaymentCapacity = cashFlowDetail.getRepaymentCapacity();
        if (repaymentCapacity != null) {
            loanPrdActionForm.setRepaymentCapacity(String.valueOf(repaymentCapacity));
        }
    }
    if (loanProduct.isLoanAmountTypeSameForAllLoan()) {
        loanPrdActionForm.setLoanAmtCalcType(getStringValue(ProductDefinitionConstants.LOANAMOUNTSAMEFORALLLOAN));
        Iterator<LoanAmountSameForAllLoanBO> loanAmountSameForAllItr = loanProduct.getLoanAmountSameForAllLoan().iterator();
        while (loanAmountSameForAllItr.hasNext()) {
            LoanAmountSameForAllLoanBO loanAmountSameForAllLoanBO = loanAmountSameForAllItr.next();
            loanPrdActionForm.setMaxLoanAmount(getDoubleStringForMoney(loanAmountSameForAllLoanBO.getMaxLoanAmount()));
            loanPrdActionForm.setMinLoanAmount(getDoubleStringForMoney(loanAmountSameForAllLoanBO.getMinLoanAmount()));
            loanPrdActionForm.setDefaultLoanAmount(getDoubleStringForMoney(loanAmountSameForAllLoanBO.getDefaultLoanAmount()));
        }
    }
    if (loanProduct.isLoanAmountTypeAsOfLastLoanAmount()) {
        loanPrdActionForm.setLoanAmtCalcType(getStringValue(ProductDefinitionConstants.LOANAMOUNTFROMLASTLOAN));
        Iterator<LoanAmountFromLastLoanAmountBO> loanAmountFromLastLoanAmountItr = loanProduct.getLoanAmountFromLastLoan().iterator();
        while (loanAmountFromLastLoanAmountItr.hasNext()) {
            LoanAmountFromLastLoanAmountBO loanAmountFromLastLoanAmountBO = loanAmountFromLastLoanAmountItr.next();
            loanPrdActionForm.setLastLoanMinLoanAmt1(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMinLoanAmount()));
            loanPrdActionForm.setLastLoanMaxLoanAmt1(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMaxLoanAmount()));
            loanPrdActionForm.setLastLoanDefaultLoanAmt1(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getDefaultLoanAmount()));
            loanPrdActionForm.setStartRangeLoanAmt1(loanAmountFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndRangeLoanAmt1(loanAmountFromLastLoanAmountBO.getEndRange().intValue());
            loanAmountFromLastLoanAmountBO = loanAmountFromLastLoanAmountItr.next();
            loanPrdActionForm.setLastLoanMinLoanAmt2(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMinLoanAmount()));
            loanPrdActionForm.setLastLoanMaxLoanAmt2(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMaxLoanAmount()));
            loanPrdActionForm.setLastLoanDefaultLoanAmt2(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getDefaultLoanAmount()));
            loanPrdActionForm.setStartRangeLoanAmt2(loanAmountFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndRangeLoanAmt2(loanAmountFromLastLoanAmountBO.getEndRange().intValue());
            loanAmountFromLastLoanAmountBO = loanAmountFromLastLoanAmountItr.next();
            loanPrdActionForm.setLastLoanMinLoanAmt3(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMinLoanAmount()));
            loanPrdActionForm.setLastLoanMaxLoanAmt3(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMaxLoanAmount()));
            loanPrdActionForm.setLastLoanDefaultLoanAmt3(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getDefaultLoanAmount()));
            loanPrdActionForm.setStartRangeLoanAmt3(loanAmountFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndRangeLoanAmt3(loanAmountFromLastLoanAmountBO.getEndRange().intValue());
            loanAmountFromLastLoanAmountBO = loanAmountFromLastLoanAmountItr.next();
            loanPrdActionForm.setLastLoanMinLoanAmt4(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMinLoanAmount()));
            loanPrdActionForm.setLastLoanMaxLoanAmt4(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMaxLoanAmount()));
            loanPrdActionForm.setLastLoanDefaultLoanAmt4(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getDefaultLoanAmount()));
            loanPrdActionForm.setStartRangeLoanAmt4(loanAmountFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndRangeLoanAmt4(loanAmountFromLastLoanAmountBO.getEndRange().intValue());
            loanAmountFromLastLoanAmountBO = loanAmountFromLastLoanAmountItr.next();
            loanPrdActionForm.setLastLoanMinLoanAmt5(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMinLoanAmount()));
            loanPrdActionForm.setLastLoanMaxLoanAmt5(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMaxLoanAmount()));
            loanPrdActionForm.setLastLoanDefaultLoanAmt5(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getDefaultLoanAmount()));
            loanPrdActionForm.setStartRangeLoanAmt5(loanAmountFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndRangeLoanAmt5(loanAmountFromLastLoanAmountBO.getEndRange().intValue());
            loanAmountFromLastLoanAmountBO = loanAmountFromLastLoanAmountItr.next();
            loanPrdActionForm.setLastLoanMinLoanAmt6(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMinLoanAmount()));
            loanPrdActionForm.setLastLoanMaxLoanAmt6(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getMaxLoanAmount()));
            loanPrdActionForm.setLastLoanDefaultLoanAmt6(getDoubleStringForMoney(loanAmountFromLastLoanAmountBO.getDefaultLoanAmount()));
            loanPrdActionForm.setStartRangeLoanAmt6(loanAmountFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndRangeLoanAmt6(loanAmountFromLastLoanAmountBO.getEndRange().intValue());
        }
    }
    if (loanProduct.isLoanAmountTypeFromLoanCycle()) {
        loanPrdActionForm.setLoanAmtCalcType(getStringValue(ProductDefinitionConstants.LOANAMOUNTFROMLOANCYCLE));
        Iterator<LoanAmountFromLoanCycleBO> loanAmountFromLoanCycleItr = loanProduct.getLoanAmountFromLoanCycle().iterator();
        while (loanAmountFromLoanCycleItr.hasNext()) {
            LoanAmountFromLoanCycleBO loanAmountFromLoanCycleBO = loanAmountFromLoanCycleItr.next();
            loanPrdActionForm.setCycleLoanMinLoanAmt1(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMinLoanAmount()));
            loanPrdActionForm.setCycleLoanMaxLoanAmt1(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMaxLoanAmount()));
            loanPrdActionForm.setCycleLoanDefaultLoanAmt1(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getDefaultLoanAmount()));
            loanAmountFromLoanCycleBO = loanAmountFromLoanCycleItr.next();
            loanPrdActionForm.setCycleLoanMinLoanAmt2(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMinLoanAmount()));
            loanPrdActionForm.setCycleLoanMaxLoanAmt2(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMaxLoanAmount()));
            loanPrdActionForm.setCycleLoanDefaultLoanAmt2(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getDefaultLoanAmount()));
            loanAmountFromLoanCycleBO = loanAmountFromLoanCycleItr.next();
            loanPrdActionForm.setCycleLoanMinLoanAmt3(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMinLoanAmount()));
            loanPrdActionForm.setCycleLoanMaxLoanAmt3(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMaxLoanAmount()));
            loanPrdActionForm.setCycleLoanDefaultLoanAmt3(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getDefaultLoanAmount()));
            loanAmountFromLoanCycleBO = loanAmountFromLoanCycleItr.next();
            loanPrdActionForm.setCycleLoanMinLoanAmt4(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMinLoanAmount()));
            loanPrdActionForm.setCycleLoanMaxLoanAmt4(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMaxLoanAmount()));
            loanPrdActionForm.setCycleLoanDefaultLoanAmt4(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getDefaultLoanAmount()));
            loanAmountFromLoanCycleBO = loanAmountFromLoanCycleItr.next();
            loanPrdActionForm.setCycleLoanMinLoanAmt5(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMinLoanAmount()));
            loanPrdActionForm.setCycleLoanMaxLoanAmt5(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMaxLoanAmount()));
            loanPrdActionForm.setCycleLoanDefaultLoanAmt5(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getDefaultLoanAmount()));
            loanAmountFromLoanCycleBO = loanAmountFromLoanCycleItr.next();
            loanPrdActionForm.setCycleLoanMinLoanAmt6(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMinLoanAmount()));
            loanPrdActionForm.setCycleLoanMaxLoanAmt6(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getMaxLoanAmount()));
            loanPrdActionForm.setCycleLoanDefaultLoanAmt6(getDoubleStringForMoney(loanAmountFromLoanCycleBO.getDefaultLoanAmount()));
        }
    }
    if (loanProduct.isNoOfInstallTypeSameForAllLoan()) {
        loanPrdActionForm.setCalcInstallmentType(getStringValue(ProductDefinitionConstants.NOOFINSTALLSAMEFORALLLOAN));
        Iterator<NoOfInstallSameForAllLoanBO> noOfInstallSameForAllLoanItr = loanProduct.getNoOfInstallSameForAllLoan().iterator();
        while (noOfInstallSameForAllLoanItr.hasNext()) {
            NoOfInstallSameForAllLoanBO noOfInstallSameForAllLoanBO = noOfInstallSameForAllLoanItr.next();
            loanPrdActionForm.setMaxNoInstallments(getStringValue(noOfInstallSameForAllLoanBO.getMaxNoOfInstall()));
            loanPrdActionForm.setMinNoInstallments(getStringValue(noOfInstallSameForAllLoanBO.getMinNoOfInstall()));
            loanPrdActionForm.setDefNoInstallments(getStringValue(noOfInstallSameForAllLoanBO.getDefaultNoOfInstall()));
        }
    }
    if (loanProduct.isNoOfInstallTypeFromLastLoan()) {
        loanPrdActionForm.setCalcInstallmentType(getStringValue(ProductDefinitionConstants.NOOFINSTALLFROMLASTLOAN));
        Iterator<NoOfInstallFromLastLoanAmountBO> noOfInstallFromLastAmountItr = loanProduct.getNoOfInstallFromLastLoan().iterator();
        while (noOfInstallFromLastAmountItr.hasNext()) {
            NoOfInstallFromLastLoanAmountBO noOfInstallFromLastLoanAmountBO = noOfInstallFromLastAmountItr.next();
            loanPrdActionForm.setMinLoanInstallment1(getStringValue(noOfInstallFromLastLoanAmountBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxLoanInstallment1(getStringValue(noOfInstallFromLastLoanAmountBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefLoanInstallment1(getStringValue(noOfInstallFromLastLoanAmountBO.getDefaultNoOfInstall()));
            loanPrdActionForm.setStartInstallmentRange1(noOfInstallFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndInstallmentRange1(noOfInstallFromLastLoanAmountBO.getEndRange().intValue());
            noOfInstallFromLastLoanAmountBO = noOfInstallFromLastAmountItr.next();
            loanPrdActionForm.setMinLoanInstallment2(getStringValue(noOfInstallFromLastLoanAmountBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxLoanInstallment2(getStringValue(noOfInstallFromLastLoanAmountBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefLoanInstallment2(getStringValue(noOfInstallFromLastLoanAmountBO.getDefaultNoOfInstall()));
            loanPrdActionForm.setStartInstallmentRange2(noOfInstallFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndInstallmentRange2(noOfInstallFromLastLoanAmountBO.getEndRange().intValue());
            noOfInstallFromLastLoanAmountBO = noOfInstallFromLastAmountItr.next();
            loanPrdActionForm.setMinLoanInstallment3(getStringValue(noOfInstallFromLastLoanAmountBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxLoanInstallment3(getStringValue(noOfInstallFromLastLoanAmountBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefLoanInstallment3(getStringValue(noOfInstallFromLastLoanAmountBO.getDefaultNoOfInstall()));
            loanPrdActionForm.setStartInstallmentRange3(noOfInstallFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndInstallmentRange3(noOfInstallFromLastLoanAmountBO.getEndRange().intValue());
            noOfInstallFromLastLoanAmountBO = noOfInstallFromLastAmountItr.next();
            loanPrdActionForm.setMinLoanInstallment4(getStringValue(noOfInstallFromLastLoanAmountBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxLoanInstallment4(getStringValue(noOfInstallFromLastLoanAmountBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefLoanInstallment4(getStringValue(noOfInstallFromLastLoanAmountBO.getDefaultNoOfInstall()));
            loanPrdActionForm.setStartInstallmentRange4(noOfInstallFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndInstallmentRange4(noOfInstallFromLastLoanAmountBO.getEndRange().intValue());
            noOfInstallFromLastLoanAmountBO = noOfInstallFromLastAmountItr.next();
            loanPrdActionForm.setMinLoanInstallment5(getStringValue(noOfInstallFromLastLoanAmountBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxLoanInstallment5(getStringValue(noOfInstallFromLastLoanAmountBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefLoanInstallment5(getStringValue(noOfInstallFromLastLoanAmountBO.getDefaultNoOfInstall()));
            loanPrdActionForm.setStartInstallmentRange5(noOfInstallFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndInstallmentRange5(noOfInstallFromLastLoanAmountBO.getEndRange().intValue());
            noOfInstallFromLastLoanAmountBO = noOfInstallFromLastAmountItr.next();
            loanPrdActionForm.setMinLoanInstallment6(getStringValue(noOfInstallFromLastLoanAmountBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxLoanInstallment6(getStringValue(noOfInstallFromLastLoanAmountBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefLoanInstallment6(getStringValue(noOfInstallFromLastLoanAmountBO.getDefaultNoOfInstall()));
            loanPrdActionForm.setStartInstallmentRange6(noOfInstallFromLastLoanAmountBO.getStartRange().intValue());
            loanPrdActionForm.setEndInstallmentRange6(noOfInstallFromLastLoanAmountBO.getEndRange().intValue());
        }
    }
    if (loanProduct.isNoOfInstallTypeFromLoanCycle()) {
        loanPrdActionForm.setCalcInstallmentType(getStringValue(ProductDefinitionConstants.NOOFINSTALLFROMLOANCYCLLE));
        Iterator<NoOfInstallFromLoanCycleBO> noOfInstallFromLoanCycleItr = loanProduct.getNoOfInstallFromLoanCycle().iterator();
        while (noOfInstallFromLoanCycleItr.hasNext()) {
            NoOfInstallFromLoanCycleBO noOfInstallFromLoanCycleBO = noOfInstallFromLoanCycleItr.next();
            loanPrdActionForm.setMinCycleInstallment1(getStringValue(noOfInstallFromLoanCycleBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxCycleInstallment1(getStringValue(noOfInstallFromLoanCycleBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefCycleInstallment1(getStringValue(noOfInstallFromLoanCycleBO.getDefaultNoOfInstall()));
            noOfInstallFromLoanCycleBO = noOfInstallFromLoanCycleItr.next();
            loanPrdActionForm.setMinCycleInstallment2(getStringValue(noOfInstallFromLoanCycleBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxCycleInstallment2(getStringValue(noOfInstallFromLoanCycleBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefCycleInstallment2(getStringValue(noOfInstallFromLoanCycleBO.getDefaultNoOfInstall()));
            noOfInstallFromLoanCycleBO = noOfInstallFromLoanCycleItr.next();
            loanPrdActionForm.setMinCycleInstallment3(getStringValue(noOfInstallFromLoanCycleBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxCycleInstallment3(getStringValue(noOfInstallFromLoanCycleBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefCycleInstallment3(getStringValue(noOfInstallFromLoanCycleBO.getDefaultNoOfInstall()));
            noOfInstallFromLoanCycleBO = noOfInstallFromLoanCycleItr.next();
            loanPrdActionForm.setMinCycleInstallment4(getStringValue(noOfInstallFromLoanCycleBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxCycleInstallment4(getStringValue(noOfInstallFromLoanCycleBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefCycleInstallment4(getStringValue(noOfInstallFromLoanCycleBO.getDefaultNoOfInstall()));
            noOfInstallFromLoanCycleBO = noOfInstallFromLoanCycleItr.next();
            loanPrdActionForm.setMinCycleInstallment5(getStringValue(noOfInstallFromLoanCycleBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxCycleInstallment5(getStringValue(noOfInstallFromLoanCycleBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefCycleInstallment5(getStringValue(noOfInstallFromLoanCycleBO.getDefaultNoOfInstall()));
            noOfInstallFromLoanCycleBO = noOfInstallFromLoanCycleItr.next();
            loanPrdActionForm.setMinCycleInstallment6(getStringValue(noOfInstallFromLoanCycleBO.getMinNoOfInstall()));
            loanPrdActionForm.setMaxCycleInstallment6(getStringValue(noOfInstallFromLoanCycleBO.getMaxNoOfInstall()));
            loanPrdActionForm.setDefCycleInstallment6(getStringValue(noOfInstallFromLoanCycleBO.getDefaultNoOfInstall()));
        }
    }
    SessionUtils.setAttribute(ProductDefinitionConstants.LOANPRDSTARTDATE, loanProduct.getStartDate(), request);
    logger.debug("setDataIntoActionForm method of Loan Product Action called");
}
Also used : CashFlowDetail(org.mifos.accounts.productdefinition.business.CashFlowDetail) NoOfInstallSameForAllLoanBO(org.mifos.accounts.productdefinition.business.NoOfInstallSameForAllLoanBO) LoanAmountFromLastLoanAmountBO(org.mifos.accounts.productdefinition.business.LoanAmountFromLastLoanAmountBO) NoOfInstallFromLastLoanAmountBO(org.mifos.accounts.productdefinition.business.NoOfInstallFromLastLoanAmountBO) LoanAmountFromLoanCycleBO(org.mifos.accounts.productdefinition.business.LoanAmountFromLoanCycleBO) LoanAmountSameForAllLoanBO(org.mifos.accounts.productdefinition.business.LoanAmountSameForAllLoanBO) NoOfInstallFromLoanCycleBO(org.mifos.accounts.productdefinition.business.NoOfInstallFromLoanCycleBO)

Example 2 with NoOfInstallFromLastLoanAmountBO

use of org.mifos.accounts.productdefinition.business.NoOfInstallFromLastLoanAmountBO in project head by mifos.

the class LoanProductCaluclationTypeAssembler method assembleLoanInstallmentCalculationFromDto.

public LoanInstallmentCalculation assembleLoanInstallmentCalculationFromDto(LoanAmountDetailsDto installmentCalculationDetails) {
    NoOfInstallSameForAllLoanBO sameForAll = null;
    Set<NoOfInstallFromLastLoanAmountBO> fromLastLoan = new HashSet<NoOfInstallFromLastLoanAmountBO>();
    Set<NoOfInstallFromLoanCycleBO> fromLoanCycle = new HashSet<NoOfInstallFromLoanCycleBO>();
    LoanProductCalculationType installmentCalculation = LoanProductCalculationType.fromInt(installmentCalculationDetails.getCalculationType());
    switch(installmentCalculation) {
        case SAME_FOR_ALL_LOANS:
            sameForAll = new NoOfInstallSameForAllLoanBO(installmentCalculationDetails.getSameForAllLoanRange().getMin().shortValue(), installmentCalculationDetails.getSameForAllLoanRange().getMax().shortValue(), installmentCalculationDetails.getSameForAllLoanRange().getTheDefault().shortValue(), null);
            break;
        case BY_LAST_LOAN:
            List<LowerUpperMinMaxDefaultDto> byLastAmount = installmentCalculationDetails.getByLastLoanAmountList();
            for (LowerUpperMinMaxDefaultDto bean : byLastAmount) {
                fromLastLoan.add(new NoOfInstallFromLastLoanAmountBO(bean.getMin().shortValue(), bean.getMax().shortValue(), bean.getTheDefault().shortValue(), bean.getLower().doubleValue(), bean.getUpper().doubleValue(), null));
            }
            break;
        case BY_LOAN_CYCLE:
            List<MinMaxDefaultDto> byCycle = installmentCalculationDetails.getByLoanCycleList();
            Short rangeIndex = Short.valueOf("0");
            for (MinMaxDefaultDto bean : byCycle) {
                fromLoanCycle.add(new NoOfInstallFromLoanCycleBO(bean.getMin().shortValue(), bean.getMax().shortValue(), bean.getTheDefault().shortValue(), rangeIndex, null));
                rangeIndex++;
            }
            break;
        default:
            break;
    }
    return new LoanInstallmentCalculation(sameForAll, fromLastLoan, fromLoanCycle);
}
Also used : NoOfInstallSameForAllLoanBO(org.mifos.accounts.productdefinition.business.NoOfInstallSameForAllLoanBO) LowerUpperMinMaxDefaultDto(org.mifos.dto.domain.LowerUpperMinMaxDefaultDto) MinMaxDefaultDto(org.mifos.dto.domain.MinMaxDefaultDto) LowerUpperMinMaxDefaultDto(org.mifos.dto.domain.LowerUpperMinMaxDefaultDto) NoOfInstallFromLastLoanAmountBO(org.mifos.accounts.productdefinition.business.NoOfInstallFromLastLoanAmountBO) NoOfInstallFromLoanCycleBO(org.mifos.accounts.productdefinition.business.NoOfInstallFromLoanCycleBO) HashSet(java.util.HashSet)

Aggregations

NoOfInstallFromLastLoanAmountBO (org.mifos.accounts.productdefinition.business.NoOfInstallFromLastLoanAmountBO)2 NoOfInstallFromLoanCycleBO (org.mifos.accounts.productdefinition.business.NoOfInstallFromLoanCycleBO)2 NoOfInstallSameForAllLoanBO (org.mifos.accounts.productdefinition.business.NoOfInstallSameForAllLoanBO)2 HashSet (java.util.HashSet)1 CashFlowDetail (org.mifos.accounts.productdefinition.business.CashFlowDetail)1 LoanAmountFromLastLoanAmountBO (org.mifos.accounts.productdefinition.business.LoanAmountFromLastLoanAmountBO)1 LoanAmountFromLoanCycleBO (org.mifos.accounts.productdefinition.business.LoanAmountFromLoanCycleBO)1 LoanAmountSameForAllLoanBO (org.mifos.accounts.productdefinition.business.LoanAmountSameForAllLoanBO)1 LowerUpperMinMaxDefaultDto (org.mifos.dto.domain.LowerUpperMinMaxDefaultDto)1 MinMaxDefaultDto (org.mifos.dto.domain.MinMaxDefaultDto)1