use of org.mifos.dto.domain.ProductDetailsDto in project head by mifos.
the class LoanProductFormBeanAssembler method translateToLoanProductDetails.
private ProductDetailsDto translateToLoanProductDetails(LoanProductFormBean loanProductFormBean) {
Integer category = Integer.valueOf(loanProductFormBean.getGeneralDetails().getSelectedCategory());
Integer applicableFor = Integer.valueOf(loanProductFormBean.getGeneralDetails().getSelectedApplicableFor());
DateTime startDate = new DateTime().withDate(Integer.valueOf(loanProductFormBean.getGeneralDetails().getStartDateYear()), loanProductFormBean.getGeneralDetails().getStartDateMonth(), loanProductFormBean.getGeneralDetails().getStartDateDay());
DateTime endDate = null;
if (StringUtils.isNotBlank(loanProductFormBean.getGeneralDetails().getEndDateYear())) {
endDate = new DateTime().withDate(Integer.valueOf(loanProductFormBean.getGeneralDetails().getEndDateYear()), loanProductFormBean.getGeneralDetails().getEndDateMonth(), loanProductFormBean.getGeneralDetails().getEndDateDay());
}
ProductDetailsDto productDetailsDto = new ProductDetailsDto(loanProductFormBean.getGeneralDetails().getName(), loanProductFormBean.getGeneralDetails().getShortName(), loanProductFormBean.getGeneralDetails().getDescription(), category, startDate, endDate, applicableFor);
productDetailsDto.setId(loanProductFormBean.getGeneralDetails().getId());
if (StringUtils.isNotBlank(loanProductFormBean.getGeneralDetails().getSelectedStatus())) {
productDetailsDto.setStatus(Integer.valueOf(loanProductFormBean.getGeneralDetails().getSelectedStatus()));
}
return productDetailsDto;
}
use of org.mifos.dto.domain.ProductDetailsDto in project head by mifos.
the class LoanProductFormBeanAssembler method toLoanProductDto.
public LoanProductRequest toLoanProductDto(LoanProductFormBean loanProductFormBean) {
ProductDetailsDto loanProductDetails = translateToLoanProductDetails(loanProductFormBean);
LoanAmountDetailsDto loanAmountDetails = translateToLoanAmountDetails(loanProductFormBean);
Integer interestRateType = Integer.valueOf(loanProductFormBean.getSelectedInterestRateCalculationType());
Double maxInterest = Double.valueOf(loanProductFormBean.getMaxInterestRate());
Double minInterest = Double.valueOf(loanProductFormBean.getMinInterestRate());
Double defaultInterest = Double.valueOf(loanProductFormBean.getDefaultInterestRate());
MinMaxDefaultDto interestRateRange = MinMaxDefaultDto.create(minInterest, maxInterest, defaultInterest);
RepaymentDetailsDto repaymentDetails = translateToRepaymentDetails(loanProductFormBean);
List<Integer> applicableFees = new ArrayList<Integer>();
if (loanProductFormBean.getSelectedFees() != null) {
for (String feeId : loanProductFormBean.getSelectedFees()) {
applicableFees.add(Integer.valueOf(feeId));
}
}
List<Integer> applicablePenalties = new ArrayList<Integer>();
if (loanProductFormBean.getSelectedPenalties() != null) {
for (String penaltyId : loanProductFormBean.getSelectedPenalties()) {
applicablePenalties.add(Integer.valueOf(penaltyId));
}
}
AccountingDetailsDto accountDetails = translateToAccountingDetails(loanProductFormBean);
Integer currencyId = null;
if (StringUtils.isNotBlank(loanProductFormBean.getSelectedCurrency())) {
currencyId = Integer.valueOf(loanProductFormBean.getSelectedCurrency());
}
return new LoanProductRequest(loanProductDetails, loanProductFormBean.isIncludeInLoanCycleCounter(), loanProductFormBean.isWaiverInterest(), currencyId, loanAmountDetails, interestRateType, interestRateRange, repaymentDetails, applicableFees, applicablePenalties, accountDetails);
}
Aggregations