@Test public void retireDrugGroup_shouldRetireADrugGroup() throws Exception { DrugGroup dg1 = service.getDrugGroupByUuid(getUuid()); Assert.assertFalse(dg1.isRetired()); controller.retireDrugGroup(getUuid(), "testing", request, response); DrugGroup dg2 = service.getDrugGroupByUuid(getUuid()); Assert.assertTrue(dg2.isRetired()); Assert.assertEquals("testing", dg2.getRetireReason()); }
@RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody public Object retireDrugGroup(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugGroupController(); DrugGroup drugGroup = service.getDrugGroupByUuid(uuid); if (drugGroup != null) { drugGroup.setRetired(true); drugGroup.setRetireReason(reason); drugGroup.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugGroup(drugGroup); } return RestUtil.noContent(response); }
DrugGroupController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody public Object retireDrugGroup(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugGroupController(); DrugGroup drugGroup = service.getDrugGroupByUuid(uuid); if (drugGroup != null) { drugGroup.setRetired(true); drugGroup.setRetireReason(reason); drugGroup.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugGroup(drugGroup); } return RestUtil.noContent(response); } }
DrugGroupController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody public Object retireDrugGroup(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugGroupController(); DrugGroup drugGroup = service.getDrugGroupByUuid(uuid); if (drugGroup != null) { drugGroup.setRetired(true); drugGroup.setRetireReason(reason); drugGroup.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugGroup(drugGroup); } return RestUtil.noContent(response); }  }
DrugGroupController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody public Object retireDrugGroup(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugGroupController(); DrugGroup drugGroup = service.getDrugGroupByUuid(uuid); if (drugGroup != null) { drugGroup.setRetired(true); drugGroup.setRetireReason(reason); drugGroup.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugGroup(drugGroup); } return RestUtil.noContent(response); }  void initDrugGroupController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New DrugGroup") @ResponseBody Object createNewDrugGroup(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing drug group") @ResponseBody Object updateDrugGroup(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug Groups in the system") @ResponseBody() String getAllDrugGroups(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "q") @WSDoc("Gets Drug Groups by name") @ResponseBody() String getDrugGroupsByName(@RequestParam("q") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Drug Groups for the uuid path") @ResponseBody() String getAllDrugGroupByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Drug Groups for the uuid path") @ResponseBody() String getAllDrugGroupByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody Object retireDrugGroup(@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 purgeDrugGroup(@PathVariable("uuid") String uuid, HttpServletRequest request, HttpServletResponse response); }
DrugGroupController extends BaseRestController { @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody public Object retireDrugGroup(@PathVariable("uuid") String uuid, @RequestParam(value = "reason", defaultValue = "web service call") String reason, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initDrugGroupController(); DrugGroup drugGroup = service.getDrugGroupByUuid(uuid); if (drugGroup != null) { drugGroup.setRetired(true); drugGroup.setRetireReason(reason); drugGroup.setRetiredBy(Context.getAuthenticatedUser()); service.updateDrugGroup(drugGroup); } return RestUtil.noContent(response); }  void initDrugGroupController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New DrugGroup") @ResponseBody Object createNewDrugGroup(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing drug group") @ResponseBody Object updateDrugGroup(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Drug Groups in the system") @ResponseBody() String getAllDrugGroups(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "q") @WSDoc("Gets Drug Groups by name") @ResponseBody() String getDrugGroupsByName(@RequestParam("q") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Drug Groups for the uuid path") @ResponseBody() String getAllDrugGroupByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Drug Groups for the uuid path") @ResponseBody() String getAllDrugGroupByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Drug Group") @ResponseBody Object retireDrugGroup(@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 purgeDrugGroup(@PathVariable("uuid") String uuid, HttpServletRequest request, HttpServletResponse response);  }