Refactoring service
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/information-system/resource-registry@133536 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
31210ba8c3
commit
a887ffaaf2
2
pom.xml
2
pom.xml
|
@ -8,7 +8,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.information-system</groupId>
|
<groupId>org.gcube.information-system</groupId>
|
||||||
<artifactId>resource-registry</artifactId>
|
<artifactId>resource-registry</artifactId>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<name>Resource Registry</name>
|
<name>Resource Registry</name>
|
||||||
<description>Resource Registry</description>
|
<description>Resource Registry</description>
|
||||||
<packaging>war</packaging>
|
<packaging>war</packaging>
|
||||||
|
|
|
@ -130,7 +130,8 @@ public class SecurityContext {
|
||||||
"Security Context (roles and users) with UUID {} successfully created",
|
"Security Context (roles and users) with UUID {} successfully created",
|
||||||
contextID);
|
contextID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void deleteSecurityContext(OrientGraph orientGraph,
|
public static void deleteSecurityContext(OrientGraph orientGraph,
|
||||||
String contextID, boolean commit) {
|
String contextID, boolean commit) {
|
||||||
|
|
||||||
|
@ -141,19 +142,50 @@ public class SecurityContext {
|
||||||
OSecurity oSecurity = orientGraph.getRawGraph().getMetadata()
|
OSecurity oSecurity = orientGraph.getRawGraph().getMetadata()
|
||||||
.getSecurity();
|
.getSecurity();
|
||||||
|
|
||||||
oSecurity.dropUser(SecurityContextMapper.getSecurityRoleOrUserName(
|
String user = SecurityContextMapper.getSecurityRoleOrUserName(
|
||||||
SecurityContextMapper.PermissionMode.READER,
|
SecurityContextMapper.PermissionMode.READER,
|
||||||
SecurityContextMapper.SecurityType.USER, contextID));
|
SecurityContextMapper.SecurityType.USER, contextID);
|
||||||
oSecurity.dropUser(SecurityContextMapper.getSecurityRoleOrUserName(
|
boolean dropped = oSecurity.dropUser(user);
|
||||||
|
if(dropped){
|
||||||
|
logger.trace("{} successfully dropped", user);
|
||||||
|
}else{
|
||||||
|
logger.error("{} was not dropped successfully", user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
user = SecurityContextMapper.getSecurityRoleOrUserName(
|
||||||
SecurityContextMapper.PermissionMode.WRITER,
|
SecurityContextMapper.PermissionMode.WRITER,
|
||||||
SecurityContextMapper.SecurityType.USER, contextID));
|
SecurityContextMapper.SecurityType.USER, contextID);
|
||||||
oSecurity.dropRole(SecurityContextMapper.getSecurityRoleOrUserName(
|
dropped = oSecurity.dropUser(user);
|
||||||
|
if(dropped){
|
||||||
|
logger.trace("{} successfully dropped", user);
|
||||||
|
}else{
|
||||||
|
logger.error("{} was not dropped successfully", user);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String role = SecurityContextMapper.getSecurityRoleOrUserName(
|
||||||
SecurityContextMapper.PermissionMode.READER,
|
SecurityContextMapper.PermissionMode.READER,
|
||||||
SecurityContextMapper.SecurityType.ROLE, contextID));
|
SecurityContextMapper.SecurityType.ROLE, contextID);
|
||||||
oSecurity.dropRole(SecurityContextMapper.getSecurityRoleOrUserName(
|
dropped = oSecurity.dropRole(role);
|
||||||
|
if(dropped){
|
||||||
|
logger.trace("{} successfully dropped", role);
|
||||||
|
}else{
|
||||||
|
logger.error("{} was not dropped successfully", role);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
role = SecurityContextMapper.getSecurityRoleOrUserName(
|
||||||
SecurityContextMapper.PermissionMode.WRITER,
|
SecurityContextMapper.PermissionMode.WRITER,
|
||||||
SecurityContextMapper.SecurityType.ROLE, contextID));
|
SecurityContextMapper.SecurityType.ROLE, contextID);
|
||||||
|
dropped = oSecurity.dropRole(role);
|
||||||
|
if(dropped){
|
||||||
|
logger.trace("{} successfully dropped", role);
|
||||||
|
}else{
|
||||||
|
logger.error("{} was not dropped successfully", role);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (commit) {
|
if (commit) {
|
||||||
orientGraph.commit();
|
orientGraph.commit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,7 +30,7 @@ public abstract class SecurityContextMapper {
|
||||||
static {
|
static {
|
||||||
try {
|
try {
|
||||||
boolean created = DatabaseIntializator.initGraphDB();
|
boolean created = DatabaseIntializator.initGraphDB();
|
||||||
|
|
||||||
logger.trace("Creating factory for {} connecting as {}",
|
logger.trace("Creating factory for {} connecting as {}",
|
||||||
DatabaseEnvironment.DB_URI,
|
DatabaseEnvironment.DB_URI,
|
||||||
DatabaseEnvironment.DEFAULT_ADMIN_USERNAME);
|
DatabaseEnvironment.DEFAULT_ADMIN_USERNAME);
|
||||||
|
|
|
@ -5,6 +5,7 @@ package org.gcube.informationsystem.resourceregistry.dbinitialization;
|
||||||
|
|
||||||
import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery;
|
import org.gcube.informationsystem.impl.utils.discovery.ERDiscovery;
|
||||||
import org.gcube.informationsystem.model.embedded.Embedded;
|
import org.gcube.informationsystem.model.embedded.Embedded;
|
||||||
|
import org.gcube.informationsystem.model.embedded.ValueSchema;
|
||||||
import org.gcube.informationsystem.model.entity.Entity;
|
import org.gcube.informationsystem.model.entity.Entity;
|
||||||
import org.gcube.informationsystem.model.relation.Relation;
|
import org.gcube.informationsystem.model.relation.Relation;
|
||||||
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
|
import org.gcube.informationsystem.resourceregistry.context.SecurityContextMapper.PermissionMode;
|
||||||
|
@ -38,11 +39,13 @@ public class DatabaseIntializator {
|
||||||
private static final String O_RESTRICTED_CLASS = "ORestricted";
|
private static final String O_RESTRICTED_CLASS = "ORestricted";
|
||||||
|
|
||||||
public static boolean initGraphDB() throws Exception {
|
public static boolean initGraphDB() throws Exception {
|
||||||
|
|
||||||
|
/*
|
||||||
OLogManager.instance().setWarnEnabled(false);
|
OLogManager.instance().setWarnEnabled(false);
|
||||||
OLogManager.instance().setErrorEnabled(false);
|
OLogManager.instance().setErrorEnabled(false);
|
||||||
OLogManager.instance().setInfoEnabled(false);
|
OLogManager.instance().setInfoEnabled(false);
|
||||||
OLogManager.instance().setDebugEnabled(false);
|
OLogManager.instance().setDebugEnabled(false);
|
||||||
|
*/
|
||||||
|
|
||||||
logger.trace("Connecting to {} as {} to create new DB",
|
logger.trace("Connecting to {} as {} to create new DB",
|
||||||
DatabaseEnvironment.SERVER_URI, DatabaseEnvironment.USERNAME);
|
DatabaseEnvironment.SERVER_URI, DatabaseEnvironment.USERNAME);
|
||||||
|
@ -119,6 +122,7 @@ public class DatabaseIntializator {
|
||||||
erDiscovery.discoverERTypes();
|
erDiscovery.discoverERTypes();
|
||||||
|
|
||||||
EntityRegistrationAction entityRegistrationAction = new EntityRegistrationAction();
|
EntityRegistrationAction entityRegistrationAction = new EntityRegistrationAction();
|
||||||
|
entityRegistrationAction.manageEmbeddedClass(ValueSchema.class);
|
||||||
erDiscovery.manageDiscoveredERTypes(entityRegistrationAction);
|
erDiscovery.manageDiscoveredERTypes(entityRegistrationAction);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ public class EntityRegistrationAction implements ERAction {
|
||||||
schemaManagement.registerRelationSchema(json);
|
schemaManagement.registerRelationSchema(json);
|
||||||
}
|
}
|
||||||
} catch(Exception ex){
|
} catch(Exception ex){
|
||||||
logger.error("Error creating schema for {} type {} : {}", Relation.NAME, r.getClass().getSimpleName(), ex.getMessage());
|
logger.error("Error creating schema for {} type {} : {}", Relation.NAME, r.getSimpleName(), ex.getMessage());
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class EntityRegistrationAction implements ERAction {
|
||||||
schemaManagement.registerEntitySchema(json);
|
schemaManagement.registerEntitySchema(json);
|
||||||
}
|
}
|
||||||
} catch(Exception ex){
|
} catch(Exception ex){
|
||||||
logger.error("Error creating schema for {} type {} : {}", Entity.NAME, e.getClass().getSimpleName(), ex.getMessage());
|
logger.error("Error creating schema for {} type {} : {}", Entity.NAME, e.getSimpleName(), ex.getMessage());
|
||||||
throw ex;
|
throw ex;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,15 +74,18 @@ public class EntityRegistrationAction implements ERAction {
|
||||||
if(e==Embedded.class){
|
if(e==Embedded.class){
|
||||||
logger.trace("Discarding {} because is just a convenient interface", e);
|
logger.trace("Discarding {} because is just a convenient interface", e);
|
||||||
return;
|
return;
|
||||||
}else{
|
|
||||||
try{
|
|
||||||
String json = TypeBinder.serializeType(e);
|
|
||||||
logger.trace(json);
|
|
||||||
schemaManagement.registerEmbeddedTypeSchema(json);
|
|
||||||
} catch(Exception ex){
|
|
||||||
logger.error("Error creating schema for {} type {} : {}", Embedded.NAME, e.getClass().getSimpleName(), ex.getMessage());
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
String json = TypeBinder.serializeType(e);
|
||||||
|
logger.trace(json);
|
||||||
|
schemaManagement.registerEmbeddedTypeSchema(json);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
logger.error("Error creating schema for {} type {} : {}",
|
||||||
|
Embedded.NAME, e.getSimpleName(),
|
||||||
|
ex.getMessage());
|
||||||
|
throw ex;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
* @author Lucio Lelii (lucio.lelii@isti.cnr.it)
|
* @author Lucio Lelii (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
@Path(ContextPath.CONTEXT_PATH_PART)
|
@Path(ContextPath.CONTEXT_PATH_PART)
|
||||||
public class ContextManager {
|
public class ContextManager {
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
* @author Lucio Lelii (lucio.lelii@isti.cnr.it)
|
* @author Lucio Lelii (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
@Path(EntityPath.ENTITY_PATH_PART)
|
@Path(EntityPath.ENTITY_PATH_PART)
|
||||||
public class EntityManager {
|
public class EntityManager {
|
||||||
|
|
|
@ -14,7 +14,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
* @author Lucio Lelii (lucio.lelii@isti.cnr.it)
|
* @author Lucio Lelii (ISTI - CNR)
|
||||||
*/
|
*/
|
||||||
@ApplicationPath(SchemaPath.SCHEMA_PATH_PART)
|
@ApplicationPath(SchemaPath.SCHEMA_PATH_PART)
|
||||||
public class SchemaManager {
|
public class SchemaManager {
|
||||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Iterator;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import org.gcube.informationsystem.model.embedded.Header;
|
import org.gcube.informationsystem.model.embedded.Header;
|
||||||
import org.gcube.informationsystem.model.orientdb.impl.entity.Context;
|
import org.gcube.informationsystem.model.entity.Context;
|
||||||
import org.gcube.informationsystem.model.relation.IsParentOf;
|
import org.gcube.informationsystem.model.relation.IsParentOf;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.ContextManagement;
|
import org.gcube.informationsystem.resourceregistry.api.ContextManagement;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.InternalException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.InternalException;
|
||||||
|
@ -28,8 +28,7 @@ import com.tinkerpop.blueprints.Direction;
|
||||||
import com.tinkerpop.blueprints.Edge;
|
import com.tinkerpop.blueprints.Edge;
|
||||||
import com.tinkerpop.blueprints.Vertex;
|
import com.tinkerpop.blueprints.Vertex;
|
||||||
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
|
import com.tinkerpop.blueprints.impls.orient.OrientGraph;
|
||||||
import com.tinkerpop.frames.FramedGraph;
|
import com.tinkerpop.blueprints.impls.orient.OrientVertex;
|
||||||
import com.tinkerpop.frames.FramedGraphFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Luca Frosini (ISTI - CNR)
|
* @author Luca Frosini (ISTI - CNR)
|
||||||
|
@ -132,35 +131,28 @@ public class ContextManagementImpl implements ContextManagement {
|
||||||
} catch (ContextException e) {
|
} catch (ContextException e) {
|
||||||
throw new ContextCreationException(e.getMessage());
|
throw new ContextCreationException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
UUID uuid = UUID.randomUUID();
|
UUID uuid = UUID.randomUUID();
|
||||||
String uuidString = uuid.toString();
|
String uuidString = uuid.toString();
|
||||||
|
|
||||||
|
|
||||||
SecurityContext.createSecurityContext(orientGraph, uuidString, true);
|
SecurityContext.createSecurityContext(orientGraph, uuidString, true);
|
||||||
|
|
||||||
try {
|
|
||||||
|
|
||||||
FramedGraphFactory framedGraphFactory = new FramedGraphFactory();
|
|
||||||
FramedGraph<OrientGraph> framedGraph = framedGraphFactory
|
|
||||||
.create(orientGraph);
|
|
||||||
|
|
||||||
Context context = framedGraph.addVertex("class:"
|
try {
|
||||||
+ org.gcube.informationsystem.model.entity.Context.NAME,
|
|
||||||
Context.class);
|
OrientVertex context = orientGraph.addVertex("class:"
|
||||||
context.setName(name);
|
+ Context.NAME);
|
||||||
|
context.setProperty(Context.NAME_PROPERTY, name);
|
||||||
|
|
||||||
HeaderUtility.addHeader(context, uuid);
|
HeaderUtility.addHeader(context, uuid);
|
||||||
|
|
||||||
if (parentContextUUID != null) {
|
if (parentContextUUID != null) {
|
||||||
orientGraph.addEdge(null, parent, context.asVertex(),
|
orientGraph.addEdge(null, parent, context, IsParentOf.NAME);
|
||||||
IsParentOf.NAME);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SecurityContext.addToSecurityContext(orientGraph,
|
SecurityContext.addToSecurityContext(orientGraph, context,
|
||||||
context.asVertex(), uuidString);
|
uuidString);
|
||||||
|
|
||||||
String contextJsonString = Utility.toJsonString(context.asVertex(), true);
|
String contextJsonString = Utility.toJsonString(context, true);
|
||||||
logger.trace("Creating {}", contextJsonString);
|
logger.trace("Creating {}", contextJsonString);
|
||||||
|
|
||||||
orientGraph.commit();
|
orientGraph.commit();
|
||||||
|
@ -170,7 +162,8 @@ public class ContextManagementImpl implements ContextManagement {
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
orientGraph.rollback();
|
orientGraph.rollback();
|
||||||
SecurityContext.deleteSecurityContext(orientGraph, uuidString, true);
|
SecurityContext
|
||||||
|
.deleteSecurityContext(orientGraph, uuidString, true);
|
||||||
throw new InternalException(e.getMessage());
|
throw new InternalException(e.getMessage());
|
||||||
} finally {
|
} finally {
|
||||||
orientGraph.shutdown();
|
orientGraph.shutdown();
|
||||||
|
@ -227,7 +220,7 @@ public class ContextManagementImpl implements ContextManagement {
|
||||||
logger.info("Context renamed {}", contextJsonString);
|
logger.info("Context renamed {}", contextJsonString);
|
||||||
|
|
||||||
orientGraph.shutdown();
|
orientGraph.shutdown();
|
||||||
|
|
||||||
return contextUUID;
|
return contextUUID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -268,11 +261,11 @@ public class ContextManagementImpl implements ContextManagement {
|
||||||
}
|
}
|
||||||
|
|
||||||
orientGraph.commit();
|
orientGraph.commit();
|
||||||
|
|
||||||
context = getContext(orientGraph, contextToMoveUUID);
|
context = getContext(orientGraph, contextToMoveUUID);
|
||||||
String contextJsonString = Utility.toJsonString(context, true);
|
String contextJsonString = Utility.toJsonString(context, true);
|
||||||
logger.info("Context moved {}", contextJsonString);
|
logger.info("Context moved {}", contextJsonString);
|
||||||
|
|
||||||
orientGraph.shutdown();
|
orientGraph.shutdown();
|
||||||
return contextToMoveUUID;
|
return contextToMoveUUID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,10 +273,8 @@ public class EntityManagementImpl implements EntityManagement {
|
||||||
try {
|
try {
|
||||||
targetHeader = getHeader(target);
|
targetHeader = getHeader(target);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
new ResourceRegistryException(e);
|
throw new ResourceRegistryException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
Class<? extends Entity> targetClass = null;
|
|
||||||
|
|
||||||
|
|
||||||
Vertex targetVertex = null;
|
Vertex targetVertex = null;
|
||||||
|
@ -284,9 +282,7 @@ public class EntityManagementImpl implements EntityManagement {
|
||||||
if (ConsistsOf.class.isAssignableFrom(relation)) {
|
if (ConsistsOf.class.isAssignableFrom(relation)) {
|
||||||
targetVertex = createVertexEntity(
|
targetVertex = createVertexEntity(
|
||||||
orientGraph, getClassProperty(target),
|
orientGraph, getClassProperty(target),
|
||||||
Facet.class,
|
Facet.class, target.toString(), true);
|
||||||
target.toString(), true);
|
|
||||||
targetClass = Facet.class;
|
|
||||||
targetHeader = targetVertex.getProperty(Facet.HEADER_PROPERTY);
|
targetHeader = targetVertex.getProperty(Facet.HEADER_PROPERTY);
|
||||||
} else {
|
} else {
|
||||||
String error = String.format(
|
String error = String.format(
|
||||||
|
@ -299,6 +295,7 @@ public class EntityManagementImpl implements EntityManagement {
|
||||||
}else {
|
}else {
|
||||||
// The target Entity was already created we just need to create
|
// The target Entity was already created we just need to create
|
||||||
// the right relation
|
// the right relation
|
||||||
|
Class<? extends Entity> targetClass = null;
|
||||||
|
|
||||||
if(ConsistsOf.class.isAssignableFrom(relation)) {
|
if(ConsistsOf.class.isAssignableFrom(relation)) {
|
||||||
targetClass = Facet.class;
|
targetClass = Facet.class;
|
||||||
|
@ -467,7 +464,7 @@ public class EntityManagementImpl implements EntityManagement {
|
||||||
edgeProperties = getPropertyMap(jsonNode, ignoreKeys);
|
edgeProperties = getPropertyMap(jsonNode, ignoreKeys);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
new ResourceRegistryException(
|
throw new ResourceRegistryException(
|
||||||
"Error while setting Relation Properties", e);
|
"Error while setting Relation Properties", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
|
|
||||||
OrientGraphNoTx orientGraphNoTx = null;
|
OrientGraphNoTx orientGraphNoTx = null;
|
||||||
try {
|
try {
|
||||||
logger.trace("Trying to register {} {}", baseType, jsonSchema);
|
logger.info("Trying to register {} {}", baseType, jsonSchema);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
TypeDefinition typeDefinition = mapper.readValue(jsonSchema,
|
TypeDefinition typeDefinition = mapper.readValue(jsonSchema,
|
||||||
|
@ -239,7 +239,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
|
|
||||||
OrientGraphNoTx orientGraphNoTx = null;
|
OrientGraphNoTx orientGraphNoTx = null;
|
||||||
try {
|
try {
|
||||||
logger.trace("Trying to register {} {}", baseType, jsonSchema);
|
logger.info("Trying to register {} {}", baseType, jsonSchema);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
TypeDefinition typeDefinition = mapper.readValue(jsonSchema,
|
TypeDefinition typeDefinition = mapper.readValue(jsonSchema,
|
||||||
|
@ -311,7 +311,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
||||||
|
|
||||||
OrientGraphNoTx orientGraphNoTx = null;
|
OrientGraphNoTx orientGraphNoTx = null;
|
||||||
try {
|
try {
|
||||||
logger.trace("Trying to register {}", jsonSchema);
|
logger.info("Trying to register {}", jsonSchema);
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
TypeDefinition typeDefinition = mapper.readValue(jsonSchema,
|
TypeDefinition typeDefinition = mapper.readValue(jsonSchema,
|
||||||
|
|
|
@ -7,8 +7,8 @@ import java.util.Iterator;
|
||||||
|
|
||||||
import org.gcube.common.scope.api.ScopeProvider;
|
import org.gcube.common.scope.api.ScopeProvider;
|
||||||
import org.gcube.common.scope.impl.ScopeBean;
|
import org.gcube.common.scope.impl.ScopeBean;
|
||||||
import org.gcube.informationsystem.model.orientdb.impl.entity.Context;
|
import org.gcube.informationsystem.model.entity.Context;
|
||||||
import org.gcube.informationsystem.model.orientdb.impl.entity.Entity;
|
import org.gcube.informationsystem.model.entity.Entity;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextException;
|
||||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
||||||
|
|
|
@ -12,8 +12,7 @@ import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||||
import org.gcube.common.authorization.library.provider.ClientInfo;
|
import org.gcube.common.authorization.library.provider.ClientInfo;
|
||||||
import org.gcube.common.authorization.library.utils.Caller;
|
import org.gcube.common.authorization.library.utils.Caller;
|
||||||
import org.gcube.informationsystem.model.orientdb.impl.embedded.Header;
|
import org.gcube.informationsystem.model.orientdb.impl.embedded.Header;
|
||||||
import org.gcube.informationsystem.model.orientdb.impl.entity.Entity;
|
import org.gcube.informationsystem.model.entity.Entity;
|
||||||
import org.gcube.informationsystem.model.orientdb.impl.relation.Relation;
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -72,23 +71,11 @@ public class HeaderUtility {
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Header addHeader(Entity entity, UUID uuid) {
|
|
||||||
Header header = createHeader(uuid);
|
|
||||||
entity.setHeader(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(Entity.HEADER_PROPERTY, header);
|
edge.setProperty(Entity.HEADER_PROPERTY, header);
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Header addHeader(@SuppressWarnings("rawtypes") Relation relation, UUID uuid) {
|
|
||||||
Header header = createHeader(uuid);
|
|
||||||
relation.setHeader(header);
|
|
||||||
return header;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue