@Test public void createNewPatientList_shouldSaveANewPatientList() throws Exception { int before = service.getAllPatientList(false).size(); String json = "{ \"name\":\"Test PatientList\",\"description\":\"Test List of Patients\"}"; SimpleObject post = new ObjectMapper().readValue(json, SimpleObject.class); Object patientList = controller.createNewPatientList(post, request, response); Assert.assertEquals(before + 1, service.getAllPatientList(false).size()); }
@RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody public Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initPatientListController(); PatientList patientList = new PatientList(); patientList.setName(post.get("name").toString()); patientList.setDescription(post.get("description").toString()); if (post.get("searchQuery") != null) { patientList.setSearchQuery(post.get("searchQuery").toString()); } PatientList created = service.savePatientList(patientList); SimpleObject obj = new SimpleObject(); obj.add("uuid", created.getUuid()); obj.add("name", created.getName()); obj.add("description", created.getDescription()); return RestUtil.created(response, obj); }
PatientListController extends BaseRestController { @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody public Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initPatientListController(); PatientList patientList = new PatientList(); patientList.setName(post.get("name").toString()); patientList.setDescription(post.get("description").toString()); if (post.get("searchQuery") != null) { patientList.setSearchQuery(post.get("searchQuery").toString()); } PatientList created = service.savePatientList(patientList); SimpleObject obj = new SimpleObject(); obj.add("uuid", created.getUuid()); obj.add("name", created.getName()); obj.add("description", created.getDescription()); return RestUtil.created(response, obj); } }
PatientListController extends BaseRestController { @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody public Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initPatientListController(); PatientList patientList = new PatientList(); patientList.setName(post.get("name").toString()); patientList.setDescription(post.get("description").toString()); if (post.get("searchQuery") != null) { patientList.setSearchQuery(post.get("searchQuery").toString()); } PatientList created = service.savePatientList(patientList); SimpleObject obj = new SimpleObject(); obj.add("uuid", created.getUuid()); obj.add("name", created.getName()); obj.add("description", created.getDescription()); return RestUtil.created(response, obj); }  }
PatientListController extends BaseRestController { @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody public Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initPatientListController(); PatientList patientList = new PatientList(); patientList.setName(post.get("name").toString()); patientList.setDescription(post.get("description").toString()); if (post.get("searchQuery") != null) { patientList.setSearchQuery(post.get("searchQuery").toString()); } PatientList created = service.savePatientList(patientList); SimpleObject obj = new SimpleObject(); obj.add("uuid", created.getUuid()); obj.add("name", created.getName()); obj.add("description", created.getDescription()); return RestUtil.created(response, obj); }  void initPatientListController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing patient list") @ResponseBody Object updatePatientList(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Patient Lists in the system") @ResponseBody() String getAllPatientLists(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "q") @WSDoc("Gets Patient Lists by name") @ResponseBody() String getPatientListsByName(@RequestParam("q") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Patient Lists for the uuid path") @ResponseBody() String getAllPatientListByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Patient Lists for the uuid path") @ResponseBody() String getAllPatientListByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(method = RequestMethod.GET, params = "encounterType") @WSDoc("Gets Patients Without Saving the Patient list") @ResponseBody() String getPatientsInPatientList(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/optimized", method = RequestMethod.GET, params = "encounterType") @WSDoc("Gets Patients Without Saving the Patient list") @ResponseBody() String getPatientsInPatientListV2(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Patient List") @ResponseBody Object retirePatientList(@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 purgePatientList(@PathVariable("uuid") String uuid, HttpServletRequest request,
	        HttpServletResponse response); }
PatientListController extends BaseRestController { @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody public Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request, HttpServletResponse response) throws ResponseException { initPatientListController(); PatientList patientList = new PatientList(); patientList.setName(post.get("name").toString()); patientList.setDescription(post.get("description").toString()); if (post.get("searchQuery") != null) { patientList.setSearchQuery(post.get("searchQuery").toString()); } PatientList created = service.savePatientList(patientList); SimpleObject obj = new SimpleObject(); obj.add("uuid", created.getUuid()); obj.add("name", created.getName()); obj.add("description", created.getDescription()); return RestUtil.created(response, obj); }  void initPatientListController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New PatientList") @ResponseBody Object createNewPatientList(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(value = "/{uuid}", method = RequestMethod.POST) @WSDoc("Updates an existing patient list") @ResponseBody Object updatePatientList(@PathVariable("uuid") String uuid, @RequestBody SimpleObject post,
	        HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Patient Lists in the system") @ResponseBody() String getAllPatientLists(HttpServletRequest request, HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "q") @WSDoc("Gets Patient Lists by name") @ResponseBody() String getPatientListsByName(@RequestParam("q") String query, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Patient Lists for the uuid path") @ResponseBody() String getAllPatientListByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET, params = "v") @WSDoc("Gets Full representation of Patient Lists for the uuid path") @ResponseBody() String getAllPatientListByUuidFull(@PathVariable("uuid") String uuid, @RequestParam("v") String rep,
	        HttpServletRequest request); @RequestMapping(method = RequestMethod.GET, params = "encounterType") @WSDoc("Gets Patients Without Saving the Patient list") @ResponseBody() String getPatientsInPatientList(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/optimized", method = RequestMethod.GET, params = "encounterType") @WSDoc("Gets Patients Without Saving the Patient list") @ResponseBody() String getPatientsInPatientListV2(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.DELETE, params = "!purge") @WSDoc("Retires the Patient List") @ResponseBody Object retirePatientList(@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 purgePatientList(@PathVariable("uuid") String uuid, HttpServletRequest request,
	        HttpServletResponse response);  }