@Override public String toString() { String relType = getRelationshipType() == null ? "NULL" : getRelationshipType().getaIsToB(); return personA + " is the " + relType + " of " + personB; }
/** * generate a relationship hash for use in mergePatients; follows the convention: * [relationshipType][A|B][relativeId] * * @param rel relationship under consideration * @param primary the focus of the hash * @return hash depicting relevant information to avoid duplicates */ private String relationshipHash(Relationship rel, Person primary) { boolean isA = rel.getPersonA().equals(primary); return rel.getRelationshipType().getRelationshipTypeId().toString() + (isA ? "A" : "B") + (isA ? rel.getPersonB().getPersonId().toString() : rel.getPersonA().getPersonId().toString()); }
/** * The purpose of this method is to allow subclasses of Relationship to delegate a portion of * their copy() method back to the superclass, in case the base class implementation changes. * * @param target a Relationship that will have the state of <code>this</code> copied into it * @return the Relationship that was passed in, with state copied into it */ protected Relationship copyHelper(Relationship target) { target.personA = getPersonA(); target.relationshipType = getRelationshipType(); target.personB = getPersonB(); target.setCreator(getCreator()); target.setDateCreated(getDateCreated()); target.setVoided(getVoided()); target.setVoidedBy(getVoidedBy()); target.setDateVoided(getDateVoided()); target.setVoidReason(getVoidReason()); return target; }
/** * @see PersonService#saveRelationship(Relationship) */ @Test public void saveRelationship_shouldUpdateExistingObjectWhenRelationshipIdIsNotNull() throws Exception { PersonService personService = Context.getPersonService(); Relationship savedRelationship = personService.getRelationship(1); Assert.assertNotNull(savedRelationship.getRelationshipId()); savedRelationship.setRelationshipType(personService.getRelationshipType(2)); Relationship updatedRelationship = personService.saveRelationship(savedRelationship); Assert.assertEquals(personService.getRelationshipType(2), updatedRelationship.getRelationshipType()); }
/** * @param relationship * @return relationship type and start date */ @PropertyGetter("display") public String getDisplayString(Relationship relationship) { String relType = relationship.getRelationshipType() == null ? "NULL" : relationship.getRelationshipType() .getaIsToB(); return relationship.getPersonA().getGivenName() + " is the " + relType + " of " + relationship.getPersonB().getGivenName(); }
if(r.getRelationshipType().getId().equals(rt.getId()))
for (Relationship rel : rels) { if (rel.getPersonA().getPersonId().equals(patient.getPersonId())) { List<Person> list = relMap.get(rel.getRelationshipType().getbIsToA()); if (list == null) { list = new ArrayList<Person>(); relMap.put(rel.getRelationshipType().getbIsToA(), list); List<Person> list = relMap.get(rel.getRelationshipType().getaIsToB()); if (list == null) { list = new ArrayList<Person>(); relMap.put(rel.getRelationshipType().getaIsToB(), list);
@Test public void shouldEditARelationship() throws Exception { final String newRelationshipTypeUuid = "d47f056e-f147-49a3-88e1-0c91d199510d"; Relationship relationship = service.getRelationshipByUuid(RestTestConstants1_8.RELATIONSHIP_UUID); Assert.assertNotNull(relationship); //sanity checks Assert.assertFalse(newRelationshipTypeUuid.equalsIgnoreCase(relationship.getRelationshipType().getUuid())); String json = "{\"relationshipType\":\"" + newRelationshipTypeUuid + "\"" + "}"; handle(newPostRequest(getURI() + "/" + getUuid(), json)); Relationship updated = service.getRelationshipByUuid(RestTestConstants1_8.RELATIONSHIP_UUID); Assert.assertNotNull(updated); Assert.assertEquals(newRelationshipTypeUuid, updated.getRelationshipType().getUuid()); }
if (er.getRelationshipType().getId().equals(r.getId())) {
for (Relationship r : submissionActions.getRelationshipsToCreate()) { if (log.isDebugEnabled()) { log.debug("creating relationships" + r.getRelationshipType().getDescription());