private SavingsProductData handleTemplateRelatedData(final SavingsProductData savingsProduct) {

    final EnumOptionData interestCompoundingPeriodType =
        SavingsEnumerations.compoundingInterestPeriodType(
            SavingsCompoundingInterestPeriodType.DAILY);

    final EnumOptionData interestPostingPeriodType =
        SavingsEnumerations.interestPostingPeriodType(SavingsPostingInterestPeriodType.MONTHLY);

    final EnumOptionData interestCalculationType =
        SavingsEnumerations.interestCalculationType(SavingsInterestCalculationType.DAILY_BALANCE);

    final EnumOptionData interestCalculationDaysInYearType =
        SavingsEnumerations.interestCalculationDaysInYearType(
            SavingsInterestCalculationDaysInYearType.DAYS_365);

    final EnumOptionData accountingRule =
        AccountingEnumerations.accountingRuleType(AccountingRuleType.NONE);

    CurrencyData currency = CurrencyData.blank();
    final Collection<CurrencyData> currencyOptions =
        this.currencyReadPlatformService.retrieveAllowedCurrencies();
    if (currencyOptions.size() == 1) {
      currency = new ArrayList<CurrencyData>(currencyOptions).get(0);
    }

    final Collection<EnumOptionData> interestCompoundingPeriodTypeOptions =
        this.dropdownReadPlatformService.retrieveCompoundingInterestPeriodTypeOptions();

    final Collection<EnumOptionData> interestPostingPeriodTypeOptions =
        this.dropdownReadPlatformService.retrieveInterestPostingPeriodTypeOptions();

    final Collection<EnumOptionData> interestCalculationTypeOptions =
        this.dropdownReadPlatformService.retrieveInterestCalculationTypeOptions();

    final Collection<EnumOptionData> interestCalculationDaysInYearTypeOptions =
        this.dropdownReadPlatformService.retrieveInterestCalculationDaysInYearTypeOptions();

    final Collection<EnumOptionData> lockinPeriodFrequencyTypeOptions =
        this.dropdownReadPlatformService.retrieveLockinPeriodFrequencyTypeOptions();

    final Collection<EnumOptionData> withdrawalFeeTypeOptions =
        this.dropdownReadPlatformService.retrievewithdrawalFeeTypeOptions();

    final Collection<CodeValueData> paymentTypeOptions =
        this.codeValueReadPlatformService.retrieveCodeValuesByCode(
            PaymentDetailConstants.paymentTypeCodeName);
    final Collection<EnumOptionData> accountingRuleOptions =
        this.accountingDropdownReadPlatformService.retrieveAccountingRuleTypeOptions();
    final Map<String, List<GLAccountData>> accountingMappingOptions =
        this.accountingDropdownReadPlatformService
            .retrieveAccountMappingOptionsForSavingsProducts();

    // charges
    final boolean feeChargesOnly = true;
    Collection<ChargeData> chargeOptions =
        this.chargeReadPlatformService.retrieveSavingsAccountApplicableCharges(feeChargesOnly);
    chargeOptions = CollectionUtils.isEmpty(chargeOptions) ? null : chargeOptions;

    Collection<ChargeData> penaltyOptions =
        this.chargeReadPlatformService.retrieveSavingsAccountApplicablePenalties();
    penaltyOptions = CollectionUtils.isEmpty(penaltyOptions) ? null : penaltyOptions;

    SavingsProductData savingsProductToReturn = null;
    if (savingsProduct != null) {
      savingsProductToReturn =
          SavingsProductData.withTemplate(
              savingsProduct,
              currencyOptions,
              interestCompoundingPeriodTypeOptions,
              interestPostingPeriodTypeOptions,
              interestCalculationTypeOptions,
              interestCalculationDaysInYearTypeOptions,
              lockinPeriodFrequencyTypeOptions,
              withdrawalFeeTypeOptions,
              paymentTypeOptions,
              accountingRuleOptions,
              accountingMappingOptions,
              chargeOptions,
              penaltyOptions);
    } else {
      savingsProductToReturn =
          SavingsProductData.template(
              currency,
              interestCompoundingPeriodType,
              interestPostingPeriodType,
              interestCalculationType,
              interestCalculationDaysInYearType,
              accountingRule,
              currencyOptions,
              interestCompoundingPeriodTypeOptions,
              interestPostingPeriodTypeOptions,
              interestCalculationTypeOptions,
              interestCalculationDaysInYearTypeOptions,
              lockinPeriodFrequencyTypeOptions,
              withdrawalFeeTypeOptions,
              paymentTypeOptions,
              accountingRuleOptions,
              accountingMappingOptions,
              chargeOptions,
              penaltyOptions);
    }

    return savingsProductToReturn;
  }
    @Override
    public SavingsProductData mapRow(
        final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {

      final Long id = rs.getLong("id");
      final String name = rs.getString("name");
      final String shortName = rs.getString("shortName");
      final String description = rs.getString("description");

      final String currencyCode = rs.getString("currencyCode");
      final String currencyName = rs.getString("currencyName");
      final String currencyNameCode = rs.getString("currencyNameCode");
      final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
      final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
      final Integer inMultiplesOf = JdbcSupport.getInteger(rs, "inMultiplesOf");
      final CurrencyData currency =
          new CurrencyData(
              currencyCode,
              currencyName,
              currencyDigits,
              inMultiplesOf,
              currencyDisplaySymbol,
              currencyNameCode);
      final BigDecimal nominalAnnualInterestRate = rs.getBigDecimal("nominalAnnualInterestRate");

      final Integer compoundingInterestPeriodTypeValue =
          JdbcSupport.getInteger(rs, "compoundingInterestPeriodType");
      final EnumOptionData compoundingInterestPeriodType =
          SavingsEnumerations.compoundingInterestPeriodType(compoundingInterestPeriodTypeValue);

      final Integer interestPostingPeriodTypeValue =
          JdbcSupport.getInteger(rs, "interestPostingPeriodType");
      final EnumOptionData interestPostingPeriodType =
          SavingsEnumerations.interestPostingPeriodType(interestPostingPeriodTypeValue);

      final Integer interestCalculationTypeValue =
          JdbcSupport.getInteger(rs, "interestCalculationType");
      final EnumOptionData interestCalculationType =
          SavingsEnumerations.interestCalculationType(interestCalculationTypeValue);

      EnumOptionData interestCalculationDaysInYearType = null;
      final Integer interestCalculationDaysInYearTypeValue =
          JdbcSupport.getInteger(rs, "interestCalculationDaysInYearType");
      if (interestCalculationDaysInYearTypeValue != null) {
        interestCalculationDaysInYearType =
            SavingsEnumerations.interestCalculationDaysInYearType(
                interestCalculationDaysInYearTypeValue);
      }

      final Integer accountingRuleId = JdbcSupport.getInteger(rs, "accountingType");
      final EnumOptionData accountingRuleType =
          AccountingEnumerations.accountingRuleType(accountingRuleId);

      final BigDecimal minRequiredOpeningBalance = rs.getBigDecimal("minRequiredOpeningBalance");

      final Integer lockinPeriodFrequency = JdbcSupport.getInteger(rs, "lockinPeriodFrequency");
      EnumOptionData lockinPeriodFrequencyType = null;
      final Integer lockinPeriodFrequencyTypeValue =
          JdbcSupport.getInteger(rs, "lockinPeriodFrequencyType");
      if (lockinPeriodFrequencyTypeValue != null) {
        lockinPeriodFrequencyType =
            SavingsEnumerations.lockinPeriodFrequencyType(lockinPeriodFrequencyTypeValue);
      }

      final boolean withdrawalFeeForTransfers = rs.getBoolean("withdrawalFeeForTransfers");
      final boolean allowOverdraft = rs.getBoolean("allowOverdraft");
      final BigDecimal overdraftLimit = rs.getBigDecimal("overdraftLimit");
      return SavingsProductData.instance(
          id,
          name,
          shortName,
          description,
          currency,
          nominalAnnualInterestRate,
          compoundingInterestPeriodType,
          interestPostingPeriodType,
          interestCalculationType,
          interestCalculationDaysInYearType,
          minRequiredOpeningBalance,
          lockinPeriodFrequency,
          lockinPeriodFrequencyType,
          withdrawalFeeForTransfers,
          accountingRuleType,
          allowOverdraft,
          overdraftLimit);
    }
Exemplo n.º 3
0
  public static LoanProductData sensibleDefaultsForNewLoanProductCreation() {
    final Long id = null;
    final String name = null;
    final String shortName = null;
    final String description = null;
    final CurrencyData currency = CurrencyData.blank();
    final BigDecimal principal = null;
    final BigDecimal minPrincipal = null;
    final BigDecimal maxPrincipal = null;
    final BigDecimal tolerance = null;
    final Integer numberOfRepayments = null;
    final Integer minNumberOfRepayments = null;
    final Integer maxNumberOfRepayments = null;

    final Integer repaymentEvery = null;
    final BigDecimal interestRatePerPeriod = null;
    final BigDecimal minInterestRatePerPeriod = null;
    final BigDecimal maxInterestRatePerPeriod = null;
    final BigDecimal annualInterestRate = null;
    final EnumOptionData repaymentFrequencyType =
        LoanEnumerations.repaymentFrequencyType(PeriodFrequencyType.MONTHS);
    final EnumOptionData interestRateFrequencyType =
        LoanEnumerations.interestRateFrequencyType(PeriodFrequencyType.MONTHS);
    final EnumOptionData amortizationType =
        LoanEnumerations.amortizationType(AmortizationMethod.EQUAL_INSTALLMENTS);
    final EnumOptionData interestType =
        LoanEnumerations.interestType(InterestMethod.DECLINING_BALANCE);
    final EnumOptionData interestCalculationPeriodType =
        LoanEnumerations.interestCalculationPeriodType(
            InterestCalculationPeriodMethod.SAME_AS_REPAYMENT_PERIOD);
    final Long fundId = null;
    final String fundName = null;
    final Long transactionProcessingStrategyId = null;
    final String transactionProcessingStrategyName = null;

    final Integer graceOnPrincipalPayment = null;
    final Integer graceOnInterestPayment = null;
    final Integer graceOnInterestCharged = null;
    final Integer graceOnArrearsAgeing = null;

    final Collection<ChargeData> charges = null;
    final Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle =
        new ArrayList<LoanProductBorrowerCycleVariationData>(1);
    final Collection<LoanProductBorrowerCycleVariationData> interestRateVariationsForBorrowerCycle =
        new ArrayList<LoanProductBorrowerCycleVariationData>(1);
    final Collection<LoanProductBorrowerCycleVariationData>
        numberOfRepaymentVariationsForBorrowerCycle =
            new ArrayList<LoanProductBorrowerCycleVariationData>(1);

    final EnumOptionData accountingType =
        AccountingEnumerations.accountingRuleType(AccountingRuleType.NONE);
    final boolean includeInBorrowerCycle = false;
    final boolean useBorrowerCycle = false;
    final LocalDate startDate = null;
    final LocalDate closeDate = null;
    final String status = null;
    final String externalId = null;
    final Boolean multiDisburseLoan = null;
    final Integer maxTrancheCount = null;
    final BigDecimal outstandingLoanBalance = null;

    return new LoanProductData(
        id,
        name,
        shortName,
        description,
        currency,
        principal,
        minPrincipal,
        maxPrincipal,
        tolerance,
        numberOfRepayments,
        minNumberOfRepayments,
        maxNumberOfRepayments,
        repaymentEvery,
        interestRatePerPeriod,
        minInterestRatePerPeriod,
        maxInterestRatePerPeriod,
        annualInterestRate,
        repaymentFrequencyType,
        interestRateFrequencyType,
        amortizationType,
        interestType,
        interestCalculationPeriodType,
        fundId,
        fundName,
        transactionProcessingStrategyId,
        transactionProcessingStrategyName,
        graceOnPrincipalPayment,
        graceOnInterestPayment,
        graceOnInterestCharged,
        charges,
        accountingType,
        includeInBorrowerCycle,
        useBorrowerCycle,
        startDate,
        closeDate,
        status,
        externalId,
        principalVariationsForBorrowerCycle,
        interestRateVariationsForBorrowerCycle,
        numberOfRepaymentVariationsForBorrowerCycle,
        multiDisburseLoan,
        maxTrancheCount,
        outstandingLoanBalance,
        graceOnArrearsAgeing);
  }
    public DepositProductData mapRow(final ResultSet rs) throws SQLException {

      final Long id = rs.getLong("id");
      final String name = rs.getString("name");
      final String shortName = rs.getString("shortName");
      final String description = rs.getString("description");

      final String currencyCode = rs.getString("currencyCode");
      final String currencyName = rs.getString("currencyName");
      final String currencyNameCode = rs.getString("currencyNameCode");
      final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
      final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
      final Integer inMultiplesOf = JdbcSupport.getInteger(rs, "inMultiplesOf");
      final CurrencyData currency =
          new CurrencyData(
              currencyCode,
              currencyName,
              currencyDigits,
              inMultiplesOf,
              currencyDisplaySymbol,
              currencyNameCode);
      final BigDecimal nominalAnnualInterestRate = rs.getBigDecimal("nominalAnnualInterestRate");

      final Integer compoundingInterestPeriodTypeValue =
          JdbcSupport.getInteger(rs, "compoundingInterestPeriodType");
      final EnumOptionData compoundingInterestPeriodType =
          SavingsEnumerations.compoundingInterestPeriodType(compoundingInterestPeriodTypeValue);

      final Integer interestPostingPeriodTypeValue =
          JdbcSupport.getInteger(rs, "interestPostingPeriodType");
      final EnumOptionData interestPostingPeriodType =
          SavingsEnumerations.interestPostingPeriodType(interestPostingPeriodTypeValue);

      final Integer interestCalculationTypeValue =
          JdbcSupport.getInteger(rs, "interestCalculationType");
      final EnumOptionData interestCalculationType =
          SavingsEnumerations.interestCalculationType(interestCalculationTypeValue);

      EnumOptionData interestCalculationDaysInYearType = null;
      final Integer interestCalculationDaysInYearTypeValue =
          JdbcSupport.getInteger(rs, "interestCalculationDaysInYearType");
      if (interestCalculationDaysInYearTypeValue != null) {
        interestCalculationDaysInYearType =
            SavingsEnumerations.interestCalculationDaysInYearType(
                interestCalculationDaysInYearTypeValue);
      }

      final Integer accountingRuleId = JdbcSupport.getInteger(rs, "accountingType");
      final EnumOptionData accountingRuleType =
          AccountingEnumerations.accountingRuleType(accountingRuleId);

      final Integer lockinPeriodFrequency = JdbcSupport.getInteger(rs, "lockinPeriodFrequency");
      EnumOptionData lockinPeriodFrequencyType = null;
      final Integer lockinPeriodFrequencyTypeValue =
          JdbcSupport.getInteger(rs, "lockinPeriodFrequencyType");
      if (lockinPeriodFrequencyTypeValue != null) {
        lockinPeriodFrequencyType =
            SavingsEnumerations.lockinPeriodFrequencyType(lockinPeriodFrequencyTypeValue);
      }

      return DepositProductData.instance(
          id,
          name,
          shortName,
          description,
          currency,
          nominalAnnualInterestRate,
          compoundingInterestPeriodType,
          interestPostingPeriodType,
          interestCalculationType,
          interestCalculationDaysInYearType,
          lockinPeriodFrequency,
          lockinPeriodFrequencyType,
          accountingRuleType);
    }
    @Override
    public LoanProductData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum)
        throws SQLException {

      final Long id = JdbcSupport.getLong(rs, "id");
      final String name = rs.getString("name");
      final String shortName = rs.getString("shortName");
      final String description = rs.getString("description");
      final Long fundId = JdbcSupport.getLong(rs, "fundId");
      final String fundName = rs.getString("fundName");
      final Long transactionStrategyId = JdbcSupport.getLong(rs, "transactionStrategyId");
      final String transactionStrategyName = rs.getString("transactionStrategyName");

      final String currencyCode = rs.getString("currencyCode");
      final String currencyName = rs.getString("currencyName");
      final String currencyNameCode = rs.getString("currencyNameCode");
      final String currencyDisplaySymbol = rs.getString("currencyDisplaySymbol");
      final Integer currencyDigits = JdbcSupport.getInteger(rs, "currencyDigits");
      final Integer inMultiplesOf = JdbcSupport.getInteger(rs, "inMultiplesOf");

      final CurrencyData currency =
          new CurrencyData(
              currencyCode,
              currencyName,
              currencyDigits,
              inMultiplesOf,
              currencyDisplaySymbol,
              currencyNameCode);

      final BigDecimal principal = rs.getBigDecimal("principal");
      final BigDecimal minPrincipal = rs.getBigDecimal("minPrincipal");
      final BigDecimal maxPrincipal = rs.getBigDecimal("maxPrincipal");
      final BigDecimal tolerance = rs.getBigDecimal("tolerance");

      final Integer numberOfRepayments = JdbcSupport.getInteger(rs, "numberOfRepayments");
      final Integer minNumberOfRepayments = JdbcSupport.getInteger(rs, "minNumberOfRepayments");
      final Integer maxNumberOfRepayments = JdbcSupport.getInteger(rs, "maxNumberOfRepayments");
      final Integer repaymentEvery = JdbcSupport.getInteger(rs, "repaidEvery");

      final Integer graceOnPrincipalPayment =
          JdbcSupport.getIntegerDefaultToNullIfZero(rs, "graceOnPrincipalPayment");
      final Integer graceOnInterestPayment =
          JdbcSupport.getIntegerDefaultToNullIfZero(rs, "graceOnInterestPayment");
      final Integer graceOnInterestCharged =
          JdbcSupport.getIntegerDefaultToNullIfZero(rs, "graceOnInterestCharged");
      final Integer graceOnArrearsAgeing =
          JdbcSupport.getIntegerDefaultToNullIfZero(rs, "graceOnArrearsAgeing");
      final Integer overdueDaysForNPA =
          JdbcSupport.getIntegerDefaultToNullIfZero(rs, "overdueDaysForNPA");
      final Integer minimumDaysBetweenDisbursalAndFirstRepayment =
          JdbcSupport.getInteger(rs, "minimumDaysBetweenDisbursalAndFirstRepayment");

      final Integer accountingRuleId = JdbcSupport.getInteger(rs, "accountingType");
      final EnumOptionData accountingRuleType =
          AccountingEnumerations.accountingRuleType(accountingRuleId);

      final BigDecimal interestRatePerPeriod = rs.getBigDecimal("interestRatePerPeriod");
      final BigDecimal minInterestRatePerPeriod = rs.getBigDecimal("minInterestRatePerPeriod");
      final BigDecimal maxInterestRatePerPeriod = rs.getBigDecimal("maxInterestRatePerPeriod");
      final BigDecimal annualInterestRate = rs.getBigDecimal("annualInterestRate");

      final int repaymentFrequencyTypeId = JdbcSupport.getInteger(rs, "repaymentPeriodFrequency");
      final EnumOptionData repaymentFrequencyType =
          LoanEnumerations.repaymentFrequencyType(repaymentFrequencyTypeId);

      final int amortizationTypeId = JdbcSupport.getInteger(rs, "amortizationMethod");
      final EnumOptionData amortizationType = LoanEnumerations.amortizationType(amortizationTypeId);

      final int interestRateFrequencyTypeId =
          JdbcSupport.getInteger(rs, "interestRatePerPeriodFreq");
      final EnumOptionData interestRateFrequencyType =
          LoanEnumerations.interestRateFrequencyType(interestRateFrequencyTypeId);

      final int interestTypeId = JdbcSupport.getInteger(rs, "interestMethod");
      final EnumOptionData interestType = LoanEnumerations.interestType(interestTypeId);

      final int interestCalculationPeriodTypeId =
          JdbcSupport.getInteger(rs, "interestCalculationInPeriodMethod");
      final EnumOptionData interestCalculationPeriodType =
          LoanEnumerations.interestCalculationPeriodType(interestCalculationPeriodTypeId);

      final boolean includeInBorrowerCycle = rs.getBoolean("includeInBorrowerCycle");
      final boolean useBorrowerCycle = rs.getBoolean("useBorrowerCycle");
      final LocalDate startDate = JdbcSupport.getLocalDate(rs, "startDate");
      final LocalDate closeDate = JdbcSupport.getLocalDate(rs, "closeDate");
      String status = "";
      if (closeDate != null && closeDate.isBefore(DateUtils.getLocalDateOfTenant())) {
        status = "loanProduct.inActive";
      } else {
        status = "loanProduct.active";
      }
      final String externalId = rs.getString("externalId");
      final Collection<LoanProductBorrowerCycleVariationData> principalVariationsForBorrowerCycle =
          new ArrayList<>();
      final Collection<LoanProductBorrowerCycleVariationData>
          interestRateVariationsForBorrowerCycle = new ArrayList<>();
      final Collection<LoanProductBorrowerCycleVariationData>
          numberOfRepaymentVariationsForBorrowerCycle = new ArrayList<>();
      if (this.borrowerCycleVariationDatas != null) {
        for (final LoanProductBorrowerCycleVariationData borrowerCycleVariationData :
            this.borrowerCycleVariationDatas) {
          final LoanProductParamType loanProductParamType =
              borrowerCycleVariationData.getParamType();
          if (loanProductParamType.isParamTypePrincipal()) {
            principalVariationsForBorrowerCycle.add(borrowerCycleVariationData);
          } else if (loanProductParamType.isParamTypeInterestTate()) {
            interestRateVariationsForBorrowerCycle.add(borrowerCycleVariationData);
          } else if (loanProductParamType.isParamTypeRepayment()) {
            numberOfRepaymentVariationsForBorrowerCycle.add(borrowerCycleVariationData);
          }
        }
      }

      final Boolean multiDisburseLoan = rs.getBoolean("multiDisburseLoan");
      final Integer maxTrancheCount = rs.getInt("maxTrancheCount");
      final BigDecimal outstandingLoanBalance = rs.getBigDecimal("outstandingLoanBalance");

      final int daysInMonth = JdbcSupport.getInteger(rs, "daysInMonth");
      final EnumOptionData daysInMonthType = CommonEnumerations.daysInMonthType(daysInMonth);
      final int daysInYear = JdbcSupport.getInteger(rs, "daysInYear");
      final EnumOptionData daysInYearType = CommonEnumerations.daysInYearType(daysInYear);
      final boolean isInterestRecalculationEnabled =
          rs.getBoolean("isInterestRecalculationEnabled");

      LoanProductInterestRecalculationData interestRecalculationData = null;
      if (isInterestRecalculationEnabled) {

        final Long lprId = JdbcSupport.getLong(rs, "lprId");
        final Long productId = JdbcSupport.getLong(rs, "productId");
        final int compoundTypeEnumValue = JdbcSupport.getInteger(rs, "compoundType");
        final EnumOptionData interestRecalculationCompoundingType =
            LoanEnumerations.interestRecalculationCompoundingType(compoundTypeEnumValue);
        final int rescheduleStrategyEnumValue = JdbcSupport.getInteger(rs, "rescheduleStrategy");
        final EnumOptionData rescheduleStrategyType =
            LoanEnumerations.rescheduleStrategyType(rescheduleStrategyEnumValue);
        final int restFrequencyEnumValue = JdbcSupport.getInteger(rs, "restFrequencyEnum");
        final EnumOptionData restFrequencyType =
            LoanEnumerations.interestRecalculationFrequencyType(restFrequencyEnumValue);
        final int restFrequencyInterval = JdbcSupport.getInteger(rs, "restFrequencyInterval");
        final LocalDate restFrequencyDate = JdbcSupport.getLocalDate(rs, "restFrequencyDate");

        interestRecalculationData =
            new LoanProductInterestRecalculationData(
                lprId,
                productId,
                interestRecalculationCompoundingType,
                rescheduleStrategyType,
                restFrequencyType,
                restFrequencyInterval,
                restFrequencyDate);
      }

      final boolean holdGuaranteeFunds = rs.getBoolean("holdGuaranteeFunds");
      LoanProductGuaranteeData loanProductGuaranteeData = null;
      if (holdGuaranteeFunds) {
        final Long lpgId = JdbcSupport.getLong(rs, "lpgId");
        final BigDecimal mandatoryGuarantee = rs.getBigDecimal("mandatoryGuarantee");
        final BigDecimal minimumGuaranteeFromOwnFunds =
            rs.getBigDecimal("minimumGuaranteeFromOwnFunds");
        final BigDecimal minimumGuaranteeFromGuarantor =
            rs.getBigDecimal("minimumGuaranteeFromGuarantor");
        loanProductGuaranteeData =
            LoanProductGuaranteeData.instance(
                lpgId,
                id,
                mandatoryGuarantee,
                minimumGuaranteeFromOwnFunds,
                minimumGuaranteeFromGuarantor);
      }

      return new LoanProductData(
          id,
          name,
          shortName,
          description,
          currency,
          principal,
          minPrincipal,
          maxPrincipal,
          tolerance,
          numberOfRepayments,
          minNumberOfRepayments,
          maxNumberOfRepayments,
          repaymentEvery,
          interestRatePerPeriod,
          minInterestRatePerPeriod,
          maxInterestRatePerPeriod,
          annualInterestRate,
          repaymentFrequencyType,
          interestRateFrequencyType,
          amortizationType,
          interestType,
          interestCalculationPeriodType,
          fundId,
          fundName,
          transactionStrategyId,
          transactionStrategyName,
          graceOnPrincipalPayment,
          graceOnInterestPayment,
          graceOnInterestCharged,
          this.charges,
          accountingRuleType,
          includeInBorrowerCycle,
          useBorrowerCycle,
          startDate,
          closeDate,
          status,
          externalId,
          principalVariationsForBorrowerCycle,
          interestRateVariationsForBorrowerCycle,
          numberOfRepaymentVariationsForBorrowerCycle,
          multiDisburseLoan,
          maxTrancheCount,
          outstandingLoanBalance,
          graceOnArrearsAgeing,
          overdueDaysForNPA,
          daysInMonthType,
          daysInYearType,
          isInterestRecalculationEnabled,
          interestRecalculationData,
          minimumDaysBetweenDisbursalAndFirstRepayment,
          holdGuaranteeFunds,
          loanProductGuaranteeData);
    }