Removed List and Set support as workaround fo OrientDB bug refs #9021

git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@150606 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Luca Frosini 2017-06-28 14:29:01 +00:00
parent 965954622f
commit d06dea6f73
2 changed files with 24 additions and 6 deletions

View File

@ -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<ERType extends ER, El extends Element> {
}
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<ERType extends ER, El extends Element> {
return EmbeddedMangement.getEmbeddedType(value);
case ARRAY:
/*
List<Object> list = new ArrayList<Object>();
Iterator<JsonNode> arrayElement = value.elements();
while (arrayElement.hasNext()) {
@ -696,6 +697,8 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
}
}
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<ERType extends ER, El extends Element> {
set = true;
}
/*
if(object instanceof Set){
((OrientElement) element).setProperty(key, object, OType.EMBEDDEDSET);
set = true;
@ -827,6 +831,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
((OrientElement) element).setProperty(key, object, OType.EMBEDDEDLIST);
set = true;
}
*/
if(!set){
element.setProperty(key, object);

View File

@ -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());