Exemplo n.º 1
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;
  }
Exemplo n.º 2
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);
  }