@Test public void testDeleteCodeSystemVersionForm_throwException() throws Exception{ when(codeSystemVersionService.delete(anyLong())).thenThrow(new CodeSystemVersionNotFoundException()); mockMvc.perform(post("/sysadmin/codeSystemVersion/delete/1")) .andExpect(view().name("redirect:../../codeSystemVersionList")); }
@RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting codeSystemVersion with id: " + id); CodeSystemVersionDto deleted = new CodeSystemVersionDto(); try { deleted = codeSystemVersionService.delete(id); deleted.setError(false); deleted.setSuccessMessage(" CodeSystemVersion with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully. "); } catch (CodeSystemVersionNotFoundException e) { LOGGER.debug("No codeSystemVersion found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CODESYSTEMVERSION_WAS_NOT_FOUND); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO, deleted); return createRedirectViewPath(REDIRECT_ID_MAPPING_LIST); }
CodeSystemVersionController extends AbstractNodeController { @RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting codeSystemVersion with id: " + id); CodeSystemVersionDto deleted = new CodeSystemVersionDto(); try { deleted = codeSystemVersionService.delete(id); deleted.setError(false); deleted.setSuccessMessage(" CodeSystemVersion with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully. "); } catch (CodeSystemVersionNotFoundException e) { LOGGER.debug("No codeSystemVersion found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CODESYSTEMVERSION_WAS_NOT_FOUND); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO, deleted); return createRedirectViewPath(REDIRECT_ID_MAPPING_LIST); } }
CodeSystemVersionController extends AbstractNodeController { @RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting codeSystemVersion with id: " + id); CodeSystemVersionDto deleted = new CodeSystemVersionDto(); try { deleted = codeSystemVersionService.delete(id); deleted.setError(false); deleted.setSuccessMessage(" CodeSystemVersion with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully. "); } catch (CodeSystemVersionNotFoundException e) { LOGGER.debug("No codeSystemVersion found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CODESYSTEMVERSION_WAS_NOT_FOUND); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO, deleted); return createRedirectViewPath(REDIRECT_ID_MAPPING_LIST); }  }
CodeSystemVersionController extends AbstractNodeController { @RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting codeSystemVersion with id: " + id); CodeSystemVersionDto deleted = new CodeSystemVersionDto(); try { deleted = codeSystemVersionService.delete(id); deleted.setError(false); deleted.setSuccessMessage(" CodeSystemVersion with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully. "); } catch (CodeSystemVersionNotFoundException e) { LOGGER.debug("No codeSystemVersion found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CODESYSTEMVERSION_WAS_NOT_FOUND); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO, deleted); return createRedirectViewPath(REDIRECT_ID_MAPPING_LIST); }  @RequestMapping(value = REQUEST_MAPPING_LIST, method = RequestMethod.GET) String showCreateCodeSystemVersionForm(Model model, HttpServletRequest request); @RequestMapping(value = "codeSystemVersionAdd.html", method = RequestMethod.GET) String codeSystemVersionAddForm(Model model, HttpServletRequest request); @RequestMapping(value = "/codeSystemVersion/create", method = RequestMethod.POST) String submitCreateCodeSystemVersionForm(
			 @ModelAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO) CodeSystemVersionDto created,
			RedirectAttributes redirectAttribute, Model model); @RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) String delete(@PathVariable("id") Long id,
			RedirectAttributes redirectAttribute); @RequestMapping(value = "/codeSystemVersion/edit/{id}", method = RequestMethod.GET) String showEditCodeSystemVersionForm(@PathVariable("id") Long id,
			Model model, RedirectAttributes attributes); @RequestMapping(value = "/codeSystemVersion/edit/{id}", method = RequestMethod.POST) String submitEditCodeSystemVersionForm(
			@ModelAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO) CodeSystemVersionDto updated,
			@PathVariable("id") Long id); }
CodeSystemVersionController extends AbstractNodeController { @RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting codeSystemVersion with id: " + id); CodeSystemVersionDto deleted = new CodeSystemVersionDto(); try { deleted = codeSystemVersionService.delete(id); deleted.setError(false); deleted.setSuccessMessage(" CodeSystemVersion with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully. "); } catch (CodeSystemVersionNotFoundException e) { LOGGER.debug("No codeSystemVersion found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CODESYSTEMVERSION_WAS_NOT_FOUND); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO, deleted); return createRedirectViewPath(REDIRECT_ID_MAPPING_LIST); }  @RequestMapping(value = REQUEST_MAPPING_LIST, method = RequestMethod.GET) String showCreateCodeSystemVersionForm(Model model, HttpServletRequest request); @RequestMapping(value = "codeSystemVersionAdd.html", method = RequestMethod.GET) String codeSystemVersionAddForm(Model model, HttpServletRequest request); @RequestMapping(value = "/codeSystemVersion/create", method = RequestMethod.POST) String submitCreateCodeSystemVersionForm(
			 @ModelAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO) CodeSystemVersionDto created,
			RedirectAttributes redirectAttribute, Model model); @RequestMapping(value = "/codeSystemVersion/delete/{id}", method = RequestMethod.POST) String delete(@PathVariable("id") Long id,
			RedirectAttributes redirectAttribute); @RequestMapping(value = "/codeSystemVersion/edit/{id}", method = RequestMethod.GET) String showEditCodeSystemVersionForm(@PathVariable("id") Long id,
			Model model, RedirectAttributes attributes); @RequestMapping(value = "/codeSystemVersion/edit/{id}", method = RequestMethod.POST) String submitEditCodeSystemVersionForm(
			@ModelAttribute(MODEL_ATTIRUTE_CODESYSTEMVERSIONDTO) CodeSystemVersionDto updated,
			@PathVariable("id") Long id);  }