Beispiel #1
0
  public void removeAsGuarantor(Investorindividual oldGuarantor) {
    if (oldGuarantor.getRole().equals(Constants.GUARANTOR)) {
      if (logger.isDebugEnabled()) {
        logger.debug("Guarantor to remove is external, so deleting ...");
      }

      Individual individual = oldGuarantor.getIndividual();
      individual.getInvestorindividuals().remove(oldGuarantor); // throws lazy error.
      oldGuarantor.setIndividual(null);
      this.individualDAO.delete(individual);

      FinancialInformation financialInformation = oldGuarantor.getFinancialInformation();
      financialInformation.setInvestorindividual(null);
      oldGuarantor.setFinancialInformation(null);
      this.financialInformationDao.delete(financialInformation);

      Application application = oldGuarantor.getApplication();
      oldGuarantor.setApplication(null);
      application.getInvestorindividuals().remove(oldGuarantor);
      this.investorindividualDAO.delete(oldGuarantor);

      this.applicationDAO.update(application);
    } else {
      if (logger.isDebugEnabled()) {
        logger.debug("Guarantor to remove is internal, so updating flags ...");
      }
      oldGuarantor.setIsguarantor(Constants.FALSE);
      this.investorindividualDAO.update(oldGuarantor);

      FinancialInformation financialInformation = oldGuarantor.getFinancialInformation();
      financialInformation.setInvestorindividual(null);
      oldGuarantor.setFinancialInformation(null);
      this.financialInformationDao.delete(financialInformation);
    }
  }
Beispiel #2
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);
  }