protected RequestBean1 getRequestBean1() {
return (RequestBean1)getBean("RequestBean1");
}
public String buttonValidate_action() {
VolunteerController ctrlVolunteer = new VolunteerController();
PersonController ctrlPerson = new PersonController();
Volunteer volunteer = getSessionBean1().getVolunteer();
// parse the next of Kin & the parents
Person contactNextOfKin = null;
Person contactParent;
if (nextOfKin.getText().length() > 0) {
contactNextOfKin = ctrlPerson.parse((String) nextOfKin.getValue());
if (contactNextOfKin != null) {
volunteer.setNextOfKin(contactNextOfKin);
}
}
if (volunteer.isParentsSameAsNextOfKin()) {
volunteer.setParents(contactNextOfKin);
} else {
if (parents.getText().length() > 0) {
contactParent = ctrlPerson.parse((String) parents.getValue());
if (contactParent != null) {
volunteer.setParents(contactParent);
}
}
}
// Remove previous Person if creation of Volunteer from a Person
if (getSessionBean1().getPerson() != null &&
getSessionBean1().getPerson().getIdContact() == volunteer.getIdContact() ) {
ctrlPerson.delete(getSessionBean1().getPerson());
}
// Persit the new object
ctrlVolunteer.update(volunteer);
//Set the person property for info display
getSessionBean1().setPerson(volunteer);
return "success";
}