public ActionForward editPartyContact( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { if (getRenderedObject("edit-contact") instanceof PartyContactBean) { PartyContactBean contact = getRenderedObject("edit-contact"); Boolean wasValidated = false; try { if (contact.hasPartyContact()) { addActionMessage( "contacts", request, "label.contact.validate.already", contact.getValue()); return backToShowInformation(mapping, actionForm, request, response); } wasValidated = editContact(contact); } catch (DomainException e) { addActionMessage("contacts", request, e.getMessage(), e.getArgs()); } if (wasValidated) { addWarningMessage(request, contact); return forwardToInputValidationCode( mapping, actionForm, request, response, contact.getContact()); } return backToShowInformation(mapping, actionForm, request, response); } return null; }
public ActionForward createPartyContact( ActionMapping mapping, ActionForm actionForm, HttpServletRequest request, HttpServletResponse response) throws FenixServiceException { if (getRenderedObject("edit-contact") instanceof PartyContactBean) { PartyContactBean contact = getRenderedObject("edit-contact"); PartyContact newPartyContact = null; try { newPartyContact = createContact(contact); if (newPartyContact == null) { addActionMessage( "contacts", request, "label.contact.validate.already", contact.getValue()); return backToShowInformation(mapping, actionForm, request, response); } else { addWarningMessage(request, contact); } } catch (DomainException e) { addActionMessage("contacts", request, e.getMessage(), e.getArgs()); } return forwardToInputValidationCode(mapping, actionForm, request, response, newPartyContact); } return null; }
protected void addWarningMessage(HttpServletRequest request, PartyContactBean contactBean) { addActionMessage( "contacts", request, contactBean.getValidationMessageKey(), contactBean.getValue()); }
protected void addWarningMessage(HttpServletRequest request, PartyContact partyContact) { PartyContactBean contactBean = PartyContactBean.createFromDomain(partyContact); addActionMessage( "contacts", request, contactBean.getValidationMessageKey(), contactBean.getValue()); }