@Override public Person getNewPerson() { Person p = new Person(); // now initialize p.setBillingAddress(new Address()); p.setMainAddress(new Address()); p.setRegistrationInfo(new RegistrationInfo()); p.getRegistrationInfo().setStatus(RegistrationStatus.Unpaid); p.setSameBillingAddress(true); // return return p; }
@Override public void registerPerson(Person person) { if (person.getSameBillingAddress() == true) { logger.debug("same billing address"); person.setBillingAddress(person.getMainAddress()); } person.getRegistrationInfo().setJunkRegister(false); personRepository.save(person); // now generate refcode which will be 2012-0001 person.getRegistrationInfo().setRefCode("2012-" + String.format("%05d", person.getId())); person.getRegistrationInfo().setRegisterDate(new Date()); // personRepository.save(person); return; }