From 77f241016b33faf488b7702deeaf0120d179b36a Mon Sep 17 00:00:00 2001 From: "luca.frosini" Date: Tue, 18 Apr 2017 14:10:01 +0000 Subject: [PATCH] Fixing embeddedlist creation git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146941 82a268e6-3cf1-43bd-a215-b396298e98cf --- .../resourceregistry/er/ERManagement.java | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java index d3f8cdd..bccae4a 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java @@ -757,9 +757,18 @@ public abstract class ERManagement { try { Object object = properties.get(key); - if(!oClass.existsProperty(key) && object instanceof ODocument){ - ODocument oDocument = (ODocument) object; - ((OrientElement) element).setProperty(key, oDocument, OType.EMBEDDED); + if(!oClass.existsProperty(key)){ + + if(object instanceof ODocument){ + ODocument oDocument = (ODocument) object; + ((OrientElement) element).setProperty(key, oDocument, OType.EMBEDDED); + } + + if(object instanceof ArrayList){ + ((OrientElement) element).setProperty(key, object, OType.EMBEDDEDLIST); + } + + } else{ element.setProperty(key, object); } @@ -850,6 +859,18 @@ public abstract class ERManagement { return jsonArray; } + if(object instanceof ArrayList){ + @SuppressWarnings("rawtypes") + ArrayList arrayList = (ArrayList) object; + JSONArray jsonArray = new JSONArray(); + for(Object o : arrayList){ + Object obj = getPropertyForJson("PLACEHOLDER", o); + jsonArray.put(obj); + } + + return jsonArray; + } + return object.toString(); }catch(Exception e){