Fixing embeddedlist creation

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@146941 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-04-18 14:10:01 +00:00
parent 7abfbacaa3
commit 77f241016b
1 changed files with 24 additions and 3 deletions

View File

@ -757,9 +757,18 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
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<ERType extends ER, El extends Element> {
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){