* Creates an relationship based on fields in the post object
* @param post
* @return
*/
private Relationship createRelationshipFromPost(SimpleObject post) throws ResponseException {
Relationship relationship = new Relationship();
Person a, b;
try {
Method method = service.getClass().getMethod("getPersonByUuidSafeSearch", String.class);
a = (Person) method.invoke(service, post.get("fromPerson").toString());
b = (Person) method.invoke(service, post.get("toPerson").toString());
}
catch (Exception e) {
a = Context.getPersonService().getPersonByUuid(post.get("fromPerson").toString());
b = Context.getPersonService().getPersonByUuid(post.get("toPerson").toString());
}
relationship.setPersonA(a);
relationship.setPersonB(b);
relationship.setRelationshipType(Context.getPersonService().getRelationshipTypeByName(
post.get("relationshipType").toString()));
return relationship;
}