@Test public void testGetRelationships() throws Exception { String allRelationships = controller.getAllRelationships(request, response); Assert.assertEquals(2, ((ArrayList) SimpleObject.parseJson(allRelationships).get("results")).size()); }
@RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() public String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request) throws ResponseException { initRelationshipController(); Person fromPerson = Context.getPersonService().getPersonByUuid(params.get("fromPerson")); Person toPerson = Context.getPersonService().getPersonByUuid(params.get("toPerson")); RelationshipType rType = Context.getPersonService().getRelationshipTypeByName(params.get("relationshipType")); List<Relationship> relationships = service.getRelationships(fromPerson, toPerson, rType); ArrayList results = new ArrayList(); for (Relationship relationship : relationships) { results.add(getRelationshipAsSimpleObject(relationship)); } return gson.toJson(new SimpleObject().add("results", results)); }
RaxaPatientAccessController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() public String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request) throws ResponseException { initRelationshipController(); Person fromPerson = Context.getPersonService().getPersonByUuid(params.get("fromPerson")); Person toPerson = Context.getPersonService().getPersonByUuid(params.get("toPerson")); RelationshipType rType = Context.getPersonService().getRelationshipTypeByName(params.get("relationshipType")); List<Relationship> relationships = service.getRelationships(fromPerson, toPerson, rType); ArrayList results = new ArrayList(); for (Relationship relationship : relationships) { results.add(getRelationshipAsSimpleObject(relationship)); } return gson.toJson(new SimpleObject().add("results", results)); } }
RaxaPatientAccessController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() public String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request) throws ResponseException { initRelationshipController(); Person fromPerson = Context.getPersonService().getPersonByUuid(params.get("fromPerson")); Person toPerson = Context.getPersonService().getPersonByUuid(params.get("toPerson")); RelationshipType rType = Context.getPersonService().getRelationshipTypeByName(params.get("relationshipType")); List<Relationship> relationships = service.getRelationships(fromPerson, toPerson, rType); ArrayList results = new ArrayList(); for (Relationship relationship : relationships) { results.add(getRelationshipAsSimpleObject(relationship)); } return gson.toJson(new SimpleObject().add("results", results)); }  }
RaxaPatientAccessController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() public String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request) throws ResponseException { initRelationshipController(); Person fromPerson = Context.getPersonService().getPersonByUuid(params.get("fromPerson")); Person toPerson = Context.getPersonService().getPersonByUuid(params.get("toPerson")); RelationshipType rType = Context.getPersonService().getRelationshipTypeByName(params.get("relationshipType")); List<Relationship> relationships = service.getRelationships(fromPerson, toPerson, rType); ArrayList results = new ArrayList(); for (Relationship relationship : relationships) { results.add(getRelationshipAsSimpleObject(relationship)); } return gson.toJson(new SimpleObject().add("results", results)); }  void initRelationshipController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New Relationship") @ResponseBody Object createNewRelationship(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Relationship for the uuid path") @ResponseBody() String getRelationshipByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Relationships in the system") @ResponseBody() String getAllRelationships(HttpServletRequest request, HttpServletResponse response); }
RaxaPatientAccessController extends BaseRestController { @RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() public String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request) throws ResponseException { initRelationshipController(); Person fromPerson = Context.getPersonService().getPersonByUuid(params.get("fromPerson")); Person toPerson = Context.getPersonService().getPersonByUuid(params.get("toPerson")); RelationshipType rType = Context.getPersonService().getRelationshipTypeByName(params.get("relationshipType")); List<Relationship> relationships = service.getRelationships(fromPerson, toPerson, rType); ArrayList results = new ArrayList(); for (Relationship relationship : relationships) { results.add(getRelationshipAsSimpleObject(relationship)); } return gson.toJson(new SimpleObject().add("results", results)); }  void initRelationshipController(); @RequestMapping(method = RequestMethod.POST) @WSDoc("Save New Relationship") @ResponseBody Object createNewRelationship(@RequestBody SimpleObject post, HttpServletRequest request,
	        HttpServletResponse response); @RequestMapping(method = RequestMethod.GET, params = "fromPerson") @WSDoc("Gets Full representation of Relationships for the given parameters") @ResponseBody() String getRelationships(@RequestParam Map<String, String> params, HttpServletRequest request); @RequestMapping(value = "/{uuid}", method = RequestMethod.GET) @WSDoc("Gets Relationship for the uuid path") @ResponseBody() String getRelationshipByUuid(@PathVariable("uuid") String uuid, HttpServletRequest request); @RequestMapping(method = RequestMethod.GET) @WSDoc("Get All Unretired Relationships in the system") @ResponseBody() String getAllRelationships(HttpServletRequest request, HttpServletResponse response);  }