From d8943fa68e3e433fa1142066145f6d9bc23ed8e1 Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Thu, 1 Dec 2016 17:14:14 +0000 Subject: [PATCH] Added facet creation even with a provided header git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@135182 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../resources/impl/EntityManagementImpl.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java index f91276b..8ce078f 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/EntityManagementImpl.java @@ -516,8 +516,18 @@ public class EntityManagementImpl implements EntityManagement { UUID targetUUID = targetHeader.getUUID(); String entityType = getClassProperty(target); - targetVertex = getEntity(orientGraph, targetUUID, entityType, + try { + targetVertex = getEntity(orientGraph, targetUUID, entityType, targetClass); + }catch(FacetNotFoundException e){ + /* Facet does not exist. Going to create it */ + targetVertex = createVertexEntity(orientGraph, + getClassProperty(target), Facet.class, + target.toString()); + + } catch (ResourceRegistryException e) { + throw e; + } } return targetVertex;