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:
parent
965954622f
commit
d06dea6f73
|
@ -5,18 +5,18 @@ package org.gcube.informationsystem.resourceregistry.er;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import javax.activation.UnsupportedDataTypeException;
|
||||||
|
|
||||||
import org.codehaus.jettison.json.JSONArray;
|
import org.codehaus.jettison.json.JSONArray;
|
||||||
import org.codehaus.jettison.json.JSONObject;
|
import org.codehaus.jettison.json.JSONObject;
|
||||||
import org.gcube.informationsystem.model.AccessType;
|
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)
|
public static Object getObjectFromElement(JsonNode value)
|
||||||
throws ResourceRegistryException {
|
throws UnsupportedDataTypeException, ResourceRegistryException{
|
||||||
JsonNodeType jsonNodeType = value.getNodeType();
|
JsonNodeType jsonNodeType = value.getNodeType();
|
||||||
|
|
||||||
switch (jsonNodeType) {
|
switch (jsonNodeType) {
|
||||||
|
@ -686,6 +686,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
||||||
return EmbeddedMangement.getEmbeddedType(value);
|
return EmbeddedMangement.getEmbeddedType(value);
|
||||||
|
|
||||||
case ARRAY:
|
case ARRAY:
|
||||||
|
/*
|
||||||
List<Object> list = new ArrayList<Object>();
|
List<Object> list = new ArrayList<Object>();
|
||||||
Iterator<JsonNode> arrayElement = value.elements();
|
Iterator<JsonNode> arrayElement = value.elements();
|
||||||
while (arrayElement.hasNext()) {
|
while (arrayElement.hasNext()) {
|
||||||
|
@ -696,6 +697,8 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
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:
|
case BINARY:
|
||||||
break;
|
break;
|
||||||
|
@ -818,6 +821,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
if(object instanceof Set){
|
if(object instanceof Set){
|
||||||
((OrientElement) element).setProperty(key, object, OType.EMBEDDEDSET);
|
((OrientElement) element).setProperty(key, object, OType.EMBEDDEDSET);
|
||||||
set = true;
|
set = true;
|
||||||
|
@ -827,6 +831,7 @@ public abstract class ERManagement<ERType extends ER, El extends Element> {
|
||||||
((OrientElement) element).setProperty(key, object, OType.EMBEDDEDLIST);
|
((OrientElement) element).setProperty(key, object, OType.EMBEDDEDLIST);
|
||||||
set = true;
|
set = true;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if(!set){
|
if(!set){
|
||||||
element.setProperty(key, object);
|
element.setProperty(key, object);
|
||||||
|
|
|
@ -8,6 +8,8 @@ import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import javax.activation.UnsupportedDataTypeException;
|
||||||
|
|
||||||
import org.gcube.informationsystem.model.AccessType;
|
import org.gcube.informationsystem.model.AccessType;
|
||||||
import org.gcube.informationsystem.model.embedded.Embedded;
|
import org.gcube.informationsystem.model.embedded.Embedded;
|
||||||
import org.gcube.informationsystem.model.entity.Entity;
|
import org.gcube.informationsystem.model.entity.Entity;
|
||||||
|
@ -223,7 +225,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
oClass.setAbstract(typeDefinition.isAbstract());
|
oClass.setAbstract(typeDefinition.isAbstract());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error(
|
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());
|
typeDefinition.getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,8 +243,18 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (Property property : typeDefinition.getProperties()) {
|
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());
|
op.setDescription(property.getDescription());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -258,6 +270,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
|
|
||||||
op.setReadonly(property.isReadonly());
|
op.setReadonly(property.isReadonly());
|
||||||
op.setRegexp(property.getRegexp());
|
op.setRegexp(property.getRegexp());
|
||||||
|
|
||||||
if (property.getLinkedClass() != null) {
|
if (property.getLinkedClass() != null) {
|
||||||
OClass linkedClass = getOClass(oSchema,
|
OClass linkedClass = getOClass(oSchema,
|
||||||
property.getLinkedClass());
|
property.getLinkedClass());
|
||||||
|
|
Loading…
Reference in New Issue