Package com.adito.replacementproxy.forms

Examples of com.adito.replacementproxy.forms.ReplacementForm


  public ActionForward commit(ActionMapping mapping,
                              ActionForm form,
                              HttpServletRequest request,
                              HttpServletResponse response) throws Exception {
    ReplacementForm rf = (ReplacementForm)form;
    SessionInfo info = this.getSessionInfo(request);
   
    if (null == rf.getReplacement().getMatchPattern() ||"".equals(rf.getReplacement().getMatchPattern())) {
        ActionMessages mesgs = new ActionMessages();   
        mesgs.add(Globals.MESSAGE_KEY, new ActionMessage("createReplacement.error.noMatchPattern"));
        saveErrors(request, mesgs);
        return mapping.findForward("display");
    }
    if(rf.isEditing()) {
      try {
            WebForwardDatabaseFactory.getInstance().updateReplacement(rf.getReplacement());
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.UPDATE_REPLACEMENT, null, info, CoreEvent.STATE_SUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
      } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.UPDATE_REPLACEMENT, null, info, CoreEvent.STATE_UNSUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
        throw e;
      }
    }
    else {
      try {
            WebForwardDatabaseFactory.getInstance().createReplacement(rf.getReplacement());
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.CREATE_REPLACEMENT, null, info, CoreEvent.STATE_SUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
      } catch (Exception e) {
            CoreServlet.getServlet().fireCoreEvent(new CoreEvent(this, WebForwardEventConstants.CREATE_REPLACEMENT, null, info, CoreEvent.STATE_UNSUCCESSFUL)
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_TYPE, rf.getReplaceType())
                .addAttribute(WebForwardEventConstants.EVENT_ATTR_REPLACEMENT_PATTERN, rf.getReplacement().getReplacePattern()));
        throw e;
      }
    }
    ActionMessages msgs = new ActionMessages();
    msgs.add(Globals.MESSAGE_KEY, new ActionMessage("createReplacement.message.saved"));
View Full Code Here

TOP

Related Classes of com.adito.replacementproxy.forms.ReplacementForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.