コード例 #1
0
  @Override
  public Collection<LoanProductData> retrieveAllLoanProducts() {

    AppUser currentUser = this.context.authenticatedUser();
    // TODO - include currency read in the sql
    List<CurrencyData> allowedCurrencies =
        currencyReadPlatformService.retrieveAllPlatformCurrencies();

    LoanProductMapper rm = new LoanProductMapper(allowedCurrencies);

    String sql = "select " + rm.loanProductSchema() + " where lp.org_id = ?";

    return this.jdbcTemplate.query(sql, rm, new Object[] {currentUser.getOrganisation().getId()});
  }
コード例 #2
0
  @Override
  public LoanProductData retrieveLoanProduct(final Long loanProductId) {

    try {
      List<CurrencyData> allowedCurrencies =
          currencyReadPlatformService.retrieveAllPlatformCurrencies();

      LoanProductMapper rm = new LoanProductMapper(allowedCurrencies);
      String sql = "select " + rm.loanProductSchema() + " where lp.id = ?";

      LoanProductData productData =
          this.jdbcTemplate.queryForObject(sql, rm, new Object[] {loanProductId});

      populateProductDataWithDropdownOptions(productData);

      return productData;
    } catch (EmptyResultDataAccessException e) {
      throw new LoanProductNotFoundException(loanProductId);
    }
  }