@Test(expected = WCTRuntimeException.class) public final void testProcessFormSubmissionNullCommand() throws Exception { testInstance.processFormSubmission(mockRequest, mockResponse, null, errors); }
@Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aResp, Object aCmd, BindException aErrors) throws Exception { TargetInstanceCommand command = (TargetInstanceCommand) aCmd; if (command == null || command.getCmd() == null) { throw new WCTRuntimeException("Unknown command recieved."); } String cmd = command.getCmd(); log.debug("process command {}", cmd); if (cmd.equals(TargetInstanceCommand.ACTION_FILTER) || PAGINATION_ACTIONS.contains(cmd)) { return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESET)) { command.setAgency(""); command.setOwner(""); command.setFrom(null); command.setTo(null); command.setName(""); command.setStates(new HashSet<String>()); command.setSearchOid(null); command.setFlagged(false); command.setSortorder(TargetInstanceCommand.SORT_DEFAULT); command.setFlagOid(null); command.setRecommendationFilter(null); return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_PAUSE)) { return processPause(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESUME)) { return processResume(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_ABORT)) { return processAbort(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_STOP)) { return processStop(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELETE)) { processDelete(command.getTargetInstanceId(), aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELIST)) { processDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELETE)) { processMultiDelete(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ENDORSE)) { processMultiEndorse(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_REJECT)) { processMultiReject(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ARCHIVE)) { StringBuilder queryString = new StringBuilder("redirect:/curator/archive/submit.html?"); List<String> multiSelect = command.getMultiselect(); for (int i = 0; i < multiSelect.size(); i++) { String tIOid = multiSelect.get(i); queryString.append("instanceID="); queryString.append(tIOid); if (i < multiSelect.size()) { queryString.append("&"); } } return new ModelAndView(queryString.toString()); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELIST)) { processMultiDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else { throw new WCTRuntimeException("Unknown command " + cmd + " recieved."); } }
QueueController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aResp, Object aCmd, BindException aErrors) throws Exception { TargetInstanceCommand command = (TargetInstanceCommand) aCmd; if (command == null || command.getCmd() == null) { throw new WCTRuntimeException("Unknown command recieved."); } String cmd = command.getCmd(); log.debug("process command {}", cmd); if (cmd.equals(TargetInstanceCommand.ACTION_FILTER) || PAGINATION_ACTIONS.contains(cmd)) { return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESET)) { command.setAgency(""); command.setOwner(""); command.setFrom(null); command.setTo(null); command.setName(""); command.setStates(new HashSet<String>()); command.setSearchOid(null); command.setFlagged(false); command.setSortorder(TargetInstanceCommand.SORT_DEFAULT); command.setFlagOid(null); command.setRecommendationFilter(null); return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_PAUSE)) { return processPause(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESUME)) { return processResume(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_ABORT)) { return processAbort(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_STOP)) { return processStop(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELETE)) { processDelete(command.getTargetInstanceId(), aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELIST)) { processDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELETE)) { processMultiDelete(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ENDORSE)) { processMultiEndorse(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_REJECT)) { processMultiReject(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ARCHIVE)) { StringBuilder queryString = new StringBuilder("redirect:/curator/archive/submit.html?"); List<String> multiSelect = command.getMultiselect(); for (int i = 0; i < multiSelect.size(); i++) { String tIOid = multiSelect.get(i); queryString.append("instanceID="); queryString.append(tIOid); if (i < multiSelect.size()) { queryString.append("&"); } } return new ModelAndView(queryString.toString()); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELIST)) { processMultiDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else { throw new WCTRuntimeException("Unknown command " + cmd + " recieved."); } } }
QueueController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aResp, Object aCmd, BindException aErrors) throws Exception { TargetInstanceCommand command = (TargetInstanceCommand) aCmd; if (command == null || command.getCmd() == null) { throw new WCTRuntimeException("Unknown command recieved."); } String cmd = command.getCmd(); log.debug("process command {}", cmd); if (cmd.equals(TargetInstanceCommand.ACTION_FILTER) || PAGINATION_ACTIONS.contains(cmd)) { return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESET)) { command.setAgency(""); command.setOwner(""); command.setFrom(null); command.setTo(null); command.setName(""); command.setStates(new HashSet<String>()); command.setSearchOid(null); command.setFlagged(false); command.setSortorder(TargetInstanceCommand.SORT_DEFAULT); command.setFlagOid(null); command.setRecommendationFilter(null); return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_PAUSE)) { return processPause(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESUME)) { return processResume(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_ABORT)) { return processAbort(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_STOP)) { return processStop(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELETE)) { processDelete(command.getTargetInstanceId(), aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELIST)) { processDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELETE)) { processMultiDelete(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ENDORSE)) { processMultiEndorse(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_REJECT)) { processMultiReject(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ARCHIVE)) { StringBuilder queryString = new StringBuilder("redirect:/curator/archive/submit.html?"); List<String> multiSelect = command.getMultiselect(); for (int i = 0; i < multiSelect.size(); i++) { String tIOid = multiSelect.get(i); queryString.append("instanceID="); queryString.append(tIOid); if (i < multiSelect.size()) { queryString.append("&"); } } return new ModelAndView(queryString.toString()); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELIST)) { processMultiDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else { throw new WCTRuntimeException("Unknown command " + cmd + " recieved."); } } QueueController(); }
QueueController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aResp, Object aCmd, BindException aErrors) throws Exception { TargetInstanceCommand command = (TargetInstanceCommand) aCmd; if (command == null || command.getCmd() == null) { throw new WCTRuntimeException("Unknown command recieved."); } String cmd = command.getCmd(); log.debug("process command {}", cmd); if (cmd.equals(TargetInstanceCommand.ACTION_FILTER) || PAGINATION_ACTIONS.contains(cmd)) { return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESET)) { command.setAgency(""); command.setOwner(""); command.setFrom(null); command.setTo(null); command.setName(""); command.setStates(new HashSet<String>()); command.setSearchOid(null); command.setFlagged(false); command.setSortorder(TargetInstanceCommand.SORT_DEFAULT); command.setFlagOid(null); command.setRecommendationFilter(null); return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_PAUSE)) { return processPause(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESUME)) { return processResume(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_ABORT)) { return processAbort(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_STOP)) { return processStop(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELETE)) { processDelete(command.getTargetInstanceId(), aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELIST)) { processDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELETE)) { processMultiDelete(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ENDORSE)) { processMultiEndorse(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_REJECT)) { processMultiReject(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ARCHIVE)) { StringBuilder queryString = new StringBuilder("redirect:/curator/archive/submit.html?"); List<String> multiSelect = command.getMultiselect(); for (int i = 0; i < multiSelect.size(); i++) { String tIOid = multiSelect.get(i); queryString.append("instanceID="); queryString.append(tIOid); if (i < multiSelect.size()) { queryString.append("&"); } } return new ModelAndView(queryString.toString()); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELIST)) { processMultiDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else { throw new WCTRuntimeException("Unknown command " + cmd + " recieved."); } } QueueController(); void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void setTargetInstanceManager(TargetInstanceManager aTargetInstanceManager); void setHarvestCoordinator(HarvestCoordinator harvestCoordinator); void setEnvironment(Environment environment); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setEnableQaModule(Boolean enableQaModule); void setThumbnailWidth(String thumbnailWidth); void setThumbnailHeight(String thumbnailHeight); void setThumbnailRenderer(String thumbnailRenderer); void setHarvestResourceUrlMapper(HarvestResourceUrlMapper harvestResourceUrlMapper); }
QueueController extends AbstractFormController { @Override protected ModelAndView processFormSubmission(HttpServletRequest aReq, HttpServletResponse aResp, Object aCmd, BindException aErrors) throws Exception { TargetInstanceCommand command = (TargetInstanceCommand) aCmd; if (command == null || command.getCmd() == null) { throw new WCTRuntimeException("Unknown command recieved."); } String cmd = command.getCmd(); log.debug("process command {}", cmd); if (cmd.equals(TargetInstanceCommand.ACTION_FILTER) || PAGINATION_ACTIONS.contains(cmd)) { return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESET)) { command.setAgency(""); command.setOwner(""); command.setFrom(null); command.setTo(null); command.setName(""); command.setStates(new HashSet<String>()); command.setSearchOid(null); command.setFlagged(false); command.setSortorder(TargetInstanceCommand.SORT_DEFAULT); command.setFlagOid(null); command.setRecommendationFilter(null); return processFilter(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_PAUSE)) { return processPause(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_RESUME)) { return processResume(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_ABORT)) { return processAbort(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_STOP)) { return processStop(aReq, aResp, command, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELETE)) { processDelete(command.getTargetInstanceId(), aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_DELIST)) { processDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELETE)) { processMultiDelete(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ENDORSE)) { processMultiEndorse(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_REJECT)) { processMultiReject(aReq, aResp, command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_ARCHIVE)) { StringBuilder queryString = new StringBuilder("redirect:/curator/archive/submit.html?"); List<String> multiSelect = command.getMultiselect(); for (int i = 0; i < multiSelect.size(); i++) { String tIOid = multiSelect.get(i); queryString.append("instanceID="); queryString.append(tIOid); if (i < multiSelect.size()) { queryString.append("&"); } } return new ModelAndView(queryString.toString()); } else if (cmd.equals(TargetInstanceCommand.ACTION_MULTI_DELIST)) { processMultiDelist(command, aErrors); return processFilter(aReq, aResp, null, aErrors); } else { throw new WCTRuntimeException("Unknown command " + cmd + " recieved."); } } QueueController(); void initBinder(HttpServletRequest request, ServletRequestDataBinder binder); void setTargetInstanceManager(TargetInstanceManager aTargetInstanceManager); void setHarvestCoordinator(HarvestCoordinator harvestCoordinator); void setEnvironment(Environment environment); void setAgencyUserManager(AgencyUserManager agencyUserManager); void setMessageSource(MessageSource messageSource); void setEnableQaModule(Boolean enableQaModule); void setThumbnailWidth(String thumbnailWidth); void setThumbnailHeight(String thumbnailHeight); void setThumbnailRenderer(String thumbnailRenderer); void setHarvestResourceUrlMapper(HarvestResourceUrlMapper harvestResourceUrlMapper);  }