diff --git a/pom.xml b/pom.xml
index 712436c..561befc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -87,13 +87,13 @@
com.orientechnologies
orientdb-graphdb
- 2.2.0
+ 2.2.12
com.tinkerpop
frames
- 2.5.0
+ 2.6.0
diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java
index d0a8bad..eacd49c 100644
--- a/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java
+++ b/src/main/java/org/gcube/informationsystem/resourceregistry/dbinitialization/DatabaseIntializator.java
@@ -40,12 +40,10 @@ public class DatabaseIntializator {
public static boolean initGraphDB() throws Exception {
- /*
OLogManager.instance().setWarnEnabled(false);
OLogManager.instance().setErrorEnabled(false);
OLogManager.instance().setInfoEnabled(false);
OLogManager.instance().setDebugEnabled(false);
- */
logger.trace("Connecting to {} as {} to create new DB",
DatabaseEnvironment.SERVER_URI, DatabaseEnvironment.USERNAME);
@@ -102,7 +100,7 @@ public class DatabaseIntializator {
OrientEdgeType e = orientGraphNoTx.getEdgeBaseType();
e.addSuperClass(oRestricted);
- orientGraphNoTx.commit();
+ //orientGraphNoTx.commit();
orientGraphNoTx.shutdown();
factory.close();
diff --git a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java
index 6bdefd8..da667c8 100644
--- a/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java
+++ b/src/main/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImpl.java
@@ -54,7 +54,6 @@ public class SchemaManagementImpl implements SchemaManagement {
OMetadata oMetadata = orientGraphNoTx.getRawGraph().getMetadata();
OSchema oSchema = oMetadata.getSchema();
return oSchema.getClass(entityType);
-
}
protected OClass getTypeSchema(String type, String baseType)
@@ -164,11 +163,14 @@ public class SchemaManagementImpl implements SchemaManagement {
OrientVertexType ovt = orientGraphNoTx
.createVertexType(typeDefinition.getName());
ovt.setDescription(typeDefinition.getDescription());
- ovt.setAbstract(typeDefinition.isAbstractType());
+ try {
+ ovt.setAbstract(typeDefinition.isAbstractType());
+ }catch(Exception e){
+ logger.error("Unable to set the Vertex Type {} as abstract. This is an OrientDB bug. The Type will be created as it is not abstarct.", typeDefinition.getName());
+ }
List oSuperclasses = getSuperclassesAndCheckCompliancy(
orientGraphNoTx, typeDefinition, baseType.getSimpleName());
-
ovt.setSuperClasses(oSuperclasses);
if (Resource.class.isAssignableFrom(baseType)) {
@@ -218,7 +220,7 @@ public class SchemaManagementImpl implements SchemaManagement {
}
}
- orientGraphNoTx.commit();
+ //orientGraphNoTx.commit();
OClass oClass = getTypeSchema(typeDefinition.getName(), null);
return serializeOClass(oClass);
@@ -250,8 +252,12 @@ public class SchemaManagementImpl implements SchemaManagement {
OrientEdgeType oet = orientGraphNoTx.createEdgeType(typeDefinition
.getName());
oet.setDescription(typeDefinition.getDescription());
- oet.setAbstract(typeDefinition.isAbstractType());
-
+ try {
+ oet.setAbstract(typeDefinition.isAbstractType());
+ }catch(Exception e){
+ logger.error("Unable to set the Edge Type {} as abstract. This is an OrientDB bug. The Type will be created as it is not abstarct.", typeDefinition.getName());
+ }
+
List oSuperclasses = getSuperclassesAndCheckCompliancy(
orientGraphNoTx, typeDefinition, baseType);
oet.setSuperClasses(oSuperclasses);
@@ -291,7 +297,7 @@ public class SchemaManagementImpl implements SchemaManagement {
}
}
- orientGraphNoTx.commit();
+ //orientGraphNoTx.commit();
OClass oClass = getTypeSchema(typeDefinition.getName(), null);
return serializeOClass(oClass);
@@ -369,7 +375,7 @@ public class SchemaManagementImpl implements SchemaManagement {
}
}
- orientGraphNoTx.commit();
+ //orientGraphNoTx.commit();
return serializeOClass(oClass);
diff --git a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java
index 3bf1511..fa44207 100644
--- a/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java
+++ b/src/test/java/org/gcube/informationsystem/resourceregistry/resources/impl/SchemaManagementImplTest.java
@@ -4,6 +4,8 @@
package org.gcube.informationsystem.resourceregistry.resources.impl;
import org.gcube.informationsystem.model.embedded.AccessPolicy;
+import org.gcube.informationsystem.model.embedded.Header;
+import org.gcube.informationsystem.model.entity.Entity;
import org.gcube.informationsystem.model.entity.facet.ContactFacet;
import org.gcube.informationsystem.model.entity.resource.Actor;
import org.gcube.informationsystem.model.relation.isrelatedto.Hosts;
@@ -21,10 +23,10 @@ public class SchemaManagementImplTest {
@Test
public void registerEmbeddedTypeSchema() throws Exception{
- Class> clz = AccessPolicy.class;
+ Class> clz = Header.class;
String json = TypeBinder.serializeType(clz);
logger.trace(json);
- //new SchemaManagementImpl().registerEmbeddedTypeSchema(json);
+ new SchemaManagementImpl().registerEmbeddedTypeSchema(json);
}
@Test
@@ -48,6 +50,13 @@ public class SchemaManagementImplTest {
logger.trace(json);
}
+ @Test
+ public void registerEntityTypeSchema() throws Exception{
+ Class> clz = Entity.class;
+ String json = TypeBinder.serializeType(clz);
+ logger.trace(json);
+ //new SchemaManagementImpl().registerEntitySchema(json);
+ }
@Test
public void registerResourceSchema() throws Exception{