Exemplo n.º 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);
    }
  }
Exemplo n.º 2
0
  public void updateAdvisorDetails(Advisor advisor, Advisorfirm advisorfirm) {
    Advisor persistentAdvisor = this.advisorDAO.findById(advisor.getId());

    persistentAdvisor.setAssistantname(advisor.getAssistantname());
    persistentAdvisor.setAssistantemail(advisor.getAssistantemail());

    Individual persistentIndividual = persistentAdvisor.getIndividual();
    Individual transientIndividual = advisor.getIndividual();

    persistentIndividual.setTitle(transientIndividual.getTitle());
    persistentIndividual.setFirstname(transientIndividual.getFirstname());
    persistentIndividual.setLastname(transientIndividual.getLastname());
    persistentIndividual.setWorkphone(transientIndividual.getWorkphone());
    persistentIndividual.setMobilephone(transientIndividual.getMobilephone());
    persistentIndividual.setWorkfax(transientIndividual.getWorkfax());
    persistentIndividual.setWorkemail(transientIndividual.getWorkemail());

    Company persistentAdvisorFirmCompany = persistentAdvisor.getAdvisorfirm().getCompany();
    Company tranientAdvisorFirmCompany = advisorfirm.getCompany();

    persistentAdvisorFirmCompany.setName(tranientAdvisorFirmCompany.getName());
    persistentAdvisorFirmCompany.setAbn(tranientAdvisorFirmCompany.getAbn());
    persistentAdvisorFirmCompany.setAddress1(tranientAdvisorFirmCompany.getAddress1());
    persistentAdvisorFirmCompany.setSuburb(tranientAdvisorFirmCompany.getSuburb());
    persistentAdvisorFirmCompany.setState(tranientAdvisorFirmCompany.getState());
    persistentAdvisorFirmCompany.setPostcode(tranientAdvisorFirmCompany.getPostcode());

    this.advisorDAO.updateAdvisorDetails(persistentAdvisor);
  }
Exemplo n.º 3
0
  public void updateGuarantorDetails(
      Investorindividual guarantor,
      Investorindividual transientGuarantor,
      Individual transientIndividual) {
    if (!guarantor.getRole().equals(Constants.GUARANTOR)) {
      throw new IllegalArgumentException(
          "Investoriidividual to update must be an external guarantor.");
    }

    Individual individual = guarantor.getIndividual();

    // Column 1:
    individual.setTitle(transientIndividual.getTitle());
    individual.setFirstname(transientIndividual.getFirstname());
    individual.setMiddlename(transientIndividual.getMiddlename());
    individual.setLastname(transientIndividual.getLastname());
    individual.setAddress1(transientIndividual.getAddress1());
    individual.setSuburb(transientIndividual.getSuburb());
    individual.setState(transientIndividual.getState());
    individual.setPostcode(transientIndividual.getPostcode());
    individual.setCountry(transientIndividual.getCountry());

    // Column 2:
    individual.setPassportno(transientIndividual.getPassportno());
    individual.setNationality(transientIndividual.getNationality());
    individual.setDriverslicenceno(transientIndividual.getDriverslicenceno());
    individual.setOccupation(transientIndividual.getOccupation());
    individual.setEmployer(transientIndividual.getEmployer());
    individual.setDateofbirth(transientIndividual.getDateofbirth());
    individual.setTownofbirth(transientIndividual.getTownofbirth());
    individual.setCountryofbirth(transientIndividual.getCountryofbirth());
    individual.setTfn(transientIndividual.getTfn());

    this.individualDAO.update(individual);

    Investorindividual investorindividual = guarantor;

    investorindividual.setWealthbyemployment(transientGuarantor.getWealthbyemployment());
    investorindividual.setWealthbyinvestments(transientGuarantor.getWealthbyinvestments());
    investorindividual.setWealthbyother(transientGuarantor.getWealthbyother());
    investorindividual.setWealthbyotherinfo(transientGuarantor.getWealthbyotherinfo());

    this.investorindividualDAO.update(investorindividual);
  }
Exemplo n.º 4
0
  public Investorindividual createExternalGuarantor(
      Application application,
      Investorindividual transientInvestorindividual,
      Individual transientIndividual) {
    if (logger.isDebugEnabled()) {
      logger.debug("Creating new external guarantor individual ...");
    }

    Individual individual = new Individual();

    // Column 1:
    individual.setTitle(transientIndividual.getTitle());
    individual.setFirstname(transientIndividual.getFirstname());
    individual.setMiddlename(transientIndividual.getMiddlename());
    individual.setLastname(transientIndividual.getLastname());
    individual.setAddress1(transientIndividual.getAddress1());
    individual.setSuburb(transientIndividual.getSuburb());
    individual.setState(transientIndividual.getState());
    individual.setPostcode(transientIndividual.getPostcode());
    individual.setCountry(transientIndividual.getCountry());

    // Column 2:
    individual.setPassportno(transientIndividual.getPassportno());
    individual.setNationality(transientIndividual.getNationality());
    individual.setDriverslicenceno(transientIndividual.getDriverslicenceno());
    individual.setOccupation(transientIndividual.getOccupation());
    individual.setEmployer(transientIndividual.getEmployer());
    individual.setDateofbirth(transientIndividual.getDateofbirth());
    individual.setTownofbirth(transientIndividual.getTownofbirth());
    individual.setCountryofbirth(transientIndividual.getCountryofbirth());
    individual.setTfn(transientIndividual.getTfn());

    this.individualDAO.save(individual);

    if (logger.isDebugEnabled()) {
      logger.debug("Linking new external guarantor individual to application ...");
    }

    Investorindividual investorindividual = new Investorindividual();

    investorindividual.setApplication(application);
    application.getInvestorindividuals().add(investorindividual);

    investorindividual.setIndividual(individual);
    individual.getInvestorindividuals().add(investorindividual);

    investorindividual.setRole(Constants.GUARANTOR);
    investorindividual.setIsguarantor(Constants.TRUE);

    investorindividual.setWealthbyemployment(transientInvestorindividual.getWealthbyemployment());
    investorindividual.setWealthbyinvestments(transientInvestorindividual.getWealthbyinvestments());
    investorindividual.setWealthbyother(transientInvestorindividual.getWealthbyother());
    investorindividual.setWealthbyotherinfo(transientInvestorindividual.getWealthbyotherinfo());

    this.investorindividualDAO.save(investorindividual);

    return investorindividual;
  }