@Test public void testDeleteConceptCode_withPost() throws Exception{ ConceptCodeDto deleted=new ConceptCodeDto(); when(conceptCodeService.delete(anyLong())).thenReturn(deleted); mockMvc.perform(post("/sysadmin/conceptCode/delete/1")) .andExpect(status().isMethodNotAllowed()); }
@RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting conceptCode with id: " + id); ConceptCodeDto deleted = new ConceptCodeDto(); try { deleted = conceptCodeService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ConceptCode with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ConceptCodeNotFoundException e) { LOGGER.debug("No conceptCode found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CONCEPTCODE_WAS_NOT_FOUND); } redirectAttribute.addFlashAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } }
ConceptCodeController extends AbstractNodeController { @RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting conceptCode with id: " + id); ConceptCodeDto deleted = new ConceptCodeDto(); try { deleted = conceptCodeService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ConceptCode with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ConceptCodeNotFoundException e) { LOGGER.debug("No conceptCode found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CONCEPTCODE_WAS_NOT_FOUND); } redirectAttribute.addFlashAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } } }
ConceptCodeController extends AbstractNodeController { @RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting conceptCode with id: " + id); ConceptCodeDto deleted = new ConceptCodeDto(); try { deleted = conceptCodeService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ConceptCode with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ConceptCodeNotFoundException e) { LOGGER.debug("No conceptCode found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CONCEPTCODE_WAS_NOT_FOUND); } redirectAttribute.addFlashAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } }  }
ConceptCodeController extends AbstractNodeController { @RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting conceptCode with id: " + id); ConceptCodeDto deleted = new ConceptCodeDto(); try { deleted = conceptCodeService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ConceptCode with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ConceptCodeNotFoundException e) { LOGGER.debug("No conceptCode found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CONCEPTCODE_WAS_NOT_FOUND); } redirectAttribute.addFlashAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } }  @RequestMapping(value = REQUEST_MAPPING_LIST, method = RequestMethod.GET) String showCreateConceptCodeForm(
			Model model,
			@RequestParam(value = "panelState", required = false, defaultValue = "") String panelState); @RequestMapping(value = "conceptCodeAdd.html", method = RequestMethod.GET) String conceptCodeAddForm(Model model, HttpServletRequest request); @RequestMapping(value = "/conceptCode/create", method = RequestMethod.POST) String ceateConceptCodeForm(
			@Valid @ModelAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO) ConceptCodeDto created,
			RedirectAttributes redirectAttribute, Model model); @RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) @ResponseBody String delete(@PathVariable("id") Long id,
			RedirectAttributes redirectAttribute); @RequestMapping(value = "/conceptCode/edit/{id}", method = RequestMethod.GET) String showEditConceptCodeForm(@PathVariable("id") Long id,
			Model model, RedirectAttributes attributes); @RequestMapping(value = "/conceptCode/edit/{id}", method = RequestMethod.POST) String submitEditConceptCodeForm(
			@ModelAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO) ConceptCodeDto updated,
			@PathVariable("id") Long id, RedirectAttributes redirectAttribute,
			Model model); @RequestMapping("/conceptCode/ajaxSearchConceptCode/pageNumber/{pageNumber}/searchCategory/{searchCategory}/searchTerm/{searchTerm}/codeSystem/{codeSystem}/codeSystemVersion/{codeSystemVersion}/valueSetName/{valueSetName}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> searchConceptCode(
			@PathVariable("searchCategory") String searchCategory,
			@PathVariable("searchTerm") String searchTerm,
			@PathVariable("codeSystem") String codeSystem,
			@PathVariable("codeSystemVersion") String codeSystemVersion,
			@PathVariable("valueSetName") String valueSetName,
			@PathVariable("pageNumber") String pageNumber); @RequestMapping("/conceptCode/populateValueSetNames/codeSystem/{codeSystem}/codeSystemVersion/{codeSystemVersion}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, String> populateValueSetNames(
			@PathVariable("codeSystem") String codeSystem,
			@PathVariable("codeSystemVersion") String codeSystemVersion); @RequestMapping("/conceptCode/ajaxGetAllConceptCodes") @ResponseStatus(HttpStatus.OK) @ResponseBody List<ConceptCodeDto> getAllConceptCodes(); @RequestMapping("/conceptCode/ajaxGetPagedConceptCodes/pageNumber/{pageNumber}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> getAllConceptCodes(
			@PathVariable("pageNumber") String pageNumber); @RequestMapping(value = "/conceptCode/batchUpload", method = RequestMethod.POST) String batchUpload(
			@RequestParam(value = "codeSystemId", required = false) String codeSystemId,
			@RequestParam(value = "codeSystemVersionId", required = false) Long codeSystemVersionId,
			HttpServletRequest request,
			@RequestParam("batch_file") MultipartFile file,
			@RequestParam(value = "valueSetIds", required = false) List<Long> valueSetIds,
			RedirectAttributes redirectAttribute); }
ConceptCodeController extends AbstractNodeController { @RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting conceptCode with id: " + id); ConceptCodeDto deleted = new ConceptCodeDto(); try { deleted = conceptCodeService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ConceptCode with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ConceptCodeNotFoundException e) { LOGGER.debug("No conceptCode found with id: " + id); deleted.setError(true); deleted.setErrorMessage(ERROR_MESSAGE_KEY_DELETED_CONCEPTCODE_WAS_NOT_FOUND); } redirectAttribute.addFlashAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } }  @RequestMapping(value = REQUEST_MAPPING_LIST, method = RequestMethod.GET) String showCreateConceptCodeForm(
			Model model,
			@RequestParam(value = "panelState", required = false, defaultValue = "") String panelState); @RequestMapping(value = "conceptCodeAdd.html", method = RequestMethod.GET) String conceptCodeAddForm(Model model, HttpServletRequest request); @RequestMapping(value = "/conceptCode/create", method = RequestMethod.POST) String ceateConceptCodeForm(
			@Valid @ModelAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO) ConceptCodeDto created,
			RedirectAttributes redirectAttribute, Model model); @RequestMapping(value = "/conceptCode/delete/{id}", method = RequestMethod.DELETE) @ResponseBody String delete(@PathVariable("id") Long id,
			RedirectAttributes redirectAttribute); @RequestMapping(value = "/conceptCode/edit/{id}", method = RequestMethod.GET) String showEditConceptCodeForm(@PathVariable("id") Long id,
			Model model, RedirectAttributes attributes); @RequestMapping(value = "/conceptCode/edit/{id}", method = RequestMethod.POST) String submitEditConceptCodeForm(
			@ModelAttribute(MODEL_ATTIRUTE_CONCEPTCODEDTO) ConceptCodeDto updated,
			@PathVariable("id") Long id, RedirectAttributes redirectAttribute,
			Model model); @RequestMapping("/conceptCode/ajaxSearchConceptCode/pageNumber/{pageNumber}/searchCategory/{searchCategory}/searchTerm/{searchTerm}/codeSystem/{codeSystem}/codeSystemVersion/{codeSystemVersion}/valueSetName/{valueSetName}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> searchConceptCode(
			@PathVariable("searchCategory") String searchCategory,
			@PathVariable("searchTerm") String searchTerm,
			@PathVariable("codeSystem") String codeSystem,
			@PathVariable("codeSystemVersion") String codeSystemVersion,
			@PathVariable("valueSetName") String valueSetName,
			@PathVariable("pageNumber") String pageNumber); @RequestMapping("/conceptCode/populateValueSetNames/codeSystem/{codeSystem}/codeSystemVersion/{codeSystemVersion}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, String> populateValueSetNames(
			@PathVariable("codeSystem") String codeSystem,
			@PathVariable("codeSystemVersion") String codeSystemVersion); @RequestMapping("/conceptCode/ajaxGetAllConceptCodes") @ResponseStatus(HttpStatus.OK) @ResponseBody List<ConceptCodeDto> getAllConceptCodes(); @RequestMapping("/conceptCode/ajaxGetPagedConceptCodes/pageNumber/{pageNumber}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> getAllConceptCodes(
			@PathVariable("pageNumber") String pageNumber); @RequestMapping(value = "/conceptCode/batchUpload", method = RequestMethod.POST) String batchUpload(
			@RequestParam(value = "codeSystemId", required = false) String codeSystemId,
			@RequestParam(value = "codeSystemVersionId", required = false) Long codeSystemVersionId,
			HttpServletRequest request,
			@RequestParam("batch_file") MultipartFile file,
			@RequestParam(value = "valueSetIds", required = false) List<Long> valueSetIds,
			RedirectAttributes redirectAttribute);  }