public void validateGroup(SavingsProductFormBean savingsProductFormBean, BindingResult result) { if (savingsProductFormBean.isGroupSavingAccount() && StringUtils.isBlank(savingsProductFormBean.getSelectedGroupSavingsApproach())) { ObjectError error = new ObjectError( "savingsProduct", new String[] {"NotEmpty.savingsProduct.selectedGroupSavingsApproach"}, new Object[] {}, "default: "); result.addError(error); } }
public SavingsProductDto assembleSavingsProductRequest(SavingsProductFormBean formBean) { Integer category = Integer.valueOf(formBean.getGeneralDetails().getSelectedCategory()); Integer applicableFor = Integer.valueOf(formBean.getGeneralDetails().getSelectedApplicableFor()); DateTime startDate = new DateTime() .withDate( Integer.valueOf(formBean.getGeneralDetails().getStartDateYear()), formBean.getGeneralDetails().getStartDateMonth(), formBean.getGeneralDetails().getStartDateDay()); DateTime endDate = null; if (StringUtils.isNotBlank(formBean.getGeneralDetails().getEndDateYear())) { endDate = new DateTime() .withDate( Integer.valueOf(formBean.getGeneralDetails().getEndDateYear()), formBean.getGeneralDetails().getEndDateMonth(), formBean.getGeneralDetails().getEndDateDay()); } ProductDetailsDto productDetails = new ProductDetailsDto( formBean.getGeneralDetails().getName(), formBean.getGeneralDetails().getShortName(), formBean.getGeneralDetails().getDescription(), category, startDate, endDate, applicableFor); productDetails.setId(formBean.getGeneralDetails().getId()); if (StringUtils.isNotBlank(formBean.getGeneralDetails().getSelectedStatus())) { Integer status = Integer.valueOf(formBean.getGeneralDetails().getSelectedStatus()); productDetails.setStatus(status); } Integer depositType = Integer.valueOf(formBean.getSelectedDepositType()); Integer groupSavingsType = null; if (StringUtils.isNotBlank(formBean.getSelectedGroupSavingsApproach())) { groupSavingsType = Integer.valueOf(formBean.getSelectedGroupSavingsApproach()); } Double amountForDeposit = formBean.getAmountForDeposit(); Double maxWithdrawal = formBean.getMaxWithdrawalAmount(); BigDecimal interestRate = formBean.getInterestRate(); Integer interestCalculationType = Integer.valueOf(formBean.getSelectedInterestCalculation()); Integer interestCalculationFrequencyPeriod = Integer.valueOf(formBean.getSelectedFequencyPeriod()); BigDecimal minBalanceForInterestCalculation = BigDecimal.valueOf(Double.valueOf(formBean.getMinBalanceRequiredForInterestCalculation())); Integer interestGlCode = Integer.parseInt(formBean.getSelectedInterestGlCode()); Integer depositGlCode = Integer.parseInt(formBean.getSelectedPrincipalGlCode()); return new SavingsProductDto( productDetails, formBean.isGroupSavingAccount(), depositType, groupSavingsType, amountForDeposit, maxWithdrawal, interestRate, interestCalculationType, formBean.getInterestCalculationFrequency(), interestCalculationFrequencyPeriod, formBean.getInterestPostingMonthlyFrequency(), minBalanceForInterestCalculation, depositGlCode, interestGlCode); }