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 80ccd06..8ad2923 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/er/ERManagement.java @@ -5,18 +5,18 @@ package org.gcube.informationsystem.resourceregistry.er; import java.io.IOException; import java.text.DateFormat; -import java.util.ArrayList; import java.util.Collection; import java.util.Date; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; -import java.util.List; import java.util.Map; import java.util.Map.Entry; import java.util.Set; import java.util.UUID; +import javax.activation.UnsupportedDataTypeException; + import org.codehaus.jettison.json.JSONArray; import org.codehaus.jettison.json.JSONObject; import org.gcube.informationsystem.model.AccessType; @@ -678,7 +678,7 @@ public abstract class ERManagement { } public static Object getObjectFromElement(JsonNode value) - throws ResourceRegistryException { + throws UnsupportedDataTypeException, ResourceRegistryException{ JsonNodeType jsonNodeType = value.getNodeType(); switch (jsonNodeType) { @@ -686,6 +686,7 @@ public abstract class ERManagement { return EmbeddedMangement.getEmbeddedType(value); case ARRAY: + /* List list = new ArrayList(); Iterator arrayElement = value.elements(); while (arrayElement.hasNext()) { @@ -696,6 +697,8 @@ public abstract class ERManagement { } } return list; + */ + throw new UnsupportedDataTypeException("List/Set support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354"); case BINARY: break; @@ -818,6 +821,7 @@ public abstract class ERManagement { set = true; } + /* if(object instanceof Set){ ((OrientElement) element).setProperty(key, object, OType.EMBEDDEDSET); set = true; @@ -827,6 +831,7 @@ public abstract class ERManagement { ((OrientElement) element).setProperty(key, object, OType.EMBEDDEDLIST); set = true; } + */ if(!set){ element.setProperty(key, object); diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java index b53b328..eed5c31 100644 --- a/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java +++ b/src/main/java/org/gcube/informationsystem/resourceregistry/schema/SchemaManagementImpl.java @@ -8,6 +8,8 @@ import java.util.Collection; import java.util.List; import java.util.Set; +import javax.activation.UnsupportedDataTypeException; + import org.gcube.informationsystem.model.AccessType; import org.gcube.informationsystem.model.embedded.Embedded; import org.gcube.informationsystem.model.entity.Entity; @@ -223,7 +225,7 @@ public class SchemaManagementImpl implements SchemaManagement { oClass.setAbstract(typeDefinition.isAbstract()); } catch (Exception e) { logger.error( - "Unable to set the Vertex Type {} as abstract. This is an OrientDB <= 2.2.12 bug. The Type will be created as it is not abstarct.", + "Unable to set the Vertex Type {} as abstract. This is an OrientDB <= 2.2.12 bug. The Type will be created as it is not abstract.", typeDefinition.getName()); } @@ -241,8 +243,18 @@ public class SchemaManagementImpl implements SchemaManagement { } } else { for (Property property : typeDefinition.getProperties()) { - OProperty op = oClass.createProperty(property.getName(), - OType.getById(property.getType().byteValue())); + + OType oType = OType.getById(property.getType().byteValue()); + switch (oType) { + case EMBEDDEDLIST: + throw new UnsupportedDataTypeException(oType.name() + " support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354"); + case EMBEDDEDSET: + throw new UnsupportedDataTypeException(oType.name() + " support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354"); + default: + break; + } + + OProperty op = oClass.createProperty(property.getName(), oType); op.setDescription(property.getDescription()); /* @@ -258,6 +270,7 @@ public class SchemaManagementImpl implements SchemaManagement { op.setReadonly(property.isReadonly()); op.setRegexp(property.getRegexp()); + if (property.getLinkedClass() != null) { OClass linkedClass = getOClass(oSchema, property.getLinkedClass());