/** * @see org.openmrs.api.PersonService#getRelationshipsByPerson(org.openmrs.Person) */ @Override @Transactional(readOnly = true) public List<Relationship> getRelationshipsByPerson(Person p) throws APIException { // search both the left side and the right side of the relationship // for this person List<Relationship> rels = Context.getPersonService().getRelationships(p, null, null); rels.addAll(Context.getPersonService().getRelationships(null, p, null)); return rels; }
/** * @see org.openmrs.api.PersonService#getRelationshipsByPerson(org.openmrs.Person, * java.util.Date) */ @Override @Transactional(readOnly = true) public List<Relationship> getRelationshipsByPerson(Person p, Date effectiveDate) throws APIException { // search both the left side and the right side of the relationship // for this person List<Relationship> rels = Context.getPersonService().getRelationships(p, null, null, effectiveDate); rels.addAll(Context.getPersonService().getRelationships(null, p, null, effectiveDate)); return rels; }
List<Relationship> relationships = Context.getPersonService().getRelationships(null, null, relType);
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date,Date) */ @Test public void getRelationships3_shouldFetchRelationshipsMatchingTheGivenToPerson() throws Exception { PersonService personService = Context.getPersonService(); Person secondPerson = personService.getPerson(7); List<Relationship> relationships = personService.getRelationships(null, secondPerson, null, new Date(), new Date()); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the to person", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date,Date) */ @Test public void getRelationships3_shouldFetchRelationshipsMatchingTheGivenFromPerson() throws Exception { PersonService personService = Context.getPersonService(); Person firstPerson = personService.getPerson(502); List<Relationship> relationships = personService.getRelationships(firstPerson, null, null, new Date(), new Date()); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the from person", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date,Date) */ @Test public void getRelationships3_shouldFetchRelationshipsMatchingTheGivenRelType() throws Exception { PersonService personService = Context.getPersonService(); RelationshipType relationshipType = personService.getRelationshipType(1); List<Relationship> relationships = personService.getRelationships(null, null, relationshipType, new Date(), new Date()); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the relationship type", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date) */ @Test public void getRelationships2_shouldFetchRelationshipsMatchingTheGivenFromPerson() throws Exception { PersonService personService = Context.getPersonService(); Person firstPerson = personService.getPerson(502); List<Relationship> relationships = personService.getRelationships(firstPerson, null, null, new Date()); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the from person", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date) */ @Test public void getRelationships2_shouldFetchRelationshipsMatchingTheGivenToPerson() throws Exception { PersonService personService = Context.getPersonService(); Person secondPerson = personService.getPerson(7); List<Relationship> relationships = personService.getRelationships(null, secondPerson, null, new Date()); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the to person", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date) */ @Test public void getRelationships2_shouldFetchRelationshipsMatchingTheGivenRelType() throws Exception { PersonService personService = Context.getPersonService(); RelationshipType relationshipType = personService.getRelationshipType(1); List<Relationship> relationships = personService.getRelationships(null, null, relationshipType, new Date()); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the relationship type", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType) */ @Test public void getRelationships_shouldFetchRelationshipsMatchingTheGivenRelType() throws Exception { PersonService personService = Context.getPersonService(); RelationshipType relationshipType = personService.getRelationshipType(1); List<Relationship> relationships = personService.getRelationships(null, null, relationshipType); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the relationship type", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType) */ @Test public void getRelationships_shouldFetchRelationshipsMatchingTheGivenFromPerson() throws Exception { PersonService personService = Context.getPersonService(); Person firstPerson = personService.getPerson(502); List<Relationship> relationships = personService.getRelationships(firstPerson, null, null); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the from person", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType) */ @Test public void getRelationships_shouldFetchRelationshipsMatchingTheGivenToPerson() throws Exception { PersonService personService = Context.getPersonService(); Person secondPerson = personService.getPerson(7); List<Relationship> relationships = personService.getRelationships(null, secondPerson, null); Assert.assertNotNull(relationships); assertTrue("There should be relationship found given the to person", relationships.size() > 0); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date,Date) */ @Test public void getRelationships3_shouldReturnEmptyListWhenNoRelationshipMatchingGivenParametersExist() throws Exception { PersonService personService = Context.getPersonService(); Person firstPerson = personService.getPerson(501); Person secondPerson = personService.getPerson(2); RelationshipType relationshipType = personService.getRelationshipType(1); List<Relationship> relationships = personService.getRelationships(firstPerson, secondPerson, relationshipType, new Date(), new Date()); Assert.assertNotNull(relationships); assertTrue("There should be no relationship found given the from person", relationships.isEmpty()); }
/** * @see PersonService#getRelationships(Person,Person,RelationshipType,Date) */ @Test public void getRelationships2_shouldReturnEmptyListWhenNoRelationshipMatchingGivenParametersExist() throws Exception { PersonService personService = Context.getPersonService(); Person firstPerson = personService.getPerson(501); Person secondPerson = personService.getPerson(2); RelationshipType relationshipType = personService.getRelationshipType(1); List<Relationship> relationships = personService.getRelationships(firstPerson, secondPerson, relationshipType, new Date()); Assert.assertNotNull(relationships); assertTrue("There should be no relationship found given the from person", relationships.isEmpty()); }
List<Relationship> rels = personService.getRelationships(new Person(7), preferred, new RelationshipType(4)); assertEquals("7->999 (type 4) was removed", 1, rels.size()); rels = personService.getRelationships(new Person(7), preferred, new RelationshipType(1)); assertEquals("7->999 (type 1) was removed", 1, rels.size());
List<Relationship> res = personService.getRelationships(ps.getPatient(2), patient, null, df.parse("1988-01-01"));
List<Relationship> rels = personService.getRelationships(preferred, new Person(1), new RelationshipType(2)); assertEquals("duplicate relationships were not removed", 1, rels.size());
List<Relationship> rels = personService.getRelationships(relative, patient, new RelationshipType(3)); Assert.assertTrue("new relationship was not created", !rels.isEmpty() && rels.size() == 1);
Assert.assertEquals(1, personService.getRelationships(relative, patient, new RelationshipType(3)).size()); List<Relationship> rels = personService.getRelationships(relative, patient, new RelationshipType(3)); Assert.assertTrue("existing relationship was not retained", !rels.isEmpty() && rels.size() == 1);
List<Relationship> rels = personService.getRelationships(relative, patient, new RelationshipType(3)); Assert.assertTrue("new relationship was not created", !rels.isEmpty() && rels.size() == 1);