Added Source Resource in relation including only header. this reflect the behaviour set on jackson marshalling

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@148278 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-05-03 15:50:55 +00:00
parent 08db977881
commit b8d082399c
1 changed files with 9 additions and 3 deletions

View File

@ -101,12 +101,18 @@ public abstract class RelationManagement<R extends Relation> extends
public JSONObject serializeAsJson() throws ResourceRegistryException { public JSONObject serializeAsJson() throws ResourceRegistryException {
JSONObject relation = serializeSelfOnly(); JSONObject relation = serializeSelfOnly();
Vertex target = element.getVertex(Direction.IN);
try { try {
EntityManagement entityManagement = EntityManagement Vertex source = element.getVertex(Direction.OUT);
EntityManagement sourceEntityManagement = EntityManagement
.getEntityManagement(orientGraph, source);
relation.put(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelfOnly());
Vertex target = element.getVertex(Direction.IN);
EntityManagement targetEntityManagement = EntityManagement
.getEntityManagement(orientGraph, target); .getEntityManagement(orientGraph, target);
relation.put(Relation.TARGET_PROPERTY, relation.put(Relation.TARGET_PROPERTY,
entityManagement.serializeAsJson()); targetEntityManagement.serializeAsJson());
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {
logger.error("Unable to correctly serialize {}. This is really strange and should not occur.", element, e); logger.error("Unable to correctly serialize {}. This is really strange and should not occur.", element, e);
throw e; throw e;