@Test public final void testProcessFormSubmission_view() { String action = TemplateCommand.ACTION_VIEW; setUpController(); TemplateCommand aCmd = setUpCommand(action, 1); BindException aError = new BindException(aCmd, action); MockHttpServletRequest aReq = new MockHttpServletRequest(); MockHttpServletResponse aRes = new MockHttpServletResponse(); try { ModelAndView mav = testInstance.processFormSubmission(aReq, aRes, aCmd, aError); assertTrue(mav.getViewName().equals("view-template")); } catch(Exception e) { fail(e.getMessage()); } }
@Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aRes, Object aCmd, BindException aError) throws Exception { ModelAndView mav = null; TemplateCommand templateCmd = (TemplateCommand) aCmd; if (templateCmd != null) { if (aError.hasErrors()) { mav = getNewTemplateView(templateCmd); mav.addObject(Constants.GBL_CMD_DATA, aError.getTarget()); mav.addObject(Constants.GBL_ERRORS, aError); } else if (TemplateCommand.ACTION_NEW.equals(templateCmd.getAction())) { log.debug("New Action on TemplateController"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_SAVE.equals(templateCmd.getAction())) { log.debug("Save Action on TemplateController"); mav = getSaveTemplateView(templateCmd); } else if (TemplateCommand.ACTION_VIEW.equals(templateCmd.getAction())) { log.debug("View Action on Template Controller"); mav = getViewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_EDIT.equals(templateCmd.getAction())) { log.debug("Edit Action on Template Controller"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_DELETE.equals(templateCmd.getAction())) { log.debug("Delete Action on Template Controller"); mav = getDeleteView(templateCmd); } } return mav; }
TemplateController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aRes, Object aCmd, BindException aError) throws Exception { ModelAndView mav = null; TemplateCommand templateCmd = (TemplateCommand) aCmd; if (templateCmd != null) { if (aError.hasErrors()) { mav = getNewTemplateView(templateCmd); mav.addObject(Constants.GBL_CMD_DATA, aError.getTarget()); mav.addObject(Constants.GBL_ERRORS, aError); } else if (TemplateCommand.ACTION_NEW.equals(templateCmd.getAction())) { log.debug("New Action on TemplateController"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_SAVE.equals(templateCmd.getAction())) { log.debug("Save Action on TemplateController"); mav = getSaveTemplateView(templateCmd); } else if (TemplateCommand.ACTION_VIEW.equals(templateCmd.getAction())) { log.debug("View Action on Template Controller"); mav = getViewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_EDIT.equals(templateCmd.getAction())) { log.debug("Edit Action on Template Controller"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_DELETE.equals(templateCmd.getAction())) { log.debug("Delete Action on Template Controller"); mav = getDeleteView(templateCmd); } } return mav; } }
TemplateController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aRes, Object aCmd, BindException aError) throws Exception { ModelAndView mav = null; TemplateCommand templateCmd = (TemplateCommand) aCmd; if (templateCmd != null) { if (aError.hasErrors()) { mav = getNewTemplateView(templateCmd); mav.addObject(Constants.GBL_CMD_DATA, aError.getTarget()); mav.addObject(Constants.GBL_ERRORS, aError); } else if (TemplateCommand.ACTION_NEW.equals(templateCmd.getAction())) { log.debug("New Action on TemplateController"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_SAVE.equals(templateCmd.getAction())) { log.debug("Save Action on TemplateController"); mav = getSaveTemplateView(templateCmd); } else if (TemplateCommand.ACTION_VIEW.equals(templateCmd.getAction())) { log.debug("View Action on Template Controller"); mav = getViewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_EDIT.equals(templateCmd.getAction())) { log.debug("Edit Action on Template Controller"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_DELETE.equals(templateCmd.getAction())) { log.debug("Delete Action on Template Controller"); mav = getDeleteView(templateCmd); } } return mav; } TemplateController(); }
TemplateController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aRes, Object aCmd, BindException aError) throws Exception { ModelAndView mav = null; TemplateCommand templateCmd = (TemplateCommand) aCmd; if (templateCmd != null) { if (aError.hasErrors()) { mav = getNewTemplateView(templateCmd); mav.addObject(Constants.GBL_CMD_DATA, aError.getTarget()); mav.addObject(Constants.GBL_ERRORS, aError); } else if (TemplateCommand.ACTION_NEW.equals(templateCmd.getAction())) { log.debug("New Action on TemplateController"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_SAVE.equals(templateCmd.getAction())) { log.debug("Save Action on TemplateController"); mav = getSaveTemplateView(templateCmd); } else if (TemplateCommand.ACTION_VIEW.equals(templateCmd.getAction())) { log.debug("View Action on Template Controller"); mav = getViewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_EDIT.equals(templateCmd.getAction())) { log.debug("Edit Action on Template Controller"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_DELETE.equals(templateCmd.getAction())) { log.debug("Delete Action on Template Controller"); mav = getDeleteView(templateCmd); } } return mav; } TemplateController(); @Override void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void setPermissionTemplateManager(
            PermissionTemplateManager permissionTemplateManager); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); String getDefaultSubject(); void setDefaultSubject(String defaultSubject); }
TemplateController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aRes, Object aCmd, BindException aError) throws Exception { ModelAndView mav = null; TemplateCommand templateCmd = (TemplateCommand) aCmd; if (templateCmd != null) { if (aError.hasErrors()) { mav = getNewTemplateView(templateCmd); mav.addObject(Constants.GBL_CMD_DATA, aError.getTarget()); mav.addObject(Constants.GBL_ERRORS, aError); } else if (TemplateCommand.ACTION_NEW.equals(templateCmd.getAction())) { log.debug("New Action on TemplateController"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_SAVE.equals(templateCmd.getAction())) { log.debug("Save Action on TemplateController"); mav = getSaveTemplateView(templateCmd); } else if (TemplateCommand.ACTION_VIEW.equals(templateCmd.getAction())) { log.debug("View Action on Template Controller"); mav = getViewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_EDIT.equals(templateCmd.getAction())) { log.debug("Edit Action on Template Controller"); mav = getNewTemplateView(templateCmd); } else if (TemplateCommand.ACTION_DELETE.equals(templateCmd.getAction())) { log.debug("Delete Action on Template Controller"); mav = getDeleteView(templateCmd); } } return mav; } TemplateController(); @Override void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void setPermissionTemplateManager(
            PermissionTemplateManager permissionTemplateManager); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); String getDefaultSubject(); void setDefaultSubject(String defaultSubject);  }