use of org.mifos.dto.domain.PenaltyDto in project head by mifos.
the class LoanPrdAction method getPenaltyViewList.
private List<PenaltyDto> getPenaltyViewList(List<PenaltyBO> penalties) {
logger.debug("start getPenaltyViewList method of Loan Product Action ");
List<PenaltyDto> penaltyDtos = new ArrayList<PenaltyDto>();
if (penalties != null && penalties.size() > 0) {
for (PenaltyBO penalty : penalties) {
penaltyDtos.add(penalty.toDto());
}
}
logger.debug("getPenaltyViewList method of Loan Product Action called");
return penaltyDtos.size() > 0 ? penaltyDtos : null;
}
use of org.mifos.dto.domain.PenaltyDto in project head by mifos.
the class PenaltyBO method toDto.
public PenaltyDto toDto() {
PenaltyDto dto = new PenaltyDto();
dto.setPenaltyId(Short.toString(this.penaltyId));
dto.setPenaltyName(this.penaltyName);
dto.setStatus(this.status.toDto());
dto.setCategoryType(this.categoryType.toDto());
dto.setPeriodType(this.periodType.toDto());
dto.setPeriodDuration(this.periodDuration == null ? null : Integer.toString(this.periodDuration));
dto.setMinimumLimit(Double.toString(this.minimumLimit));
dto.setMaximumLimit(Double.toString(this.maximumLimit));
dto.setPenaltyFrequency(this.penaltyFrequency.toDto());
dto.setGlCodeDto(this.glCode.toDto());
if (this instanceof AmountPenaltyBO) {
Money amount = ((AmountPenaltyBO) this).getAmount();
dto.setCurrencyId(amount.getCurrency().getCurrencyId().intValue());
dto.setAmount(amount.toString(AccountingRules.getDigitsAfterDecimal()));
dto.setRateBasedPenalty(false);
} else {
RatePenaltyBO rate = (RatePenaltyBO) this;
dto.setRate(rate.getRate());
dto.setPenaltyFormula(rate.getFormula().toDto());
dto.setRateBasedPenalty(true);
}
return dto;
}
use of org.mifos.dto.domain.PenaltyDto in project head by mifos.
the class LoanAccountServiceFacadeWebTier method retrieveLoanDetailsForLoanAccountCreation.
@Override
public LoanCreationLoanDetailsDto retrieveLoanDetailsForLoanAccountCreation(Integer customerId, Short productId, boolean isLoanWithBackdatedPayments) {
try {
List<org.mifos.dto.domain.FeeDto> additionalFees = new ArrayList<org.mifos.dto.domain.FeeDto>();
List<org.mifos.dto.domain.FeeDto> defaultFees = new ArrayList<org.mifos.dto.domain.FeeDto>();
List<PenaltyDto> defaultPenalties = new ArrayList<PenaltyDto>();
LoanOfferingBO loanProduct = this.loanProductDao.findById(productId.intValue());
MeetingBO loanProductMeeting = loanProduct.getLoanOfferingMeetingValue();
MeetingDto loanOfferingMeetingDto = loanProductMeeting.toDto();
List<FeeBO> fees = this.feeDao.getAllAppllicableFeeForLoanCreation();
for (FeeBO fee : fees) {
if (!fee.isPeriodic() || (MeetingBO.isMeetingMatched(fee.getFeeFrequency().getFeeMeetingFrequency(), loanProductMeeting))) {
org.mifos.dto.domain.FeeDto feeDto = fee.toDto();
FeeFrequencyType feeFrequencyType = FeeFrequencyType.getFeeFrequencyType(fee.getFeeFrequency().getFeeFrequencyType().getId());
FeeFrequencyTypeEntity feeFrequencyEntity = this.loanProductDao.retrieveFeeFrequencyType(feeFrequencyType);
String feeFrequencyTypeName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(feeFrequencyEntity.getLookUpValue());
feeDto.setFeeFrequencyType(feeFrequencyTypeName);
if (feeDto.getFeeFrequency().isOneTime()) {
FeePayment feePayment = FeePayment.getFeePayment(fee.getFeeFrequency().getFeePayment().getId());
FeePaymentEntity feePaymentEntity = this.loanProductDao.retrieveFeePaymentType(feePayment);
String feePaymentName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(feePaymentEntity.getLookUpValue());
feeDto.getFeeFrequency().setPayment(feePaymentName);
}
if (loanProduct.isFeePresent(fee)) {
defaultFees.add(feeDto);
} else {
additionalFees.add(feeDto);
}
}
}
List<PenaltyBO> penalties = this.penaltyDao.getAllAppllicablePenaltyForLoanCreation();
for (PenaltyBO penalty : penalties) {
if (loanProduct.isPenaltyPresent(penalty)) {
defaultPenalties.add(penalty.toDto());
}
}
if (AccountingRules.isMultiCurrencyEnabled()) {
defaultFees = getFilteredFeesByCurrency(defaultFees, loanProduct.getCurrency().getCurrencyId());
additionalFees = getFilteredFeesByCurrency(additionalFees, loanProduct.getCurrency().getCurrencyId());
}
Map<String, String> defaultFeeOptions = new LinkedHashMap<String, String>();
for (org.mifos.dto.domain.FeeDto feeDto : defaultFees) {
defaultFeeOptions.put(feeDto.getId(), feeDto.getName());
}
Map<String, String> additionalFeeOptions = new LinkedHashMap<String, String>();
for (org.mifos.dto.domain.FeeDto feeDto : additionalFees) {
additionalFeeOptions.put(feeDto.getId(), feeDto.getName());
}
CustomerBO customer = this.customerDao.findCustomerById(customerId);
boolean isRepaymentIndependentOfMeetingEnabled = new ConfigurationBusinessService().isRepaymentIndepOfMeetingEnabled();
LoanDisbursementDateFactory loanDisbursementDateFactory = new LoanDisbursmentDateFactoryImpl();
LoanDisbursementDateFinder loanDisbursementDateFinder = null;
LocalDate nextPossibleDisbursementDate = null;
MeetingBO customerMeeting = customer.getCustomerMeetingValue();
LocalDate dateToStart = new LocalDate();
if (customerMeeting.isWeekly()) {
LocalDate meetingStartDate = new LocalDate(customerMeeting.getMeetingStartDate());
if (dateToStart.isBefore(meetingStartDate)) {
dateToStart = meetingStartDate;
loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, false, isLoanWithBackdatedPayments);
} else {
loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, isRepaymentIndependentOfMeetingEnabled, isLoanWithBackdatedPayments);
}
nextPossibleDisbursementDate = loanDisbursementDateFinder.findClosestMatchingDateFromAndInclusiveOf(dateToStart);
} else {
loanDisbursementDateFinder = loanDisbursementDateFactory.create(customer, loanProduct, isRepaymentIndependentOfMeetingEnabled, isLoanWithBackdatedPayments);
nextPossibleDisbursementDate = loanDisbursementDateFinder.findClosestMatchingDateFromAndInclusiveOf(dateToStart);
}
LoanAmountOption eligibleLoanAmount = loanProduct.eligibleLoanAmount(customer.getMaxLoanAmount(loanProduct), customer.getMaxLoanCycleForProduct(loanProduct));
LoanOfferingInstallmentRange eligibleNoOfInstall = loanProduct.eligibleNoOfInstall(customer.getMaxLoanAmount(loanProduct), customer.getMaxLoanCycleForProduct(loanProduct));
Double defaultInterestRate = loanProduct.getDefInterestRate();
Double maxInterestRate = loanProduct.getMaxInterestRate();
Double minInterestRate = loanProduct.getMinInterestRate();
LinkedHashMap<String, String> collateralOptions = new LinkedHashMap<String, String>();
LinkedHashMap<String, String> purposeOfLoanOptions = new LinkedHashMap<String, String>();
CustomValueDto customValueDto = legacyMasterDao.getLookUpEntity(MasterConstants.COLLATERAL_TYPES);
List<CustomValueListElementDto> collateralTypes = customValueDto.getCustomValueListElements();
for (CustomValueListElementDto element : collateralTypes) {
collateralOptions.put(element.getId().toString(), element.getName());
}
// Business activities got in getPrdOfferings also but only for glim.
List<ValueListElement> loanPurposes = legacyMasterDao.findValueListElements(MasterConstants.LOAN_PURPOSES);
for (ValueListElement element : loanPurposes) {
purposeOfLoanOptions.put(element.getId().toString(), element.getName());
}
List<FundDto> fundDtos = new ArrayList<FundDto>();
List<FundBO> funds = getFunds(loanProduct);
for (FundBO fund : funds) {
FundDto fundDto = new FundDto();
fundDto.setId(Short.toString(fund.getFundId()));
fundDto.setCode(translateFundCodeToDto(fund.getFundCode()));
fundDto.setName(fund.getFundName());
fundDtos.add(fundDto);
}
ProductDetailsDto productDto = loanProduct.toDetailsDto();
CustomerDetailDto customerDetailDto = customer.toCustomerDetailDto();
Integer gracePeriodInInstallments = loanProduct.getGracePeriodDuration().intValue();
final List<PrdOfferingDto> loanProductDtos = retrieveActiveLoanProductsApplicableForCustomer(customer, isRepaymentIndependentOfMeetingEnabled);
InterestType interestType = InterestType.fromInt(loanProduct.getInterestTypes().getId().intValue());
InterestTypesEntity productInterestType = this.loanProductDao.findInterestType(interestType);
String interestTypeName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(productInterestType.getLookUpValue());
LinkedHashMap<String, String> daysOfTheWeekOptions = new LinkedHashMap<String, String>();
List<WeekDay> workingDays = new FiscalCalendarRules().getWorkingDays();
for (WeekDay workDay : workingDays) {
String weekdayName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(workDay.getPropertiesKey());
workDay.setWeekdayName(weekdayName);
daysOfTheWeekOptions.put(workDay.getValue().toString(), weekdayName);
}
LinkedHashMap<String, String> weeksOfTheMonthOptions = new LinkedHashMap<String, String>();
for (RankOfDay weekOfMonth : RankOfDay.values()) {
String weekOfMonthName = ApplicationContextProvider.getBean(MessageLookup.class).lookup(weekOfMonth.getPropertiesKey());
weeksOfTheMonthOptions.put(weekOfMonth.getValue().toString(), weekOfMonthName);
}
boolean variableInstallmentsAllowed = loanProduct.isVariableInstallmentsAllowed();
boolean fixedRepaymentSchedule = loanProduct.isFixedRepaymentSchedule();
Integer minGapInDays = Integer.valueOf(0);
Integer maxGapInDays = Integer.valueOf(0);
BigDecimal minInstallmentAmount = BigDecimal.ZERO;
if (variableInstallmentsAllowed) {
VariableInstallmentDetailsBO variableInstallmentsDetails = loanProduct.getVariableInstallmentDetails();
minGapInDays = variableInstallmentsDetails.getMinGapInDays();
maxGapInDays = variableInstallmentsDetails.getMaxGapInDays();
minInstallmentAmount = variableInstallmentsDetails.getMinInstallmentAmount().getAmount();
}
boolean compareCashflowEnabled = loanProduct.isCashFlowCheckEnabled();
// GLIM specific
final boolean isGroup = customer.isGroup();
final boolean isGlimEnabled = configurationPersistence.isGlimEnabled();
//Group Loan Account with members specific
final boolean isGroupLoanWithMembersEnabled = AccountingRules.isGroupLoanWithMembers();
List<LoanAccountDetailsDto> clientDetails = new ArrayList<LoanAccountDetailsDto>();
if (isGroup && (isGlimEnabled || isGroupLoanWithMembersEnabled)) {
final List<ClientBO> activeClientsOfGroup = customerDao.findActiveClientsUnderGroup(customer);
if (activeClientsOfGroup == null || activeClientsOfGroup.isEmpty()) {
throw new BusinessRuleException(GroupConstants.IMPOSSIBLE_TO_CREATE_GROUP_LOAN);
}
for (ClientBO client : activeClientsOfGroup) {
LoanAccountDetailsDto clientDetail = new LoanAccountDetailsDto();
clientDetail.setClientId(client.getGlobalCustNum());
clientDetail.setClientName(client.getDisplayName());
clientDetails.add(clientDetail);
}
}
// end of GLIM specific
int digitsAfterDecimalForInterest = AccountingRules.getDigitsAfterDecimalForInterest().intValue();
int digitsBeforeDecimalForInterest = AccountingRules.getDigitsBeforeDecimalForInterest().intValue();
int digitsAfterDecimalForMonetaryAmounts = AccountingRules.getDigitsAfterDecimal().intValue();
int digitsBeforeDecimalForMonetaryAmounts = AccountingRules.getDigitsBeforeDecimal().intValue();
ApplicationConfigurationDto appConfig = new ApplicationConfigurationDto(digitsAfterDecimalForInterest, digitsBeforeDecimalForInterest, digitsAfterDecimalForMonetaryAmounts, digitsBeforeDecimalForMonetaryAmounts);
Map<String, String> disbursalPaymentTypes = new LinkedHashMap<String, String>();
try {
for (PaymentTypeDto paymentTypeDto : accountService.getLoanDisbursementTypes()) {
disbursalPaymentTypes.put(paymentTypeDto.getValue().toString(), paymentTypeDto.getName());
}
} catch (Exception e) {
throw new SystemException(e);
}
Map<String, String> repaymentpaymentTypes = new LinkedHashMap<String, String>();
try {
for (PaymentTypeDto paymentTypeDto : accountService.getLoanPaymentTypes()) {
repaymentpaymentTypes.put(paymentTypeDto.getValue().toString(), paymentTypeDto.getName());
}
} catch (Exception e) {
throw new SystemException(e);
}
String currency = loanProduct.getCurrency().getCurrencyCode();
return new LoanCreationLoanDetailsDto(currency, isRepaymentIndependentOfMeetingEnabled, loanOfferingMeetingDto, customer.getCustomerMeetingValue().toDto(), loanPurposes, productDto, gracePeriodInInstallments, customerDetailDto, loanProductDtos, interestTypeName, fundDtos, collateralOptions, purposeOfLoanOptions, defaultFeeOptions, additionalFeeOptions, defaultFees, additionalFees, BigDecimal.valueOf(eligibleLoanAmount.getDefaultLoanAmount()), BigDecimal.valueOf(eligibleLoanAmount.getMaxLoanAmount()), BigDecimal.valueOf(eligibleLoanAmount.getMinLoanAmount()), defaultInterestRate, maxInterestRate, minInterestRate, eligibleNoOfInstall.getDefaultNoOfInstall().intValue(), eligibleNoOfInstall.getMaxNoOfInstall().intValue(), eligibleNoOfInstall.getMinNoOfInstall().intValue(), nextPossibleDisbursementDate, daysOfTheWeekOptions, weeksOfTheMonthOptions, variableInstallmentsAllowed, fixedRepaymentSchedule, minGapInDays, maxGapInDays, minInstallmentAmount, compareCashflowEnabled, isGlimEnabled, isGroup, clientDetails, appConfig, defaultPenalties, disbursalPaymentTypes, repaymentpaymentTypes, isGroupLoanWithMembersEnabled);
} catch (SystemException e) {
throw new MifosRuntimeException(e);
}
}
use of org.mifos.dto.domain.PenaltyDto in project head by mifos.
the class EditPenaltyController method showForm.
@RequestMapping(method = RequestMethod.GET)
public ModelAndView showForm(@RequestParam Integer penaltyId) {
ModelAndView modelAndView = new ModelAndView("editPenalty");
PenaltyDto dto = this.penaltyServiceFacade.getPenalty(penaltyId);
parametersDto = this.penaltyServiceFacade.getPenaltyParameters();
configurationDto = this.configurationServiceFacade.getAccountingConfiguration();
PenaltyFormBean bean = new PenaltyFormBean(dto);
modelAndView.addObject("formBean", bean);
modelAndView.addObject("param", parametersDto);
modelAndView.addObject("GLCodeMode", configurationDto.getGlCodeMode());
return modelAndView;
}
use of org.mifos.dto.domain.PenaltyDto in project head by mifos.
the class LoanAccountController method retrieveLoanCreationDetails.
@SuppressWarnings("PMD")
public LoanCreationLoanDetailsDto retrieveLoanCreationDetails(int customerId, int productId, String eventId, String fileToDelete, LoanAccountFormBean formBean) {
if ("newFileSelected".equals(eventId)) {
if (formBean.getSelectedFile() != null) {
CommonsMultipartFile file = formBean.getSelectedFile();
formBean.getFiles().add(file);
formBean.getFilesMetadata().add(new UploadedFileDto(file.getOriginalFilename(), file.getContentType(), (int) file.getSize(), formBean.getSelectedFileDescription()));
}
return dto;
} else if ("fileDeleted".equals(eventId)) {
if (fileToDelete != null) {
int index = 0;
for (CommonsMultipartFile formFile : formBean.getFiles()) {
if (formFile.getOriginalFilename().equals(fileToDelete)) {
index = formBean.getFiles().indexOf(formFile);
break;
}
}
if (index >= 0) {
formBean.getFiles().remove(index);
formBean.getFilesMetadata().remove(index);
}
}
return dto;
}
MandatoryHiddenFieldsDto mandatoryHidden = this.adminServiceFacade.retrieveHiddenMandatoryFieldsToRead();
dto = this.loanAccountServiceFacade.retrieveLoanDetailsForLoanAccountCreation(customerId, Integer.valueOf(productId).shortValue(), formBean.isRedoLoanAccount());
formBean.setLocale(Locale.getDefault());
formBean.setDigitsBeforeDecimalForInterest(dto.getAppConfig().getDigitsBeforeDecimalForInterest());
formBean.setDigitsAfterDecimalForInterest(dto.getAppConfig().getDigitsAfterDecimalForInterest());
formBean.setDigitsBeforeDecimalForMonetaryAmounts(dto.getAppConfig().getDigitsBeforeDecimalForMonetaryAmounts());
formBean.setDigitsAfterDecimalForMonetaryAmounts(dto.getAppConfig().getDigitsAfterDecimalForMonetaryAmounts());
formBean.setProductId(productId);
formBean.setCustomerId(dto.getCustomerDetailDto().getCustomerId());
formBean.setRepaymentScheduleIndependentOfCustomerMeeting(dto.isRepaymentIndependentOfMeetingEnabled());
formBean.setGraceDuration(dto.getGracePeriodInInstallments());
formBean.setMaxGraceDuration(dto.getGracePeriodInInstallments());
if (dto.isRepaymentIndependentOfMeetingEnabled()) {
// use loan product to default meeting details
Integer recursEvery = dto.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getEvery();
Integer dayOfMonth = dto.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getRecurrenceDetails().getDayNumber();
Integer weekOfMonth = dto.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getRecurrenceDetails().getWeekOfMonth();
Integer dayOfWeek = dto.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getRecurrenceDetails().getDayOfWeek();
Integer recurrenceType = dto.getLoanOfferingMeetingDetail().getMeetingDetailsDto().getRecurrenceTypeId();
Integer customerRecurrenceType = dto.getCustomerMeetingDetail().getMeetingDetailsDto().getRecurrenceTypeId();
if (recurrenceType.equals(customerRecurrenceType)) {
// if customer and product meeting frequencies are the same e.g. weekly or monthly, then default to customer details except for recurrence details
dayOfMonth = dto.getCustomerMeetingDetail().getMeetingDetailsDto().getRecurrenceDetails().getDayNumber();
weekOfMonth = dto.getCustomerMeetingDetail().getMeetingDetailsDto().getRecurrenceDetails().getWeekOfMonth();
dayOfWeek = dto.getCustomerMeetingDetail().getMeetingDetailsDto().getRecurrenceDetails().getDayOfWeek();
}
// sometimes it seems customer meeting information can be setup wrong (i.e. has a day of month even though its weekly)
if (recurrenceType == 1) {
if (dateInformationIsAvailable(dayOfWeek)) {
formBean.setWeeklyDetails(dayOfWeek, recursEvery);
}
} else if (recurrenceType == 2) {
if (dateInformationIsAvailable(weekOfMonth) && dateInformationIsAvailable(dayOfWeek)) {
formBean.setWeekOfMonthDetails(weekOfMonth, dayOfWeek, recursEvery);
} else if (dateInformationIsAvailable(dayOfMonth)) {
formBean.setDayOfMonthDetails(dayOfMonth, recursEvery);
}
} else if (recurrenceType == 3) {
formBean.setRepaymentRecursEvery(recursEvery);
}
}
formBean.setVariableInstallmentsAllowed(dto.isVariableInstallmentsAllowed());
if (dto.isVariableInstallmentsAllowed()) {
formBean.setMinGapInDays(dto.getMinGapInDays());
formBean.setMaxGapInDays(dto.getMaxGapInDays());
formBean.setMinInstallmentAmount(dto.getMinInstallmentAmount());
}
formBean.setGlimApplicable(dto.isGlimApplicable());
if (dto.isGroup()) {
formBean.setGroupLoanWithMembersEnabled(dto.isGroupLoanWithMembersEnabled());
}
if (dto.isGlimApplicable() || (dto.isGroup() && dto.isGroupLoanWithMembersEnabled())) {
List<LoanAccountDetailsDto> clientData = dto.getClientDetails();
String[] clientGlobalIdArray = new String[clientData.size()];
int index = 0;
for (LoanAccountDetailsDto loanAccountDetailsDto : clientData) {
clientGlobalIdArray[index] = loanAccountDetailsDto.getClientId();
index++;
}
formBean.setClientGlobalId(clientGlobalIdArray);
formBean.setClientSelectForGroup(new Boolean[clientData.size()]);
formBean.setClientAmount(new Number[clientData.size()]);
Integer[] loanPurpose = new Integer[clientData.size()];
formBean.setClientLoanPurposeId(loanPurpose);
Number[][] selectedFeeIndividualAmounts = new Number[3][clientData.size()];
formBean.setSelectedFeeIndividualAmounts(selectedFeeIndividualAmounts);
Number[][] defaultFeeIndividualAmounts = new Number[dto.getDefaultFees().size()][clientData.size()];
formBean.setDefaultFeeIndividualAmounts(defaultFeeIndividualAmounts);
} else {
formBean.setAmount(Double.valueOf(dto.getDefaultLoanAmount().toPlainString()));
}
formBean.setMinAllowedAmount(dto.getMinLoanAmount());
formBean.setMaxAllowedAmount(dto.getMaxLoanAmount());
formBean.setInterestRate(dto.getDefaultInterestRate());
formBean.setMinAllowedInterestRate(dto.getMinInterestRate());
formBean.setMaxAllowedInterestRate(dto.getMaxInterestRate());
formBean.setNumberOfInstallments(dto.getDefaultNumberOfInstallments());
formBean.setMinNumberOfInstallments(dto.getMinNumberOfInstallments());
formBean.setMaxNumberOfInstallments(dto.getMaxNumberOfInstallments());
formBean.setSourceOfFundsMandatory(mandatoryHidden.isMandatoryLoanSourceOfFund());
formBean.setPurposeOfLoanMandatory(mandatoryHidden.isMandatoryLoanAccountPurpose());
formBean.setCollateralTypeAndNotesHidden(mandatoryHidden.isHideSystemCollateralTypeNotes());
formBean.setExternalIdHidden(mandatoryHidden.isHideSystemExternalId());
if (!mandatoryHidden.isHideSystemExternalId()) {
formBean.setExternalIdMandatory(mandatoryHidden.isMandatorySystemExternalId());
}
LocalDate possibleDisbursementDate = dto.getNextPossibleDisbursementDate();
if (possibleDisbursementDate != null) {
formBean.setDisbursementDateDD(possibleDisbursementDate.getDayOfMonth());
formBean.setDisbursementDateMM(possibleDisbursementDate.getMonthOfYear());
formBean.setDisbursementDateYY(possibleDisbursementDate.getYearOfEra());
}
formBean.setCollateralNotes("");
Number[] defaultFeeId = new Number[dto.getDefaultFees().size()];
Number[] defaultFeeAmountOrRate = new Number[dto.getDefaultFees().size()];
int index = 0;
for (FeeDto defaultFee : dto.getDefaultFees()) {
if (defaultFee.isRateBasedFee()) {
defaultFeeAmountOrRate[index] = defaultFee.getRate();
} else {
defaultFeeAmountOrRate[index] = defaultFee.getAmountAsNumber();
}
defaultFeeId[index] = Long.valueOf(defaultFee.getId());
index++;
}
formBean.setDefaultFeeAmountOrRate(defaultFeeAmountOrRate);
formBean.setDefaultFeeId(defaultFeeId);
formBean.setDefaultFeeSelected(new Boolean[dto.getDefaultFees().size()]);
formBean.setDefaultFees(dto.getDefaultFees());
Number[] defaultPenaltyId = new Number[dto.getDefaultPenalties().size()];
Number[] defaultPenaltyAmountOrRate = new Number[dto.getDefaultPenalties().size()];
int idx = 0;
for (PenaltyDto defaultPenalty : dto.getDefaultPenalties()) {
if (defaultPenalty.isRateBasedPenalty()) {
defaultPenaltyAmountOrRate[idx] = defaultPenalty.getRate();
} else {
defaultPenaltyAmountOrRate[idx] = defaultPenalty.getAmountAsNumber();
}
defaultPenaltyId[idx] = Long.valueOf(defaultPenalty.getPenaltyId());
idx++;
}
formBean.setDefaultPenaltyAmountOrRate(defaultPenaltyAmountOrRate);
formBean.setDefaultPenaltyId(defaultPenaltyId);
formBean.setDefaultPenaltySelected(new Boolean[dto.getDefaultPenalties().size()]);
formBean.setDefaultPenalties(dto.getDefaultPenalties());
Number[] selectedFeeId = new Number[3];
formBean.setSelectedFeeId(selectedFeeId);
Number[] selectedFeeAmount = new Number[3];
formBean.setSelectedFeeAmount(selectedFeeAmount);
formBean.setAdditionalFees(dto.getAdditionalFees());
if (formBean.getFiles() == null) {
formBean.setFiles(new ArrayList<CommonsMultipartFile>());
formBean.setFilesMetadata(new ArrayList<UploadedFileDto>());
}
formBean.setLoanInformationOrder(informationOrderServiceFacade.getInformationOrder("CreateLoan"));
return dto;
}
Aggregations