Fixing imports and code to be aligned with model reorganization
This commit is contained in:
parent
1d8af30bea
commit
b599c27351
|
@ -3,10 +3,10 @@ package org.gcube.informationsystem.resourceregistry.context;
|
|||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
|
@ -128,7 +128,7 @@ public class ContextManagement extends EntityManagement<Context> {
|
|||
|
||||
} else {
|
||||
// TODO Rewrite using Gremlin
|
||||
String select = "SELECT FROM " + org.gcube.informationsystem.model.reference.entities.Context.NAME + " WHERE "
|
||||
String select = "SELECT FROM " + Context.NAME + " WHERE "
|
||||
+ Context.NAME_PROPERTY + " = \"" + getName() + "\"" + " AND in(\"" + IsParentOf.NAME
|
||||
+ "\").size() = 0";
|
||||
|
||||
|
|
|
@ -11,8 +11,8 @@ import org.gcube.common.authorization.library.AuthorizationEntry;
|
|||
import org.gcube.common.authorization.library.provider.SecurityTokenProvider;
|
||||
import org.gcube.common.scope.api.ScopeProvider;
|
||||
import org.gcube.common.scope.impl.ScopeBean;
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
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.ContextNotFoundException;
|
||||
|
|
|
@ -2,12 +2,11 @@ package org.gcube.informationsystem.resourceregistry.context;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
|
@ -32,16 +31,8 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraph;
|
|||
@SuppressWarnings("rawtypes")
|
||||
public class IsParentOfManagement extends RelationManagement<IsParentOf,ContextManagement,ContextManagement> {
|
||||
|
||||
public static final PropagationConstraint DEFAULT_IS_PARENT_OF_PC;
|
||||
|
||||
static {
|
||||
DEFAULT_IS_PARENT_OF_PC = new PropagationConstraintImpl();
|
||||
DEFAULT_IS_PARENT_OF_PC.setRemoveConstraint(RemoveConstraint.keep);
|
||||
DEFAULT_IS_PARENT_OF_PC.setAddConstraint(AddConstraint.unpropagate);
|
||||
}
|
||||
|
||||
public IsParentOfManagement() {
|
||||
super(AccessType.IS_PARENT_OF, DEFAULT_IS_PARENT_OF_PC);
|
||||
super(AccessType.IS_PARENT_OF, null);
|
||||
}
|
||||
|
||||
public IsParentOfManagement(OrientGraph orientGraph) throws ResourceRegistryException {
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.concurrent.ExecutorService;
|
|||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
|
|
|
@ -10,7 +10,7 @@ import java.util.Properties;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.common.encryption.SymmetricKey;
|
||||
import org.gcube.informationsystem.model.reference.ISConstants;
|
||||
import org.gcube.informationsystem.base.reference.ISConstants;
|
||||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.context.security.ContextSecurityContext;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
package org.gcube.informationsystem.resourceregistry.dbinitialization;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
@ -30,7 +33,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <R extends Relation<? extends Entity,? extends Entity>> void manageRelationClass(Class<R> r)
|
||||
public <R extends BaseRelation<? extends BaseEntity,? extends BaseEntity>> void manageRelationClass(Class<R> r)
|
||||
throws Exception {
|
||||
try {
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(r));
|
||||
|
@ -53,7 +56,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <E extends Entity> void manageEntityClass(Class<E> e) throws Exception {
|
||||
public <E extends BaseEntity> void manageEntityClass(Class<E> e) throws Exception {
|
||||
try {
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e));
|
||||
String json = TypeBinder.serializeType(e);
|
||||
|
@ -74,7 +77,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
}
|
||||
|
||||
@Override
|
||||
public <P extends Property> void managePropertyClass(Class<P> e) throws Exception {
|
||||
public <P extends BaseProperty> void managePropertyClass(Class<P> e) throws Exception {
|
||||
try {
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(TypeBinder.getType(e));
|
||||
String json = TypeBinder.serializeType(e);
|
||||
|
|
|
@ -14,11 +14,11 @@ import java.util.UUID;
|
|||
|
||||
import javax.activation.UnsupportedDataTypeException;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.ER;
|
||||
import org.gcube.informationsystem.model.reference.ISManageable;
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
|
|
@ -4,11 +4,11 @@ import java.security.Key;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.ISManageable;
|
||||
import org.gcube.informationsystem.model.reference.properties.Encrypted;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
||||
|
|
|
@ -6,11 +6,12 @@ import java.util.List;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
||||
|
@ -45,7 +46,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientVertexType;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class EntityManagement<E extends Entity> extends ERManagement<E,Vertex> {
|
||||
public abstract class EntityManagement<E extends BaseEntity> extends ERManagement<E,Vertex> {
|
||||
|
||||
/**
|
||||
* Provide a cache edge-internal-id -> RelationManagement
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.informationsystem.resourceregistry.er.entity;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er.entity;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.informationsystem.resourceregistry.er.relation;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.gcube.informationsystem.resourceregistry.er.relation;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.AddConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
|
|
|
@ -6,7 +6,8 @@ import java.util.Iterator;
|
|||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.relations.BaseRelation;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
@ -49,7 +50,7 @@ import com.tinkerpop.blueprints.impls.orient.OrientGraph;
|
|||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public abstract class RelationManagement<R extends Relation, S extends EntityManagement, T extends EntityManagement>
|
||||
public abstract class RelationManagement<R extends BaseRelation, S extends EntityManagement, T extends EntityManagement>
|
||||
extends ERManagement<R,Edge> {
|
||||
|
||||
protected final Class<? extends Entity> targetEntityClass;
|
||||
|
|
|
@ -104,7 +104,7 @@ public class Access {
|
|||
@Path(AccessPath.CONTEXTS_PATH_PART)
|
||||
@Produces(ResourceInitializer.APPLICATION_JSON_CHARSET_UTF_8)
|
||||
public String getAllContexts() throws ResourceRegistryException {
|
||||
logger.info("Requested to read all {}s", org.gcube.informationsystem.model.reference.entities.Context.NAME);
|
||||
logger.info("Requested to read all {}s", org.gcube.informationsystem.context.reference.entities.Context.NAME);
|
||||
setCalledMethodLocal(HTTPMETHOD.GET, AccessPath.CONTEXTS_PATH_PART);
|
||||
ContextManagement contextManagement = new ContextManagement();
|
||||
return contextManagement.all(false);
|
||||
|
@ -123,7 +123,7 @@ public class Access {
|
|||
if(uuid.compareTo(AccessPath.CURRENT_CONTEXT)==0){
|
||||
uuid = ContextUtility.getCurrentSecurityContext().getUUID().toString();
|
||||
}
|
||||
logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.model.reference.entities.Context.NAME, uuid);
|
||||
logger.info("Requested to read {} with id {} ", org.gcube.informationsystem.context.reference.entities.Context.NAME, uuid);
|
||||
|
||||
List<String> pathValues = new ArrayList<>();
|
||||
pathValues.add(AccessPath.CONTEXTS_PATH_PART);
|
||||
|
|
|
@ -16,7 +16,7 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD;
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
||||
|
|
|
@ -19,7 +19,7 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD;
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.resourceregistry.ResourceInitializer;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||
|
|
|
@ -12,7 +12,7 @@ import javax.ws.rs.core.Response;
|
|||
import javax.ws.rs.core.Response.Status;
|
||||
|
||||
import org.gcube.common.gxhttp.reference.GXConnection.HTTPMETHOD;
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.schema;
|
|||
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
|
@ -11,11 +11,12 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.orientechnologies.orient.core.record.impl.ODocument;
|
||||
import com.tinkerpop.blueprints.Vertex;
|
||||
import com.tinkerpop.blueprints.impls.orient.OrientEdge;
|
||||
|
@ -61,18 +62,20 @@ public class SchemaContextManagement implements SchemaManagement {
|
|||
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
|
||||
orientGraph = adminSecurityContext.getGraph(PermissionMode.WRITER);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
TypeDefinition typeDefinition = mapper.readValue(json, TypeDefinition.class);
|
||||
@SuppressWarnings("rawtypes")
|
||||
TypeDefinition<? extends TypeDefinition> typeDefinition = TypeBinder.deserializeTypeDefinition(json);
|
||||
|
||||
if(Entity.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
OrientVertex orientVertex = orientGraph.addVertex("class:" + typeDefinition.getName());
|
||||
orientVertex.setProperty(SCHEMA, json);
|
||||
orientVertex.save();
|
||||
} else if(Relation.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
String sourceClass = typeDefinition.getSourceType();
|
||||
@SuppressWarnings("rawtypes")
|
||||
String sourceClass = ((RelationTypeDefinition) typeDefinition).getSourceType();
|
||||
Vertex source = getVertex(orientGraph, sourceClass);
|
||||
|
||||
String targetClass = typeDefinition.getTargetType();
|
||||
@SuppressWarnings("rawtypes")
|
||||
String targetClass = ((RelationTypeDefinition) typeDefinition).getTargetType();
|
||||
Vertex target = getVertex(orientGraph, targetClass);
|
||||
|
||||
OrientEdge orientEdge = orientGraph.addEdge(null, source, target, typeDefinition.getName());
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.informationsystem.resourceregistry.schema;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
|
||||
|
||||
|
|
|
@ -14,7 +14,8 @@ import java.util.concurrent.Future;
|
|||
|
||||
import javax.activation.UnsupportedDataTypeException;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
|
@ -28,12 +29,11 @@ import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
|||
import org.gcube.informationsystem.resourceregistry.context.security.AdminSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeBinder.PropertyDefinition;
|
||||
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.orientechnologies.orient.core.db.ODatabaseSession;
|
||||
import com.orientechnologies.orient.core.exception.OSchemaException;
|
||||
import com.orientechnologies.orient.core.metadata.OMetadata;
|
||||
|
@ -127,7 +127,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
}
|
||||
}
|
||||
|
||||
protected static TypeDefinition getTypeDefinition(OClass oClass) throws SchemaException {
|
||||
protected static <ISM extends ISManageable> TypeDefinition<ISM> getTypeDefinition(OClass oClass) throws SchemaException {
|
||||
ODocument oDocument = ((OClassImpl) oClass).toStream();
|
||||
String json = oDocument.toJSON();
|
||||
try {
|
||||
|
@ -137,18 +137,18 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
}
|
||||
}
|
||||
|
||||
protected static String getTypeDefinitionAsString(OClass oClass) throws SchemaException {
|
||||
protected static <ISM extends ISManageable> String getTypeDefinitionAsString(OClass oClass) throws SchemaException {
|
||||
|
||||
try {
|
||||
TypeDefinition typeDefinition = getTypeDefinition(oClass);
|
||||
TypeDefinition<ISM> typeDefinition = getTypeDefinition(oClass);
|
||||
return TypeBinder.serializeTypeDefinition(typeDefinition);
|
||||
} catch(Exception e) {
|
||||
throw new SchemaException(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected List<OClass> getSuperclassesAndCheckCompliancy(ODatabaseSession oDatabaseSession,
|
||||
TypeDefinition typeDefinition, String baseType) throws SchemaException {
|
||||
protected <ISM extends ISManageable> List<OClass> getSuperclassesAndCheckCompliancy(ODatabaseSession oDatabaseSession,
|
||||
TypeDefinition<ISM> typeDefinition, String baseType) throws SchemaException {
|
||||
|
||||
Set<String> superClasses = typeDefinition.getSuperClasses();
|
||||
if(baseType != null) {
|
||||
|
@ -188,8 +188,9 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
try {
|
||||
logger.info("Trying to register {} {}", baseType.getName(), jsonSchema);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
TypeDefinition typeDefinition = mapper.readValue(jsonSchema, TypeDefinition.class);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
TypeDefinition<? extends TypeDefinition> typeDefinition = TypeBinder.deserializeTypeDefinition(jsonSchema);
|
||||
|
||||
if(typeName.compareTo(typeDefinition.getName())!=0) {
|
||||
String error = String.format("Provided type name path argument %s does not match with the type name in the definition %S. Please be coherent.", typeName, typeDefinition.getName());
|
||||
|
@ -341,7 +342,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
}
|
||||
}
|
||||
|
||||
protected String getSchema(String type, boolean includeSubtypes) throws SchemaNotFoundException, SchemaException {
|
||||
protected <ISM extends ISManageable> String getSchema(String type, boolean includeSubtypes) throws SchemaNotFoundException, SchemaException {
|
||||
ODatabaseSession oDatabaseSession = null;
|
||||
try {
|
||||
AdminSecurityContext adminSecurityContext = ContextUtility.getAdminSecurityContext();
|
||||
|
@ -351,7 +352,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
OSchema oSchema = oMetadata.getSchema();
|
||||
OClass baseOClass = getTypeSchema(oSchema, type, null);
|
||||
|
||||
List<TypeDefinition> typeDefinitions = new ArrayList<>();
|
||||
List<TypeDefinition<ISM>> typeDefinitions = new ArrayList<>();
|
||||
typeDefinitions.add(getTypeDefinition(baseOClass));
|
||||
|
||||
if(includeSubtypes) {
|
||||
|
|
|
@ -3,14 +3,14 @@ package org.gcube.informationsystem.resourceregistry.utils;
|
|||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
|
||||
import com.orientechnologies.orient.core.record.impl.ODocument;
|
||||
|
||||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class HeaderOrient extends ODocument implements org.gcube.informationsystem.model.reference.properties.Header {
|
||||
public class HeaderOrient extends ODocument implements Header {
|
||||
|
||||
public HeaderOrient() {
|
||||
super(Header.NAME);
|
||||
|
|
|
@ -9,8 +9,8 @@ import java.util.UUID;
|
|||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||
import org.gcube.common.authorization.library.provider.ClientInfo;
|
||||
import org.gcube.common.authorization.library.utils.Caller;
|
||||
import org.gcube.informationsystem.model.reference.ER;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -31,7 +31,7 @@ public class HeaderUtility {
|
|||
private static final Logger logger = LoggerFactory.getLogger(HeaderUtility.class);
|
||||
|
||||
public static String getUser() {
|
||||
String user = org.gcube.informationsystem.model.reference.properties.Header.UNKNOWN_USER;
|
||||
String user = Header.UNKNOWN_USER;
|
||||
try {
|
||||
Caller caller = AuthorizationProvider.instance.get();
|
||||
if(caller != null) {
|
||||
|
|
|
@ -3,9 +3,9 @@ package org.gcube.informationsystem.resourceregistry.utils;
|
|||
import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
|
@ -117,7 +117,7 @@ public class Utility {
|
|||
return element;
|
||||
}
|
||||
|
||||
public static <P extends Property> P getPropertyDocument(Class<P> clz, Element element, String property)
|
||||
public static <P extends BaseProperty> P getPropertyDocument(Class<P> clz, Element element, String property)
|
||||
throws ResourceRegistryException {
|
||||
try {
|
||||
ODocument oDocument = element.getProperty(property);
|
||||
|
|
|
@ -4,10 +4,10 @@ import java.io.IOException;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.impl.entities.ContextImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.context.impl.entities.ContextImpl;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.context.reference.relations.IsParentOf;
|
||||
import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.context.ContextAlreadyPresentException;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.informationsystem.resourceregistry.dbinitialization;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.ISConstants;
|
||||
import org.gcube.informationsystem.base.reference.ISConstants;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.context.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.context.security.SecurityContext.PermissionMode;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package org.gcube.informationsystem.resourceregistry.er;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
|
||||
public abstract class AbstractERManagementTest<Er extends ER> {
|
||||
|
|
|
@ -16,8 +16,8 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
|
||||
import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl;
|
||||
|
|
|
@ -22,13 +22,13 @@ import java.util.UUID;
|
|||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.gcube.informationsystem.model.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.base.impl.properties.HeaderImpl;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.impl.properties.PropagationConstraintImpl;
|
||||
import org.gcube.informationsystem.model.impl.relations.ConsistsOfImpl;
|
||||
import org.gcube.informationsystem.model.impl.relations.IsIdentifiedByImpl;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint;
|
||||
import org.gcube.informationsystem.model.reference.properties.PropagationConstraint.RemoveConstraint;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
|
@ -49,10 +49,10 @@ import org.gcube.resourcemanagement.model.impl.relations.consistsof.HasVolatileM
|
|||
import org.gcube.resourcemanagement.model.reference.entities.facets.CPUFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.ContainerStateFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.NetworkingFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.SimplePropertyFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.SoftwareFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.MemoryFacet.MemoryUnit;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.resources.EService;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.resources.HostingNode;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.consistsof.HasPersistentMemory;
|
||||
|
@ -379,9 +379,12 @@ public class SmartgearResourcesTest extends ScopedTest {
|
|||
|
||||
OperatingSystemMXBean mxbean = ManagementFactory
|
||||
.getOperatingSystemMXBean();
|
||||
@SuppressWarnings("restriction")
|
||||
com.sun.management.OperatingSystemMXBean sunmxbean = (com.sun.management.OperatingSystemMXBean) mxbean;
|
||||
@SuppressWarnings("restriction")
|
||||
long freeMemory = sunmxbean.getFreePhysicalMemorySize() / 1048576; // in
|
||||
// MB
|
||||
@SuppressWarnings("restriction")
|
||||
long totalMemory = sunmxbean.getTotalPhysicalMemorySize() / 1048576; // in
|
||||
// MB
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package org.gcube.informationsystem.resourceregistry.er.entity;
|
|||
|
||||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.resourceregistry.ScopedTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAlreadyPresentException;
|
||||
|
|
|
@ -5,17 +5,18 @@ package org.gcube.informationsystem.resourceregistry.schema;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.gcube.informationsystem.model.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.model.reference.relations.IsRelatedTo;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.TypeBinder.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.resources.Actor;
|
||||
import org.gcube.resourcemanagement.model.reference.relations.isrelatedto.Hosts;
|
||||
|
@ -36,7 +37,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test
|
||||
public void registerPropertyTypeSchema() throws Exception {
|
||||
Class<? extends Property> clz = Header.class;
|
||||
Class<? extends BaseProperty> clz = Header.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
logger.debug(json);
|
||||
//new SchemaManagementImpl().create(json, AccessType.PROPERTY);
|
||||
|
@ -59,7 +60,7 @@ public class SchemaManagementImplTest {
|
|||
public void getFacetSchema() throws Exception {
|
||||
String json = new SchemaManagementImpl().read(ContactFacet.NAME, false);
|
||||
logger.info(json);
|
||||
List<TypeDefinition> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json);
|
||||
List<TypeDefinition<ContactFacet>> typeDefinitions = TypeBinder.deserializeTypeDefinitions(json);
|
||||
logger.info("{}", typeDefinitions);
|
||||
|
||||
}
|
||||
|
@ -101,12 +102,12 @@ public class SchemaManagementImplTest {
|
|||
boolean includeSubTypes = true;
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
String list = schemaManagement.read(Property.NAME, includeSubTypes);
|
||||
logger.debug("{} list : {}", Property.NAME, list);
|
||||
String list = schemaManagement.read(BaseProperty.NAME, includeSubTypes);
|
||||
logger.debug("{} list : {}", BaseProperty.NAME, list);
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<TypeDefinition> typeDefinitions = mapper.readValue(list,
|
||||
new TypeReference<List<TypeDefinition>>() {
|
||||
List<TypeDefinition<BaseProperty>> typeDefinitions = mapper.readValue(list,
|
||||
new TypeReference<List<TypeDefinition<BaseProperty>>>() {
|
||||
});
|
||||
logger.debug("{}", typeDefinitions);
|
||||
|
||||
|
|
Loading…
Reference in New Issue