/** * @see org.openmrs.api.PersonService#unvoidRelationship(org.openmrs.Relationship) */ @Override public Relationship unvoidRelationship(Relationship relationship) throws APIException { relationship.setVoided(false); relationship.setVoidedBy(null); relationship.setDateVoided(null); relationship.setVoidReason(null); return Context.getPersonService().saveRelationship(relationship); }
/** * @see org.openmrs.api.PersonService#voidRelationship(org.openmrs.Relationship, * java.lang.String) */ @Override public Relationship voidRelationship(Relationship relationship, String voidReason) throws APIException { if (relationship.getVoided()) { return relationship; } relationship.setVoided(true); if (relationship.getVoidedBy() == null) { relationship.setVoidedBy(Context.getAuthenticatedUser()); } if (voidReason != null) { relationship.setVoidReason(voidReason); } relationship.setDateVoided(new Date()); return Context.getPersonService().saveRelationship(relationship); }
/** * 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; }