コード例 #1
0
 public EmergencyContactBean(Person loggedUser) {
   EmergencyContact emergencyContact =
       (loggedUser.getProfile() == null) ? null : loggedUser.getProfile().getEmergencyContact();
   if (emergencyContact != null) {
     setContact(emergencyContact.getContact());
   }
 }
コード例 #2
0
  public ActionForward updateEmergencyContact(
      ActionMapping mapping,
      ActionForm actionForm,
      HttpServletRequest request,
      HttpServletResponse response) {
    EmergencyContactBean emergencyContactBean = getRenderedObject();
    Person person = getLoggedPerson(request);

    try {
      EmergencyContact.updateEmergencyContact(
          person.getProfile(), emergencyContactBean.getContact());
    } catch (DomainException e) {
      addActionMessage(request, e.getKey());
      request.setAttribute("personBean", new PersonBean(person));
      request.setAttribute("emergencyContactBean", new EmergencyContactBean(person));
    }

    request.setAttribute("personBean", new PersonBean(person));
    request.setAttribute("emergencyContactBean", emergencyContactBean);
    return mapping.findForward("visualizePersonalInformation");
  }
コード例 #3
0
 public EmergencyContactBean(EmergencyContact emergencyContact) {
   setContact(emergencyContact.getContact());
 }