@Test public void testRetireDrugInfo() throws Exception { DrugInfo di1 = service.getDrugInfoByUuid(getUuid()); Assert.assertFalse(di1.isRetired()); controller.retireDrugInfo(getUuid(), "testing", request, response); DrugInfo di2 = service.getDrugInfoByUuid(getUuid()); Assert.assertTrue(di2.isRetired()); Assert.assertEquals("testing", di2.getRetireReason()); }
@RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody public Object retireDrugInfo(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugInfoController(); DrugInfo drugInfo = service.getDrugInfoByUuid(uuid); if (drugInfo != null) { drugInfo.setRetired(true); drugInfo.setRetireReason(reason); drugInfo.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugInfo(drugInfo); } return RestUtil.noContent(response); }
DrugInfoController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody public Object retireDrugInfo(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugInfoController(); DrugInfo drugInfo = service.getDrugInfoByUuid(uuid); if (drugInfo != null) { drugInfo.setRetired(true); drugInfo.setRetireReason(reason); drugInfo.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugInfo(drugInfo); } return RestUtil.noContent(response); } }
DrugInfoController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody public Object retireDrugInfo(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugInfoController(); DrugInfo drugInfo = service.getDrugInfoByUuid(uuid); if (drugInfo != null) { drugInfo.setRetired(true); drugInfo.setRetireReason(reason); drugInfo.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugInfo(drugInfo); } return RestUtil.noContent(response); }  }
DrugInfoController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody public Object retireDrugInfo(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugInfoController(); DrugInfo drugInfo = service.getDrugInfoByUuid(uuid); if (drugInfo != null) { drugInfo.setRetired(true); drugInfo.setRetireReason(reason); drugInfo.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugInfo(drugInfo); } return RestUtil.noContent(response); }  void initDrugInfoController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New DrugInfo") @ResponseBody Object createNewDrugInfo(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing drug info") @ResponseBody Object updateDrugInfo(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unvoided Drug Info in the system") @ResponseBody() String getAllDrugInfo(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Drug Info for the uuid path") @ResponseBody() String getAllDrugInfoByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Drug Info for the uuid path") @ResponseBody() String getAllDrugInfoByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(method = RequestMethod.GET, params = "drugname") @WSDoc("Gets drug info by drug name") @ResponseBody() String getDrugInfosByName(@RequestParam("drugname") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody Object retireDrugInfo(@PathVariable("uuid") String uuid,
	        @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "purge") @ResponseBody Object purgeDrugInfo(@PathVariable("uuid") String uuid, HttpServletRequest request, HttpServletResponse response); }
DrugInfoController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody public Object retireDrugInfo(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugInfoController(); DrugInfo drugInfo = service.getDrugInfoByUuid(uuid); if (drugInfo != null) { drugInfo.setRetired(true); drugInfo.setRetireReason(reason); drugInfo.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugInfo(drugInfo); } return RestUtil.noContent(response); }  void initDrugInfoController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New DrugInfo") @ResponseBody Object createNewDrugInfo(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing drug info") @ResponseBody Object updateDrugInfo(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unvoided Drug Info in the system") @ResponseBody() String getAllDrugInfo(HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Drug Info for the uuid path") @ResponseBody() String getAllDrugInfoByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Drug Info for the uuid path") @ResponseBody() String getAllDrugInfoByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(method = RequestMethod.GET, params = "drugname") @WSDoc("Gets drug info by drug name") @ResponseBody() String getDrugInfosByName(@RequestParam("drugname") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Info") @ResponseBody Object retireDrugInfo(@PathVariable("uuid") String uuid,
	        @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "purge") @ResponseBody Object purgeDrugInfo(@PathVariable("uuid") String uuid, HttpServletRequest request, HttpServletResponse response);  }