コード例 #1
0
 public void validateManadtorySavingsProduct(
     SavingsProductFormBean savingsProductFormBean, BindingResult result) {
   if (savingsProductFormBean.isMandatory() && savingsProductFormBean.getAmountForDeposit() == null
       || savingsProductFormBean.getAmountForDeposit().intValue() <= 0) {
     ObjectError error =
         new ObjectError(
             "savingsProduct",
             new String[] {"Min.savingsProduct.amountForDesposit"},
             new Object[] {},
             "default: ");
     result.addError(error);
   }
 }
コード例 #2
0
  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);
  }