Beispiel #1
0
  public void updateGuarantorFinancialInformation(
      Investorindividual guarantor, FinancialInformation financialInformation) {
    FinancialInformation existingFinancialInformation;

    if (guarantor.getFinancialInformation() == null) {
      if (logger.isDebugEnabled()) {
        logger.debug("New financial data.  Creating new record first ...");
      }
      FinancialInformation newFinancialInformation = new FinancialInformation();

      guarantor.setFinancialInformation(newFinancialInformation);
      newFinancialInformation.setInvestorindividual(guarantor);

      this.financialInformationDao.save(newFinancialInformation);
      this.investorindividualDAO.update(guarantor);
      existingFinancialInformation = newFinancialInformation;
    } else {
      if (logger.isDebugEnabled()) {
        logger.debug("Updating existing financial data ...");
      }
      existingFinancialInformation = guarantor.getFinancialInformation();
    }

    // I do it this way so that I can control which fields are being updated.
    existingFinancialInformation.setCash(financialInformation.getCash());
    existingFinancialInformation.setShares(financialInformation.getShares());
    existingFinancialInformation.setOtherLiquid(financialInformation.getOtherLiquid());
    existingFinancialInformation.setResidentialProperty(
        financialInformation.getResidentialProperty());
    existingFinancialInformation.setInvestmentProperty(
        financialInformation.getInvestmentProperty());
    existingFinancialInformation.setOtherassets(financialInformation.getOtherassets());
    existingFinancialInformation.setOtherassetsDetails(
        financialInformation.getOtherassetsDetails());
    existingFinancialInformation.setOtherLoansSecured(financialInformation.getOtherLoansSecured());
    existingFinancialInformation.setLoansResProperty(financialInformation.getLoansResProperty());
    existingFinancialInformation.setLoansInvProperty(financialInformation.getLoansInvProperty());
    existingFinancialInformation.setLoansPersonalUnse(financialInformation.getLoansPersonalUnse());
    existingFinancialInformation.setGuaranteesGranted(financialInformation.getGuaranteesGranted());
    existingFinancialInformation.setOtherLiabilities(financialInformation.getOtherLiabilities());
    existingFinancialInformation.setOtherLiabilitiesDetails(
        financialInformation.getOtherLiabilitiesDetails());
    existingFinancialInformation.setSalary(financialInformation.getSalary());
    existingFinancialInformation.setRentalAndDividend(financialInformation.getRentalAndDividend());
    existingFinancialInformation.setOtherIncome(financialInformation.getOtherIncome());
    existingFinancialInformation.setOtherIncomeDetails(
        financialInformation.getOtherIncomeDetails());
    existingFinancialInformation.setTaxPayable(financialInformation.getTaxPayable());
    existingFinancialInformation.setTaxPayableDate(financialInformation.getTaxPayableDate());
    existingFinancialInformation.setIntSecuredLoans(financialInformation.getIntSecuredLoans());
    existingFinancialInformation.setIntUnsecuredLoans(financialInformation.getIntUnsecuredLoans());
    existingFinancialInformation.setLivingExpenses(financialInformation.getLivingExpenses());
    existingFinancialInformation.setOtherExpenses(financialInformation.getOtherExpenses());
    existingFinancialInformation.setOtherExpensesDetails(
        financialInformation.getOtherExpensesDetails());

    this.financialInformationDao.update(existingFinancialInformation);
  }