Getting constant from ORientDB class in place of redefining it

This commit is contained in:
Luca Frosini 2021-02-26 18:08:13 +01:00
parent cf29667f19
commit 129c4b5b54
2 changed files with 3 additions and 5 deletions

View File

@ -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
@ -381,7 +379,7 @@ 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 https://orientdb.com/docs/last/Database-Security.html)");
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);

View File

@ -13,7 +13,6 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility; import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.types.TypeMapper; import org.gcube.informationsystem.types.TypeMapper;
import org.gcube.informationsystem.types.reference.Type; import org.gcube.informationsystem.types.reference.Type;
@ -25,6 +24,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.orientechnologies.orient.core.metadata.security.OSecurity;
import com.tinkerpop.blueprints.util.StringFactory; import com.tinkerpop.blueprints.util.StringFactory;
/** /**
@ -132,7 +132,7 @@ public class CachedType<T extends Type> {
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(StringFactory.V.toUpperCase()) == 0 || name.compareTo(StringFactory.E.toUpperCase()) == 0
|| name.compareTo(DatabaseEnvironment.O_RESTRICTED_CLASS) == 0) { || name.compareTo(OSecurity.RESTRICTED_CLASSNAME) == 0) {
continue; continue;
} }