@Test public void testDeleteValueSet_withPost() throws Exception{ ValueSetDto deleted=new ValueSetDto(); when(valueSetService.delete(anyLong())).thenReturn(deleted); mockMvc.perform(post("/sysadmin/valueSet/delete/1")) .andExpect(status().isMethodNotAllowed()); }
@RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting valueSet with id: " + id); ValueSetDto deleted = new ValueSetDto(); try { deleted = valueSetService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ValueSet with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ValueSetNotFoundException e) { LOGGER.debug(e.getMessage()); deleted.setError(true); deleted.setErrorMessage(e.getMessage()); throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_VALUESETDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } }
ValueSetController extends AbstractNodeController { @RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting valueSet with id: " + id); ValueSetDto deleted = new ValueSetDto(); try { deleted = valueSetService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ValueSet with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ValueSetNotFoundException e) { LOGGER.debug(e.getMessage()); deleted.setError(true); deleted.setErrorMessage(e.getMessage()); throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_VALUESETDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } } }
ValueSetController extends AbstractNodeController { @RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting valueSet with id: " + id); ValueSetDto deleted = new ValueSetDto(); try { deleted = valueSetService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ValueSet with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ValueSetNotFoundException e) { LOGGER.debug(e.getMessage()); deleted.setError(true); deleted.setErrorMessage(e.getMessage()); throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_VALUESETDTO, deleted); if (deleted.isError == false) { return deleted.getSuccessMessage(); } else { throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, deleted.getErrorMessage()); } }  }
ValueSetController extends AbstractNodeController { @RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting valueSet with id: " + id); ValueSetDto deleted = new ValueSetDto(); try { deleted = valueSetService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ValueSet with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ValueSetNotFoundException e) { LOGGER.debug(e.getMessage()); deleted.setError(true); deleted.setErrorMessage(e.getMessage()); throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_VALUESETDTO, 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 showCreateValueSetForm(
			Model model,
			@RequestParam(value = "panelState", required = false, defaultValue = "") String panelState); @RequestMapping("/valueSet/ajaxGetPagedValueSets/pageNumber/{pageNumber}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> getAllConceptCodes(
			@PathVariable("pageNumber") String pageNumber); @RequestMapping(value = "valueSetAdd.html", method = RequestMethod.GET) String valueSetAddForm(Model model, HttpServletRequest request); @RequestMapping(value = "/valueSet/create", method = RequestMethod.POST) String submitCreateValueSetForm(
			@Valid @ModelAttribute(MODEL_ATTIRUTE_VALUESETDTO) ValueSetDto created,
			RedirectAttributes redirectAttribute, Model model); @RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) @ResponseBody String delete(@PathVariable("id") Long id,
			RedirectAttributes redirectAttribute); @RequestMapping(value = "/valueSet/edit/{id}", method = RequestMethod.GET) String showEditValueSetForm(@PathVariable("id") Long id,
			Model model, RedirectAttributes attributes); @RequestMapping(value = "/valueSet/edit/{id}", method = RequestMethod.POST) String submitEditValueSetForm(
			@ModelAttribute(MODEL_ATTIRUTE_VALUESETDTO) ValueSetDto updated,
			RedirectAttributes attributes, @PathVariable("id") Long id); @RequestMapping(value = "/valueSet/batchUpload", method = RequestMethod.POST) String batchUpload(HttpServletRequest request,
			@RequestParam("batch_file") MultipartFile file,
			RedirectAttributes redirectAttribute); @RequestMapping("/valueSet/ajaxSearchValueSet/pageNumber/{pageNumber}/searchCategory/{searchCategory}/searchTerm/{searchTerm}/valueSetCategory/{valueSetCategory}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> searchValueSet(
			@PathVariable("searchCategory") String searchCategory,
			@PathVariable("searchTerm") String searchTerm,
			@PathVariable("valueSetCategory") String valueSetCategory,
			@PathVariable("pageNumber") String pageNumber); }
ValueSetController extends AbstractNodeController { @RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) public @ResponseBody String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttribute) { LOGGER.debug("Deleting valueSet with id: " + id); ValueSetDto deleted = new ValueSetDto(); try { deleted = valueSetService.delete(id); deleted.setError(false); deleted.setSuccessMessage("ValueSet with Code: " + deleted.getCode() + " and Name: " + deleted.getName() + " is deleted Successfully."); } catch (ValueSetNotFoundException e) { LOGGER.debug(e.getMessage()); deleted.setError(true); deleted.setErrorMessage(e.getMessage()); throw new AjaxException(HttpStatus.INTERNAL_SERVER_ERROR, e.getMessage()); } redirectAttribute .addFlashAttribute(MODEL_ATTIRUTE_VALUESETDTO, 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 showCreateValueSetForm(
			Model model,
			@RequestParam(value = "panelState", required = false, defaultValue = "") String panelState); @RequestMapping("/valueSet/ajaxGetPagedValueSets/pageNumber/{pageNumber}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> getAllConceptCodes(
			@PathVariable("pageNumber") String pageNumber); @RequestMapping(value = "valueSetAdd.html", method = RequestMethod.GET) String valueSetAddForm(Model model, HttpServletRequest request); @RequestMapping(value = "/valueSet/create", method = RequestMethod.POST) String submitCreateValueSetForm(
			@Valid @ModelAttribute(MODEL_ATTIRUTE_VALUESETDTO) ValueSetDto created,
			RedirectAttributes redirectAttribute, Model model); @RequestMapping(value = "/valueSet/delete/{id}", method = RequestMethod.DELETE) @ResponseBody String delete(@PathVariable("id") Long id,
			RedirectAttributes redirectAttribute); @RequestMapping(value = "/valueSet/edit/{id}", method = RequestMethod.GET) String showEditValueSetForm(@PathVariable("id") Long id,
			Model model, RedirectAttributes attributes); @RequestMapping(value = "/valueSet/edit/{id}", method = RequestMethod.POST) String submitEditValueSetForm(
			@ModelAttribute(MODEL_ATTIRUTE_VALUESETDTO) ValueSetDto updated,
			RedirectAttributes attributes, @PathVariable("id") Long id); @RequestMapping(value = "/valueSet/batchUpload", method = RequestMethod.POST) String batchUpload(HttpServletRequest request,
			@RequestParam("batch_file") MultipartFile file,
			RedirectAttributes redirectAttribute); @RequestMapping("/valueSet/ajaxSearchValueSet/pageNumber/{pageNumber}/searchCategory/{searchCategory}/searchTerm/{searchTerm}/valueSetCategory/{valueSetCategory}") @ResponseStatus(HttpStatus.OK) @ResponseBody Map<String, Object> searchValueSet(
			@PathVariable("searchCategory") String searchCategory,
			@PathVariable("searchTerm") String searchTerm,
			@PathVariable("valueSetCategory") String valueSetCategory,
			@PathVariable("pageNumber") String pageNumber);  }