Merge remote-tracking branch 'origin/feature/20316' into feature/20316
This commit is contained in:
commit
703a5f3b22
8
pom.xml
8
pom.xml
|
@ -52,8 +52,14 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.orientechnologies</groupId>
|
<groupId>com.orientechnologies</groupId>
|
||||||
|
<!--
|
||||||
|
To work with Thinkerpop® it is required to use this artifactId
|
||||||
<artifactId>orientdb-graphdb</artifactId>
|
<artifactId>orientdb-graphdb</artifactId>
|
||||||
<version>3.0.35</version>
|
Giving that we just use OrientDB classes and not Thinkerpop®
|
||||||
|
implementation we use a lighter dependecy
|
||||||
|
-->
|
||||||
|
<artifactId>orientdb-client</artifactId>
|
||||||
|
<version>3.0.37</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.gcube.common</groupId>
|
<groupId>org.gcube.common</groupId>
|
||||||
|
|
|
@ -114,8 +114,6 @@ public class DatabaseEnvironment {
|
||||||
private static final String SERVER_URI;
|
private static final String SERVER_URI;
|
||||||
public static final String DB_URI;
|
public static final String DB_URI;
|
||||||
|
|
||||||
public static final String O_RESTRICTED_CLASS = "ORestricted";
|
|
||||||
|
|
||||||
public static final CONNECTION_STRATEGY CONNECTION_STRATEGY_PARAMETER = CONNECTION_STRATEGY.ROUND_ROBIN_CONNECT;
|
public static final CONNECTION_STRATEGY CONNECTION_STRATEGY_PARAMETER = CONNECTION_STRATEGY.ROUND_ROBIN_CONNECT;
|
||||||
|
|
||||||
// Used to indicate virtual admin security context
|
// Used to indicate virtual admin security context
|
||||||
|
@ -138,6 +136,9 @@ public class DatabaseEnvironment {
|
||||||
|
|
||||||
private static final Key KEY;
|
private static final Key KEY;
|
||||||
|
|
||||||
|
public static final String V = "V";
|
||||||
|
public static final String E = "E";
|
||||||
|
|
||||||
static {
|
static {
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
|
@ -379,14 +380,14 @@ public class DatabaseEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.trace(
|
logger.trace(
|
||||||
"Setting Record-level Security (see https://orientdb.com/docs/last/Database-Security.html)");
|
"Setting Record-level Security (see http://orientdb.com/docs/3.0.x/security/Database-Security.html#record-level-security)");
|
||||||
OSchema oSchema = oMetadata.getSchema();
|
OSchema oSchema = oMetadata.getSchema();
|
||||||
OClass oRestricted = oSchema.getClass(O_RESTRICTED_CLASS);
|
OClass oRestricted = oSchema.getClass(OSecurity.RESTRICTED_CLASSNAME);
|
||||||
|
|
||||||
OClass v = oSchema.getClass("V");
|
OClass v = oSchema.getClass(V);
|
||||||
v.addSuperClass(oRestricted);
|
v.addSuperClass(oRestricted);
|
||||||
|
|
||||||
OClass e = oSchema.getClass("E");
|
OClass e = oSchema.getClass(E);
|
||||||
e.addSuperClass(oRestricted);
|
e.addSuperClass(oRestricted);
|
||||||
|
|
||||||
oDatabaseSession.commit();
|
oDatabaseSession.commit();
|
||||||
|
|
|
@ -73,13 +73,6 @@ public abstract class ElementManagement<El extends OElement, T extends Type> {
|
||||||
public final static String AT = "@";
|
public final static String AT = "@";
|
||||||
public final static String UNDERSCORE = "_";
|
public final static String UNDERSCORE = "_";
|
||||||
|
|
||||||
/* *
|
|
||||||
* The classes which has not to be included in the superClasses property when serialize and instance
|
|
||||||
* e.g. for any Resource instance when mast not include Entity and any Entity super class
|
|
||||||
* /
|
|
||||||
public final Set<String> superClassesToBeExcluded;
|
|
||||||
*/
|
|
||||||
|
|
||||||
protected final Set<String> ignoreKeys;
|
protected final Set<String> ignoreKeys;
|
||||||
protected final Set<String> ignoreStartWithKeys;
|
protected final Set<String> ignoreStartWithKeys;
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,9 @@ import com.orientechnologies.orient.core.record.OVertex;
|
||||||
*/
|
*/
|
||||||
public abstract class EntityElementManagement<E extends EntityElement, ET extends EntityType> extends ElementManagement<OVertex, ET> {
|
public abstract class EntityElementManagement<E extends EntityElement, ET extends EntityType> extends ElementManagement<OVertex, ET> {
|
||||||
|
|
||||||
|
public final static String IN_PREFIX = "in_";
|
||||||
|
public final static String OUT_PREFIX = "out_";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provide a cache edge-internal-id -> RelationManagement
|
* Provide a cache edge-internal-id -> RelationManagement
|
||||||
* this avoid to recreate the relationManagement of already visited edges
|
* this avoid to recreate the relationManagement of already visited edges
|
||||||
|
@ -43,10 +46,10 @@ public abstract class EntityElementManagement<E extends EntityElement, ET extend
|
||||||
|
|
||||||
this.ignoreKeys.add(EntityElement.HEADER_PROPERTY);
|
this.ignoreKeys.add(EntityElement.HEADER_PROPERTY);
|
||||||
|
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_IN_PREFIX.toLowerCase());
|
this.ignoreStartWithKeys.add(IN_PREFIX.toLowerCase());
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_OUT_PREFIX.toLowerCase());
|
this.ignoreStartWithKeys.add(OUT_PREFIX.toLowerCase());
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_IN_PREFIX.toUpperCase());
|
this.ignoreStartWithKeys.add(IN_PREFIX.toUpperCase());
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_OUT_PREFIX.toUpperCase());
|
this.ignoreStartWithKeys.add(OUT_PREFIX.toUpperCase());
|
||||||
|
|
||||||
this.relationManagements = new HashMap<>();
|
this.relationManagements = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,9 @@ import com.orientechnologies.orient.core.record.OVertex;
|
||||||
public abstract class RelationElementManagement<SEM extends EntityElementManagement<? extends EntityElement, SET>, TEM extends EntityElementManagement<? extends EntityElement, TET>, SET extends EntityType, TET extends EntityType>
|
public abstract class RelationElementManagement<SEM extends EntityElementManagement<? extends EntityElement, SET>, TEM extends EntityElementManagement<? extends EntityElement, TET>, SET extends EntityType, TET extends EntityType>
|
||||||
extends ElementManagement<OEdge, RelationType<SET, TET>> {
|
extends ElementManagement<OEdge, RelationType<SET, TET>> {
|
||||||
|
|
||||||
|
public final static String IN = "in";
|
||||||
|
public final static String OUT = "out";
|
||||||
|
|
||||||
protected final Class<? extends EntityElement> sourceEntityClass;
|
protected final Class<? extends EntityElement> sourceEntityClass;
|
||||||
protected final Class<? extends EntityElement> targetEntityClass;
|
protected final Class<? extends EntityElement> targetEntityClass;
|
||||||
|
|
||||||
|
@ -44,10 +47,11 @@ public abstract class RelationElementManagement<SEM extends EntityElementManagem
|
||||||
this.ignoreKeys.add(Relation.HEADER_PROPERTY);
|
this.ignoreKeys.add(Relation.HEADER_PROPERTY);
|
||||||
this.ignoreKeys.add(Relation.SOURCE_PROPERTY);
|
this.ignoreKeys.add(Relation.SOURCE_PROPERTY);
|
||||||
this.ignoreKeys.add(Relation.TARGET_PROPERTY);
|
this.ignoreKeys.add(Relation.TARGET_PROPERTY);
|
||||||
this.ignoreKeys.add(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.CONNECTION_OUT.toLowerCase());
|
this.ignoreKeys.add(IN.toLowerCase());
|
||||||
this.ignoreKeys.add(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.CONNECTION_IN.toLowerCase());
|
this.ignoreKeys.add(OUT.toLowerCase());
|
||||||
this.ignoreKeys.add(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.CONNECTION_OUT.toUpperCase());
|
this.ignoreKeys.add(IN.toUpperCase());
|
||||||
this.ignoreKeys.add(com.tinkerpop.blueprints.impls.orient.OrientBaseGraph.CONNECTION_IN.toUpperCase());
|
this.ignoreKeys.add(OUT.toUpperCase());
|
||||||
|
|
||||||
|
|
||||||
this.sourceEntityClass = sourceEntityClass;
|
this.sourceEntityClass = sourceEntityClass;
|
||||||
this.targetEntityClass = targetEntityClass;
|
this.targetEntityClass = targetEntityClass;
|
||||||
|
|
|
@ -143,10 +143,10 @@ public abstract class EntityManagement<E extends Entity, ET extends EntityType>
|
||||||
|
|
||||||
this.ignoreKeys.add(Entity.HEADER_PROPERTY);
|
this.ignoreKeys.add(Entity.HEADER_PROPERTY);
|
||||||
|
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_IN_PREFIX.toLowerCase());
|
this.ignoreStartWithKeys.add(IN_PREFIX.toLowerCase());
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_OUT_PREFIX.toLowerCase());
|
this.ignoreStartWithKeys.add(OUT_PREFIX.toLowerCase());
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_IN_PREFIX.toUpperCase());
|
this.ignoreStartWithKeys.add(IN_PREFIX.toUpperCase());
|
||||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_OUT_PREFIX.toUpperCase());
|
this.ignoreStartWithKeys.add(OUT_PREFIX.toUpperCase());
|
||||||
|
|
||||||
this.relationManagements = new HashMap<>();
|
this.relationManagements = new HashMap<>();
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@ import org.gcube.informationsystem.types.TypeMapper;
|
||||||
import org.gcube.informationsystem.types.reference.Type;
|
import org.gcube.informationsystem.types.reference.Type;
|
||||||
|
|
||||||
import com.orientechnologies.orient.core.record.ODirection;
|
import com.orientechnologies.orient.core.record.ODirection;
|
||||||
import com.tinkerpop.blueprints.Direction;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -421,7 +420,7 @@ public class Access extends BaseRest {
|
||||||
try {
|
try {
|
||||||
directionEnum = ODirection.valueOf(direction.toUpperCase());
|
directionEnum = ODirection.valueOf(direction.toUpperCase());
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
String error = String.format("%s is not a valid. Allowed values are %s", direction, Direction.values());
|
String error = String.format("%s is not a valid. Allowed values are %s", direction, ODirection.values());
|
||||||
throw new InvalidQueryException(error);
|
throw new InvalidQueryException(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||||
import com.orientechnologies.orient.core.metadata.OMetadata;
|
import com.orientechnologies.orient.core.metadata.OMetadata;
|
||||||
import com.orientechnologies.orient.core.metadata.schema.OClass;
|
import com.orientechnologies.orient.core.metadata.schema.OClass;
|
||||||
import com.orientechnologies.orient.core.metadata.schema.OSchema;
|
import com.orientechnologies.orient.core.metadata.schema.OSchema;
|
||||||
import com.tinkerpop.blueprints.util.StringFactory;
|
import com.orientechnologies.orient.core.metadata.security.OSecurity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -131,8 +131,8 @@ public class CachedType<T extends Type> {
|
||||||
String name = oSuperClass.getName();
|
String name = oSuperClass.getName();
|
||||||
CachedType<?> cachedType = typesCache.getCachedType(name);
|
CachedType<?> cachedType = typesCache.getCachedType(name);
|
||||||
cachedType.setOClass(oSuperClass);
|
cachedType.setOClass(oSuperClass);
|
||||||
if(name.compareTo(StringFactory.V.toUpperCase()) == 0 || name.compareTo(StringFactory.E.toUpperCase()) == 0
|
if(name.compareTo(DatabaseEnvironment.V) == 0 || name.compareTo(DatabaseEnvironment.E) == 0
|
||||||
|| name.compareTo(DatabaseEnvironment.O_RESTRICTED_CLASS) == 0) {
|
|| name.compareTo(OSecurity.RESTRICTED_CLASSNAME) == 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,6 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.orientechnologies.orient.core.record.OElement;
|
import com.orientechnologies.orient.core.record.OElement;
|
||||||
import com.orientechnologies.orient.core.record.impl.ODocument;
|
import com.orientechnologies.orient.core.record.impl.ODocument;
|
||||||
import com.tinkerpop.blueprints.Edge;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -121,11 +120,13 @@ public class HeaderUtility {
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
public static Header addHeader(Edge edge, UUID uuid) {
|
public static Header addHeader(Edge edge, UUID uuid) {
|
||||||
Header header = createHeader(uuid);
|
Header header = createHeader(uuid);
|
||||||
edge.setProperty(IdentifiableElement.HEADER_PROPERTY, header);
|
edge.setProperty(IdentifiableElement.HEADER_PROPERTY, header);
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
public static Header getHeader(OElement element) throws ResourceRegistryException {
|
public static Header getHeader(OElement element) throws ResourceRegistryException {
|
||||||
return Utility.getPropertyDocument(Header.class, element, IdentifiableElement.HEADER_PROPERTY);
|
return Utility.getPropertyDocument(Header.class, element, IdentifiableElement.HEADER_PROPERTY);
|
||||||
|
|
Loading…
Reference in New Issue