use of org.mifos.dto.domain.LowerUpperMinMaxDefaultDto in project head by mifos.
the class LoanProductFormBeanAssembler method populateLoanAmountCalculationDetails.
private void populateLoanAmountCalculationDetails(LoanProductFormBean loanProductFormBean, LoanAmountDetailsDto loanAmountDetailsDto) {
loanProductFormBean.setSelectedLoanAmountCalculationType(loanAmountDetailsDto.getCalculationType().toString());
SameForAllLoanBean loanAmountSameForAllLoans = new SameForAllLoanBean();
if (loanAmountDetailsDto.getSameForAllLoanRange() != null) {
loanAmountSameForAllLoans.setMin(loanAmountDetailsDto.getSameForAllLoanRange().getMin().doubleValue());
loanAmountSameForAllLoans.setMax(loanAmountDetailsDto.getSameForAllLoanRange().getMax().doubleValue());
loanAmountSameForAllLoans.setTheDefault(loanAmountDetailsDto.getSameForAllLoanRange().getTheDefault().doubleValue());
}
ByLastLoanAmountBean[] loanAmountByLastLoanAmount = loanProductFormBean.createByLastLoanAmountBeans();
int loanAmountByLastLoanAmountIndex = 0;
for (LowerUpperMinMaxDefaultDto dto : loanAmountDetailsDto.getByLastLoanAmountList()) {
ByLastLoanAmountBean bean = loanAmountByLastLoanAmount[loanAmountByLastLoanAmountIndex];
bean.setLower(dto.getLower().doubleValue());
bean.setUpper(dto.getUpper().doubleValue());
bean.setMin(dto.getMin().doubleValue());
bean.setMax(dto.getMax().doubleValue());
bean.setTheDefault(dto.getTheDefault().doubleValue());
loanAmountByLastLoanAmountIndex++;
}
ByLoanCycleBean[] loanAmountByLoanCycle = loanProductFormBean.createByLoanCycleBeans();
int loanAmountCycleIndex = 0;
for (MinMaxDefaultDto dto : loanAmountDetailsDto.getByLoanCycleList()) {
ByLoanCycleBean bean = loanAmountByLoanCycle[loanAmountCycleIndex];
bean.setMin(dto.getMin().doubleValue());
bean.setMax(dto.getMax().doubleValue());
bean.setTheDefault(dto.getTheDefault().doubleValue());
loanAmountCycleIndex++;
}
loanProductFormBean.setLoanAmountSameForAllLoans(loanAmountSameForAllLoans);
loanProductFormBean.setLoanAmountByLastLoanAmount(loanAmountByLastLoanAmount);
loanProductFormBean.setLoanAmountByLoanCycle(loanAmountByLoanCycle);
}
use of org.mifos.dto.domain.LowerUpperMinMaxDefaultDto in project head by mifos.
the class LoanProductFormBeanAssembler method translateToLoanAmountDetails.
private LoanAmountDetailsDto translateToLoanAmountDetails(LoanProductFormBean loanProductFormBean) {
Integer calculationType = Integer.valueOf(loanProductFormBean.getSelectedLoanAmountCalculationType());
MinMaxDefaultDto sameForAllLoanRange = null;
List<LowerUpperMinMaxDefaultDto> byLastLoanAmountList = new ArrayList<LowerUpperMinMaxDefaultDto>();
List<MinMaxDefaultDto> byLoanCycleList = new ArrayList<MinMaxDefaultDto>();
if (Integer.valueOf(1).equals(calculationType)) {
sameForAllLoanRange = translateSameForAllLoanBeanToMinMaxDefaultDto(loanProductFormBean.getLoanAmountSameForAllLoans());
}
if (Integer.valueOf(2).equals(calculationType)) {
byLastLoanAmountList = translateByLastLoanAmountBeanToLowerUpperMinMaxDefaultDto(loanProductFormBean.getLoanAmountByLastLoanAmount());
}
if (Integer.valueOf(3).equals(calculationType)) {
byLoanCycleList = translateLoanCycleBeanToMinMaxDefaultDto(loanProductFormBean.getLoanAmountByLoanCycle());
}
return new LoanAmountDetailsDto(calculationType, sameForAllLoanRange, byLastLoanAmountList, byLoanCycleList);
}
Aggregations