Reorganized model as following
Element - EntityElement - Entity - Resource - Facet - Context - EntityType - ResourceType (3 lists of PropertyDefinition, LinkedFacet, LinkedResource) - FacetType (1 list of PropertyDefinition) - RelationElement - Relation - IsRelatedTo - ConsistsOf - IsParentOf - RelationType - IsRelatedTo (1 list of PropertyDefinition) - ConsistsOf (1 list of PropertyDefinition) - PropertyElement - Property - Header - PropagationConstraint - Encrypted - PropertyType (1 list of PropertyDefinition) - PropertyDefinition - LinkedEntity - LinkedFacet - LinkedResource
This commit is contained in:
parent
58488f743e
commit
241b6269bc
|
@ -19,7 +19,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecur
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -224,7 +224,7 @@ public class ContextUtility {
|
|||
}
|
||||
|
||||
OResult oResult = resultSet.next();
|
||||
OVertex context = ERManagement.getElementFromOptional(oResult.getVertex());
|
||||
OVertex context = ElementManagement.getElementFromOptional(oResult.getVertex());
|
||||
|
||||
logger.trace("Context Representing Vertex : {}", Utility.toJsonString(context, true));
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.relations.IsParentOfManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.entities.BaseEntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -320,7 +320,7 @@ public class ContextManagement extends BaseEntityManagement<Context> {
|
|||
move(newParentContextManagement, false);
|
||||
}
|
||||
|
||||
element = (OVertex) ERManagement.updateProperties(oClass, getElement(), jsonNode, ignoreKeys,
|
||||
element = (OVertex) ElementManagement.updateProperties(oClass, getElement(), jsonNode, ignoreKeys,
|
||||
ignoreStartWithKeys);
|
||||
|
||||
ContextUtility.getInstance().removeFromCache(uuid, (nameChanged && !parentChanged));
|
||||
|
|
|
@ -15,10 +15,10 @@ import java.util.UUID;
|
|||
import org.gcube.common.encryption.SymmetricKey;
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.ISConstants;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
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.base.reference.Element;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.properties.Property;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
|
@ -26,19 +26,19 @@ import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecur
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.security.ContextSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SchemaSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.properties.PropertyTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
import org.gcube.informationsystem.utils.discovery.ISMDiscovery;
|
||||
import org.gcube.informationsystem.utils.discovery.RegistrationProvider;
|
||||
import org.gcube.informationsystem.utils.discovery.SchemaAction;
|
||||
|
@ -228,39 +228,39 @@ public class DatabaseEnvironment {
|
|||
schemaSecurityContext.create();
|
||||
|
||||
|
||||
List<Class<? extends ISManageable>> definitionToBeCreated = new ArrayList<>();
|
||||
definitionToBeCreated.add(BaseProperty.class);
|
||||
List<Class<? extends Element>> definitionToBeCreated = new ArrayList<>();
|
||||
definitionToBeCreated.add(PropertyElement.class);
|
||||
definitionToBeCreated.add(Property.class);
|
||||
definitionToBeCreated.add(Header.class);
|
||||
definitionToBeCreated.add(PropertyDefinition.class);
|
||||
definitionToBeCreated.add(PropertyTypeDefinition.class);
|
||||
definitionToBeCreated.add(ResourceEntryDefinition.class);
|
||||
definitionToBeCreated.add(BaseEntity.class);
|
||||
definitionToBeCreated.add(EntityTypeDefinition.class);
|
||||
definitionToBeCreated.add(FacetTypeDefinition.class);
|
||||
definitionToBeCreated.add(ResourceTypeDefinition.class);
|
||||
definitionToBeCreated.add(BaseRelation.class);
|
||||
definitionToBeCreated.add(RelationTypeDefinition.class);
|
||||
definitionToBeCreated.add(IsRelatedToTypeDefinition.class);
|
||||
definitionToBeCreated.add(ConsistsOfTypeDefinition.class);
|
||||
definitionToBeCreated.add(PropertyType.class);
|
||||
definitionToBeCreated.add(LinkedEntity.class);
|
||||
definitionToBeCreated.add(EntityElement.class);
|
||||
definitionToBeCreated.add(EntityType.class);
|
||||
definitionToBeCreated.add(FacetType.class);
|
||||
definitionToBeCreated.add(ResourceType.class);
|
||||
definitionToBeCreated.add(RelationElement.class);
|
||||
definitionToBeCreated.add(RelationType.class);
|
||||
definitionToBeCreated.add(IsRelatedToType.class);
|
||||
definitionToBeCreated.add(ConsistsOfType.class);
|
||||
|
||||
SchemaAction schemaAction = new SchemaActionImpl();
|
||||
for(Class<? extends ISManageable> clz : definitionToBeCreated) {
|
||||
for(Class<? extends Element> clz : definitionToBeCreated) {
|
||||
|
||||
if(BaseProperty.class.isAssignableFrom(clz)) {
|
||||
schemaAction.managePropertyClass((Class<? extends BaseProperty>) clz);
|
||||
} else if(BaseEntity.class.isAssignableFrom(clz)) {
|
||||
schemaAction.manageEntityClass((Class<? extends BaseEntity>) clz);
|
||||
} else if(BaseRelation.class.isAssignableFrom(clz)) {
|
||||
schemaAction.manageRelationClass((Class<? extends BaseRelation<? extends BaseEntity, ? extends BaseEntity>>) clz);
|
||||
if(PropertyElement.class.isAssignableFrom(clz)) {
|
||||
schemaAction.managePropertyClass((Class<? extends PropertyElement>) clz);
|
||||
} else if(EntityElement.class.isAssignableFrom(clz)) {
|
||||
schemaAction.manageEntityClass((Class<? extends EntityElement>) clz);
|
||||
} else if(RelationElement.class.isAssignableFrom(clz)) {
|
||||
schemaAction.manageRelationClass((Class<? extends RelationElement<? extends EntityElement, ? extends EntityElement>>) clz);
|
||||
}
|
||||
}
|
||||
|
||||
List<Class<? extends ISManageable>> schemaToBeCreated = new ArrayList<>();
|
||||
List<Class<? extends Element>> schemaToBeCreated = new ArrayList<>();
|
||||
schemaToBeCreated.add(Property.class);
|
||||
schemaToBeCreated.add(Header.class);
|
||||
for(Class<? extends ISManageable> clz : schemaToBeCreated) {
|
||||
ERManagement<? extends OElement> erManagement = new PropertyTypeDefinitionManagement();
|
||||
for(Class<? extends Element> clz : schemaToBeCreated) {
|
||||
ElementManagement<? extends OElement> erManagement = new PropertyTypeDefinitionManagement();
|
||||
erManagement.setJson(TypeBinder.serializeType(clz));
|
||||
erManagement.create();
|
||||
}
|
||||
|
@ -273,7 +273,7 @@ public class DatabaseEnvironment {
|
|||
|
||||
AccessType[] accessTypes = AccessType.values();
|
||||
for(AccessType accessType : accessTypes) {
|
||||
Class<ISManageable> clz = accessType.getTypeClass();
|
||||
Class<Element> clz = accessType.getTypeClass();
|
||||
packages.add(clz.getPackage());
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package org.gcube.informationsystem.resourceregistry.dbinitialization;
|
||||
|
||||
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.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
|
@ -25,7 +25,7 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
private static Logger logger = LoggerFactory.getLogger(SchemaActionImpl.class);
|
||||
|
||||
@Override
|
||||
public <R extends BaseRelation<? extends BaseEntity,? extends BaseEntity>> void manageRelationClass(Class<R> r)
|
||||
public <R extends RelationElement<? extends EntityElement,? extends EntityElement>> void manageRelationClass(Class<R> r)
|
||||
throws Exception {
|
||||
try {
|
||||
SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
|
||||
|
@ -37,18 +37,18 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
} else if(IsRelatedTo.class.isAssignableFrom(r)) {
|
||||
schemaManagement.create(json, AccessType.IS_RELATED_TO);
|
||||
} else {
|
||||
schemaManagement.create(json, AccessType.BASE_RELATION);
|
||||
schemaManagement.create(json, AccessType.RELATION_ELEMENT);
|
||||
}
|
||||
} catch(SchemaAlreadyPresentException sape) {
|
||||
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r));
|
||||
} catch(Exception ex) {
|
||||
logger.error("Error creating schema for {} {}: {}", BaseRelation.NAME, r.getSimpleName(), ex.getMessage());
|
||||
logger.error("Error creating schema for {} {}: {}", RelationElement.NAME, r.getSimpleName(), ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <E extends BaseEntity> void manageEntityClass(Class<E> e) throws Exception {
|
||||
public <E extends EntityElement> void manageEntityClass(Class<E> e) throws Exception {
|
||||
try {
|
||||
SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
|
||||
schemaManagement.setTypeName(TypeBinder.getType(e));
|
||||
|
@ -59,18 +59,18 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
} else if(Resource.class.isAssignableFrom(e)) {
|
||||
schemaManagement.create(json, AccessType.RESOURCE);
|
||||
} else {
|
||||
schemaManagement.create(json, AccessType.BASE_ENTITY);
|
||||
schemaManagement.create(json, AccessType.ENTITY_ELEMENT);
|
||||
}
|
||||
} catch(SchemaAlreadyPresentException sape) {
|
||||
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e));
|
||||
} catch(Exception ex) {
|
||||
logger.error("Error creating schema for {} {}: {}", BaseEntity.NAME, e.getSimpleName(), ex.getMessage());
|
||||
logger.error("Error creating schema for {} {}: {}", EntityElement.NAME, e.getSimpleName(), ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P extends BaseProperty> void managePropertyClass(Class<P> p) throws Exception {
|
||||
public <P extends PropertyElement> void managePropertyClass(Class<P> p) throws Exception {
|
||||
try {
|
||||
SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
|
||||
schemaManagement.setTypeName(TypeBinder.getType(p));
|
||||
|
@ -82,12 +82,12 @@ public class SchemaActionImpl implements SchemaAction {
|
|||
}
|
||||
schemaManagement.create(json, AccessType.PROPERTY);
|
||||
}else {
|
||||
schemaManagement.create(json, AccessType.BASE_PROPERTY);
|
||||
schemaManagement.create(json, AccessType.PROPERTY_ELEMENT);
|
||||
}
|
||||
} catch(SchemaAlreadyPresentException sape) {
|
||||
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(p));
|
||||
} catch(Exception ex) {
|
||||
logger.error("Error creating schema for {} {}: {}", BaseProperty.NAME, p.getSimpleName(), ex.getMessage());
|
||||
logger.error("Error creating schema for {} {}: {}", PropertyElement.NAME, p.getSimpleName(), ex.getMessage());
|
||||
throw ex;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import javax.activation.UnsupportedDataTypeException;
|
|||
|
||||
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.Element;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
|
||||
|
@ -58,11 +58,11 @@ import com.tinkerpop.blueprints.util.StringFactory;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class ERManagement<El extends OElement> {
|
||||
public abstract class ElementManagement<El extends OElement> {
|
||||
|
||||
protected Logger logger = LoggerFactory.getLogger(this.getClass());
|
||||
|
||||
private static Logger staticLogger = LoggerFactory.getLogger(ERManagement.class);
|
||||
private static Logger staticLogger = LoggerFactory.getLogger(ElementManagement.class);
|
||||
|
||||
public final String AT = "@";
|
||||
public final String UNDERSCORE = "_";
|
||||
|
@ -114,7 +114,7 @@ public abstract class ERManagement<El extends OElement> {
|
|||
this.workingContext = workingContext;
|
||||
}
|
||||
|
||||
protected ERManagement(AccessType accessType) {
|
||||
protected ElementManagement(AccessType accessType) {
|
||||
this.accessType = accessType;
|
||||
|
||||
this.ignoreKeys = new HashSet<String>();
|
||||
|
@ -176,7 +176,7 @@ public abstract class ERManagement<El extends OElement> {
|
|||
if(element != null) {
|
||||
oClass = getOClass(element);
|
||||
} else {
|
||||
oClass = ERManagementUtility.getTypeSchema(elementType, accessType);
|
||||
oClass = ElementManagementUtility.getTypeSchema(elementType, accessType);
|
||||
}
|
||||
}
|
||||
return oClass;
|
||||
|
@ -757,8 +757,8 @@ public abstract class ERManagement<El extends OElement> {
|
|||
}
|
||||
|
||||
public static String getClassProperty(JsonNode jsonNode) {
|
||||
if(jsonNode.has(ISManageable.CLASS_PROPERTY)) {
|
||||
return jsonNode.get(ISManageable.CLASS_PROPERTY).asText();
|
||||
if(jsonNode.has(Element.CLASS_PROPERTY)) {
|
||||
return jsonNode.get(Element.CLASS_PROPERTY).asText();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -1047,12 +1047,12 @@ public abstract class ERManagement<El extends OElement> {
|
|||
|
||||
OClass oClass = getOClass();
|
||||
String type = oClass.getName();
|
||||
objectNode.put(ISManageable.CLASS_PROPERTY, type);
|
||||
objectNode.put(Element.CLASS_PROPERTY, type);
|
||||
|
||||
Collection<String> superClasses = getSuperclasses();
|
||||
ArrayNode arrayNode = objectMapper.valueToTree(superClasses);
|
||||
|
||||
objectNode.replace(ISManageable.SUPERCLASSES_PROPERTY, arrayNode);
|
||||
objectNode.replace(Element.SUPERCLASSES_PROPERTY, arrayNode);
|
||||
|
||||
return objectNode;
|
||||
} catch(ResourceRegistryException e) {
|
|
@ -39,13 +39,13 @@ import com.orientechnologies.orient.core.record.OVertex;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public class ERManagementUtility {
|
||||
public class ElementManagementUtility {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(EntityManagement.class);
|
||||
private static Logger logger = LoggerFactory.getLogger(ElementManagementUtility.class);
|
||||
|
||||
public static AccessType getBaseAccessType(String type) throws ResourceRegistryException {
|
||||
|
||||
OClass oClass = ERManagementUtility.getTypeSchema(type, null);
|
||||
OClass oClass = ElementManagementUtility.getTypeSchema(type, null);
|
||||
|
||||
if(oClass.isSubClassOf(Resource.NAME)) {
|
||||
return AccessType.RESOURCE;
|
||||
|
@ -65,10 +65,10 @@ public class ERManagementUtility {
|
|||
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagement(String type) throws ResourceRegistryException {
|
||||
public static ElementManagement getERManagement(String type) throws ResourceRegistryException {
|
||||
|
||||
OClass oClass = ERManagementUtility.getTypeSchema(type, null);
|
||||
ERManagement erManagement = null;
|
||||
OClass oClass = ElementManagementUtility.getTypeSchema(type, null);
|
||||
ElementManagement erManagement = null;
|
||||
|
||||
if(oClass.isSubClassOf(Resource.NAME)) {
|
||||
erManagement = new ResourceManagement();
|
||||
|
@ -88,7 +88,7 @@ public class ERManagementUtility {
|
|||
return erManagement;
|
||||
}
|
||||
|
||||
public static ERManagement<?> getERManagement(SecurityContext workingContext, ODatabaseDocument orientGraph,
|
||||
public static ElementManagement<?> getERManagement(SecurityContext workingContext, ODatabaseDocument orientGraph,
|
||||
OElement element) throws ResourceRegistryException {
|
||||
if(element instanceof OVertex) {
|
||||
return getEntityManagement(workingContext, orientGraph, (OVertex) element);
|
||||
|
@ -125,7 +125,7 @@ public class ERManagementUtility {
|
|||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
public static ERManagement getERManagementFromUUID(SecurityContext workingContext, ODatabaseDocument orientGraph,
|
||||
public static ElementManagement getERManagementFromUUID(SecurityContext workingContext, ODatabaseDocument orientGraph,
|
||||
UUID uuid) throws ResourceRegistryException {
|
||||
OElement element;
|
||||
try {
|
||||
|
@ -153,7 +153,7 @@ public class ERManagementUtility {
|
|||
|
||||
OClass oClass = null;
|
||||
try {
|
||||
oClass = ERManagement.getOClass(vertex);
|
||||
oClass = ElementManagement.getOClass(vertex);
|
||||
} catch(Exception e) {
|
||||
String error = String.format("Unable to detect type of %s. %s", vertex.toString(),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
|
@ -189,7 +189,7 @@ public class ERManagementUtility {
|
|||
OEdge.class.getSimpleName() + "instance is null. " + Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
}
|
||||
|
||||
OClass oClass = ERManagement.getOClass(edge);
|
||||
OClass oClass = ElementManagement.getOClass(edge);
|
||||
|
||||
RelationManagement relationManagement = null;
|
||||
if(oClass.isSubClassOf(ConsistsOf.NAME)) {
|
|
@ -4,14 +4,14 @@ import java.util.HashMap;
|
|||
import java.util.Map;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.EntityAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.relations.BaseRelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
|
||||
|
@ -27,7 +27,7 @@ import com.orientechnologies.orient.core.record.OVertex;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManagement<OVertex> {
|
||||
public abstract class BaseEntityManagement<E extends EntityElement> extends ElementManagement<OVertex> {
|
||||
|
||||
/**
|
||||
* Provide a cache edge-internal-id -> RelationManagement
|
||||
|
@ -39,7 +39,7 @@ public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManag
|
|||
protected BaseEntityManagement(AccessType accessType) {
|
||||
super(accessType);
|
||||
|
||||
this.ignoreKeys.add(BaseEntity.HEADER_PROPERTY);
|
||||
this.ignoreKeys.add(EntityElement.HEADER_PROPERTY);
|
||||
|
||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_IN_PREFIX.toLowerCase());
|
||||
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_OUT_PREFIX.toLowerCase());
|
||||
|
@ -67,7 +67,7 @@ public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManag
|
|||
String id = edge.getIdentity().toString();
|
||||
BaseRelationManagement relationManagement = relationManagements.get(id);
|
||||
if(relationManagement == null) {
|
||||
relationManagement = ERManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge);
|
||||
relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge);
|
||||
relationManagements.put(id, relationManagement);
|
||||
}
|
||||
return relationManagement;
|
||||
|
@ -134,7 +134,7 @@ public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManag
|
|||
|
||||
} catch(NotFoundException e) {
|
||||
try {
|
||||
OElement el = ERManagementUtility.getAnyElementByUUID(uuid);
|
||||
OElement el = ElementManagementUtility.getAnyElementByUUID(uuid);
|
||||
String error = String.format("UUID %s is already used by another %s. This is not allowed.",
|
||||
uuid.toString(),
|
||||
(el instanceof OVertex) ? org.gcube.informationsystem.model.reference.entities.Entity.NAME :
|
||||
|
@ -153,7 +153,7 @@ public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManag
|
|||
if(accessType == AccessType.RESOURCE) {
|
||||
// Facet and relation are created in calling method
|
||||
} else {
|
||||
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
}
|
||||
|
||||
logger.info("Created {} is {}", OVertex.class.getSimpleName(),
|
||||
|
|
|
@ -5,7 +5,7 @@ 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.Element;
|
||||
import org.gcube.informationsystem.model.impl.properties.EncryptedImpl;
|
||||
import org.gcube.informationsystem.model.reference.properties.Encrypted;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
|
@ -13,8 +13,8 @@ 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;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.EncryptedOrient;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -50,13 +50,13 @@ public class BasePropertyManagement {
|
|||
|
||||
public static ODocument getPropertyDocument(JsonNode jsonNode) throws ResourceRegistryException {
|
||||
ODocument oDocument = null;
|
||||
if(jsonNode.has(ISManageable.CLASS_PROPERTY)) {
|
||||
if(jsonNode.has(Element.CLASS_PROPERTY)) {
|
||||
// Complex type
|
||||
String type = ERManagement.getClassProperty(jsonNode);
|
||||
String type = ElementManagement.getClassProperty(jsonNode);
|
||||
OClass oClass = null;
|
||||
|
||||
try {
|
||||
oClass = ERManagementUtility.getTypeSchema(type, AccessType.BASE_PROPERTY);
|
||||
oClass = ElementManagementUtility.getTypeSchema(type, AccessType.PROPERTY_ELEMENT);
|
||||
} catch(SchemaNotFoundException e) {
|
||||
throw e;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class BasePropertyManagement {
|
|||
return jsonNode;
|
||||
}
|
||||
|
||||
OClass oClass = ERManagementUtility.getTypeSchema(type, AccessType.BASE_PROPERTY);
|
||||
OClass oClass = ElementManagementUtility.getTypeSchema(type, AccessType.PROPERTY_ELEMENT);
|
||||
|
||||
/*
|
||||
* In case it is an Encrypted type the value is encrypted with the DB Key
|
||||
|
|
|
@ -3,13 +3,13 @@ package org.gcube.informationsystem.resourceregistry.instances.base.relations;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.entities.BaseEntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
|
@ -24,16 +24,16 @@ import com.orientechnologies.orient.core.record.OVertex;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<? extends BaseEntity>, TEM extends BaseEntityManagement<? extends BaseEntity>>
|
||||
extends ERManagement<OEdge> {
|
||||
public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<? extends EntityElement>, TEM extends BaseEntityManagement<? extends EntityElement>>
|
||||
extends ElementManagement<OEdge> {
|
||||
|
||||
protected final Class<? extends BaseEntity> sourceEntityClass;
|
||||
protected final Class<? extends BaseEntity> targetEntityClass;
|
||||
protected final Class<? extends EntityElement> sourceEntityClass;
|
||||
protected final Class<? extends EntityElement> targetEntityClass;
|
||||
|
||||
protected SEM sourceEntityManagement;
|
||||
protected TEM targetEntityManagement;
|
||||
|
||||
protected BaseRelationManagement(AccessType accessType, Class<? extends BaseEntity> sourceEntityClass, Class<? extends BaseEntity> targetEntityClass) {
|
||||
protected BaseRelationManagement(AccessType accessType, Class<? extends EntityElement> sourceEntityClass, Class<? extends EntityElement> targetEntityClass) {
|
||||
super(accessType);
|
||||
|
||||
this.ignoreKeys.add(Relation.HEADER_PROPERTY);
|
||||
|
@ -51,7 +51,7 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
|
|||
this.targetEntityManagement = null;
|
||||
}
|
||||
|
||||
protected BaseRelationManagement(AccessType accessType, Class<? extends BaseEntity> sourceEntityClass, Class<? extends BaseEntity> targetEntityClass, SecurityContext workingContext, ODatabaseDocument orientGraph) {
|
||||
protected BaseRelationManagement(AccessType accessType, Class<? extends EntityElement> sourceEntityClass, Class<? extends EntityElement> targetEntityClass, SecurityContext workingContext, ODatabaseDocument orientGraph) {
|
||||
this(accessType, sourceEntityClass, targetEntityClass);
|
||||
this.oDatabaseDocument = orientGraph;
|
||||
setWorkingContext(workingContext);
|
||||
|
@ -100,12 +100,12 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
|
|||
|
||||
try {
|
||||
if(includeSource) {
|
||||
BaseEntityManagement<? extends BaseEntity> sourceEntityManagement = getSourceEntityManagement();
|
||||
BaseEntityManagement<? extends EntityElement> sourceEntityManagement = getSourceEntityManagement();
|
||||
((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelfOnly());
|
||||
}
|
||||
|
||||
if(includeTarget) {
|
||||
BaseEntityManagement<? extends BaseEntity> targetEntityManagement = getTargetEntityManagement();
|
||||
BaseEntityManagement<? extends EntityElement> targetEntityManagement = getTargetEntityManagement();
|
||||
((ObjectNode) relation).replace(Relation.TARGET_PROPERTY, targetEntityManagement.serializeAsJson());
|
||||
}
|
||||
|
||||
|
@ -172,7 +172,7 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
|
|||
|
||||
element = oDatabaseDocument.newEdge(source, target, elementType);
|
||||
|
||||
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
|
|||
logger.debug("Trying to update {} : {}", elementType, jsonNode);
|
||||
|
||||
OEdge edge = getElement();
|
||||
ERManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
|
||||
if(accessType.compareTo(AccessType.CONSISTS_OF) == 0) {
|
||||
JsonNode target = jsonNode.get(Relation.TARGET_PROPERTY);
|
||||
|
|
|
@ -7,7 +7,7 @@ import java.util.Map;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.entities.BaseEntity;
|
||||
import org.gcube.informationsystem.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
@ -22,8 +22,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.Entity
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.entities.BaseEntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
|
@ -46,7 +46,7 @@ import com.orientechnologies.orient.core.sql.executor.OResultSet;
|
|||
/**
|
||||
* @author Luca Frosini (ISTI - CNR)
|
||||
*/
|
||||
public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityManagement<E> {
|
||||
public abstract class EntityManagement<E extends EntityElement> extends BaseEntityManagement<E> {
|
||||
|
||||
/**
|
||||
* Provide a cache edge-internal-id -> RelationManagement
|
||||
|
@ -86,7 +86,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
String id = edge.getIdentity().toString();
|
||||
RelationManagement relationManagement = relationManagements.get(id);
|
||||
if(relationManagement == null) {
|
||||
relationManagement = ERManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge);
|
||||
relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge);
|
||||
relationManagements.put(id, relationManagement);
|
||||
}
|
||||
return relationManagement;
|
||||
|
@ -153,7 +153,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
|
||||
} catch(NotFoundException e) {
|
||||
try {
|
||||
OElement el = ERManagementUtility.getAnyElementByUUID(uuid);
|
||||
OElement el = ElementManagementUtility.getAnyElementByUUID(uuid);
|
||||
String error = String.format("UUID %s is already used by another %s. This is not allowed.",
|
||||
uuid.toString(), (el instanceof OVertex) ? Entity.NAME : Relation.NAME);
|
||||
throw getSpecificERAvailableInAnotherContextException(error);
|
||||
|
@ -170,7 +170,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
if(accessType == AccessType.RESOURCE) {
|
||||
// Facet and relation are created in calling method
|
||||
} else {
|
||||
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
}
|
||||
|
||||
logger.info("Created {} is {}", OVertex.class.getSimpleName(),
|
||||
|
@ -227,7 +227,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
|
||||
Iterable<ODocument> iterable = oDatabaseDocument.browseClass(elementType, polymorphic);
|
||||
for(ODocument vertex : iterable) {
|
||||
EntityManagement<?> entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
EntityManagement<?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
oDatabaseDocument, (OVertex) vertex);
|
||||
try {
|
||||
JsonNode jsonNode = entityManagement.serializeAsJson();
|
||||
|
@ -252,10 +252,10 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
Iterable<?> references = null;
|
||||
|
||||
if(referenceUUID != null) {
|
||||
OElement element = ERManagementUtility.getAnyElementByUUID(referenceUUID);
|
||||
OElement element = ElementManagementUtility.getAnyElementByUUID(referenceUUID);
|
||||
if(element instanceof OVertex) {
|
||||
@SuppressWarnings("unchecked")
|
||||
EntityManagement<Entity> entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
EntityManagement<Entity> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
oDatabaseDocument, (OVertex) element);
|
||||
|
||||
String elementType = entityManagement.getElementType();
|
||||
|
@ -302,7 +302,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
continue;
|
||||
}
|
||||
|
||||
OClass oClass = ERManagement.getOClass(vertex);
|
||||
OClass oClass = ElementManagement.getOClass(vertex);
|
||||
if(polymorphic && oClass.isSubClassOf(elementType)) {
|
||||
// OK
|
||||
} else {
|
||||
|
@ -311,7 +311,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
}
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
EntityManagement entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
EntityManagement entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
oDatabaseDocument, vertex);
|
||||
try {
|
||||
if(referenceUUID!=null && entityManagement.getUUID().compareTo(referenceUUID) == 0) {
|
||||
|
@ -392,7 +392,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
|
||||
while(resultSet.hasNext()) {
|
||||
OResult oResult = resultSet.next();
|
||||
OElement element = ERManagement.getElementFromOptional(oResult.getElement());
|
||||
OElement element = ElementManagement.getElementFromOptional(oResult.getElement());
|
||||
|
||||
if(polymorphic) {
|
||||
OClass oClass = null;
|
||||
|
@ -400,7 +400,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
if(element instanceof OEdge) {
|
||||
continue;
|
||||
}
|
||||
oClass = ERManagement.getOClass(element);
|
||||
oClass = ElementManagement.getOClass(element);
|
||||
} catch(Exception e) {
|
||||
String error = String.format("Unable to detect type of %s. %s", element.toString(),
|
||||
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
|
||||
|
@ -417,7 +417,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
OVertex vertex = (OVertex) element;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
EntityManagement entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
EntityManagement entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
oDatabaseDocument, vertex);
|
||||
try {
|
||||
if(constraint.containsKey(Entity.HEADER_PROPERTY + "." + Header.UUID_PROPERTY)) {
|
||||
|
@ -446,13 +446,13 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
|
|||
try {
|
||||
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.READER);
|
||||
|
||||
AccessType relationAccessType = ERManagementUtility.getBaseAccessType(relationType);
|
||||
AccessType relationAccessType = ElementManagementUtility.getBaseAccessType(relationType);
|
||||
if(relationAccessType != AccessType.IS_RELATED_TO && relationAccessType != AccessType.CONSISTS_OF) {
|
||||
String error = String.format("%s must be a relation type", relationType);
|
||||
throw new ResourceRegistryException(error);
|
||||
}
|
||||
|
||||
AccessType referenceAccessType = ERManagementUtility.getBaseAccessType(referenceType);
|
||||
AccessType referenceAccessType = ElementManagementUtility.getBaseAccessType(referenceType);
|
||||
if(referenceAccessType != AccessType.RESOURCE && referenceAccessType != AccessType.FACET) {
|
||||
String error = String.format("%s must be a en entity type", referenceType);
|
||||
throw new ResourceRegistryException(error);
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetAvailableInAnotherContextException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
|
@ -60,7 +60,7 @@ public class FacetManagement extends EntityManagement<Facet> {
|
|||
@Override
|
||||
protected OVertex reallyUpdate() throws FacetNotFoundException, ResourceRegistryException {
|
||||
OVertex facet = getElement();
|
||||
facet = (OVertex) ERManagement.updateProperties(oClass, facet, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
facet = (OVertex) ElementManagement.updateProperties(oClass, facet, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
return facet;
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.Rela
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.relations.BaseRelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.EntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||
|
@ -145,7 +145,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
ResourceManagement resourceManagement = null;
|
||||
|
||||
if(sourceResource == null) {
|
||||
resourceManagement = (ResourceManagement) ERManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
resourceManagement = (ResourceManagement) ElementManagementUtility.getEntityManagement(getWorkingContext(),
|
||||
oDatabaseDocument, source);
|
||||
if(this instanceof IsRelatedToManagement) {
|
||||
sourceResource = resourceManagement.serializeAsJson();
|
||||
|
@ -243,7 +243,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
logger.debug("Trying to update {} : {}", elementType, jsonNode);
|
||||
|
||||
OEdge edge = getElement();
|
||||
ERManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
|
||||
if(accessType.compareTo(AccessType.CONSISTS_OF) == 0) {
|
||||
JsonNode target = jsonNode.get(Relation.TARGET_PROPERTY);
|
||||
|
@ -471,7 +471,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
|
|||
continue;
|
||||
}
|
||||
|
||||
RelationManagement<T> relationManagement = ERManagementUtility.getRelationManagement(getWorkingContext(),
|
||||
RelationManagement<T> relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(),
|
||||
oDatabaseDocument, edge);
|
||||
visitedSourceResources = relationManagement.fullSerialize(visitedSourceResources);
|
||||
}
|
||||
|
|
|
@ -9,8 +9,8 @@ import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -68,7 +68,7 @@ public class QueryImpl implements Query {
|
|||
|
||||
while(resultSet.hasNext()) {
|
||||
OResult oResult = resultSet.next();
|
||||
OElement element = ERManagement.getElementFromOptional(oResult.getElement());
|
||||
OElement element = ElementManagement.getElementFromOptional(oResult.getElement());
|
||||
|
||||
try {
|
||||
JsonNode jsonNode = null;
|
||||
|
@ -76,7 +76,7 @@ public class QueryImpl implements Query {
|
|||
jsonNode = Utility.toJsonNode(element, false);
|
||||
} else {
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
|
||||
element);
|
||||
jsonNode = erManagement.serializeAsJson();
|
||||
}
|
||||
|
|
|
@ -35,8 +35,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.query.Query;
|
||||
import org.gcube.informationsystem.resourceregistry.query.QueryImpl;
|
||||
|
@ -182,7 +182,7 @@ public class Access {
|
|||
setCalledMethodLocal(HTTPMETHOD.GET, pathValues, map);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
return erManagement.all(polymorphic);
|
||||
}
|
||||
|
||||
|
@ -206,7 +206,7 @@ public class Access {
|
|||
setCalledMethodLocal(HTTPMETHOD.HEAD, pathValues);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
|
||||
try {
|
||||
erManagement.setUUID(UUID.fromString(uuid));
|
||||
|
@ -246,7 +246,7 @@ public class Access {
|
|||
setCalledMethodLocal(HTTPMETHOD.GET, pathValues);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
|
||||
erManagement.setElementType(type);
|
||||
erManagement.setUUID(UUID.fromString(uuid));
|
||||
|
@ -338,7 +338,7 @@ public class Access {
|
|||
pathValues.add(referenceType);
|
||||
setCalledMethodLocal(HTTPMETHOD.GET, pathValues);
|
||||
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(resourcetype);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(resourcetype);
|
||||
|
||||
if(erManagement instanceof ResourceManagement) {
|
||||
UUID refereceUUID = null;
|
||||
|
|
|
@ -27,8 +27,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundExcep
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class InstancesManager {
|
|||
setCalledMethod(HTTPMETHOD.GET, type, map);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
return erManagement.all(polymorphic);
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public class InstancesManager {
|
|||
setCalledMethod(HTTPMETHOD.HEAD, type, true);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
|
||||
try {
|
||||
erManagement.setUUID(UUID.fromString(uuid));
|
||||
|
@ -131,7 +131,7 @@ public class InstancesManager {
|
|||
setCalledMethod(HTTPMETHOD.GET, type, true);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
|
||||
erManagement.setElementType(type);
|
||||
erManagement.setUUID(UUID.fromString(uuid));
|
||||
|
@ -156,7 +156,7 @@ public class InstancesManager {
|
|||
setCalledMethod(HTTPMETHOD.PUT, type, true);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
erManagement.setUUID(UUID.fromString(uuid));
|
||||
erManagement.setElementType(type);
|
||||
erManagement.setJson(json);
|
||||
|
@ -177,7 +177,7 @@ public class InstancesManager {
|
|||
setCalledMethod(HTTPMETHOD.DELETE, type, true);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
erManagement.setUUID(UUID.fromString(uuid));
|
||||
erManagement.delete();
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.types.SchemaManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.SchemaManagementImpl;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
|
@ -85,7 +85,7 @@ public class SchemaManager {
|
|||
throw new ResourceRegistryException("No superclasses defined");
|
||||
}
|
||||
for(String superClass : superClasses) {
|
||||
accessType = ERManagementUtility.getBaseAccessType(superClass);
|
||||
accessType = ElementManagementUtility.getBaseAccessType(superClass);
|
||||
break;
|
||||
}
|
||||
} catch (ResourceRegistryException e) {
|
||||
|
|
|
@ -18,8 +18,8 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.context.Conte
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.resource.ResourceNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
|
||||
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class SharingManagement {
|
|||
setCalledMethod(HTTPMETHOD.PUT, type);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(id);
|
||||
|
@ -94,7 +94,7 @@ public class SharingManagement {
|
|||
setCalledMethod(HTTPMETHOD.DELETE, type);
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
UUID uuid = null;
|
||||
try {
|
||||
uuid = UUID.fromString(id);
|
||||
|
|
|
@ -12,9 +12,9 @@ import java.util.Set;
|
|||
import javax.activation.UnsupportedDataTypeException;
|
||||
|
||||
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.base.reference.entities.EntityElement;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.base.reference.relations.RelationElement;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
import org.gcube.informationsystem.model.reference.entities.Resource;
|
||||
|
@ -29,24 +29,24 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.entities.FacetTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.properties.PropertyTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.relations.ConsistsOfTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.relations.IsRelatedToTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.types.Type;
|
||||
import org.gcube.informationsystem.types.OrientDBType;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||
import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -134,7 +134,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
|
||||
private TypeDefinition getTypeDefinition(OClass oClass) throws SchemaException {
|
||||
try {
|
||||
ERManagement<? extends OElement> erManagement = null;
|
||||
ElementManagement<? extends OElement> erManagement = null;
|
||||
|
||||
if(oClass.isSubClassOf(Property.NAME)) {
|
||||
erManagement = new PropertyTypeDefinitionManagement();
|
||||
|
@ -212,19 +212,19 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
|
||||
static {
|
||||
baseTypes = new HashSet<String>();
|
||||
baseTypes.add(BaseProperty.NAME);
|
||||
baseTypes.add(BaseEntity.NAME);
|
||||
baseTypes.add(BaseRelation.NAME);
|
||||
baseTypes.add(PropertyElement.NAME);
|
||||
baseTypes.add(EntityElement.NAME);
|
||||
baseTypes.add(RelationElement.NAME);
|
||||
|
||||
typeDefinitionTypes = new HashSet<String>();
|
||||
typeDefinitionTypes.add(PropertyTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(ResourceEntryDefinition.NAME);
|
||||
typeDefinitionTypes.add(EntityTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(ResourceTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(FacetTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(RelationTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(IsRelatedToTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(ConsistsOfTypeDefinition.NAME);
|
||||
typeDefinitionTypes.add(PropertyType.NAME);
|
||||
typeDefinitionTypes.add(LinkedEntity.NAME);
|
||||
typeDefinitionTypes.add(EntityType.NAME);
|
||||
typeDefinitionTypes.add(ResourceType.NAME);
|
||||
typeDefinitionTypes.add(FacetType.NAME);
|
||||
typeDefinitionTypes.add(RelationType.NAME);
|
||||
typeDefinitionTypes.add(IsRelatedToType.NAME);
|
||||
typeDefinitionTypes.add(ConsistsOfType.NAME);
|
||||
}
|
||||
|
||||
protected void registerTypeSchema(TypeDefinition typeDefinition, AccessType baseType)
|
||||
|
@ -248,11 +248,11 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
|
||||
OClass oClass = null;
|
||||
|
||||
if(BaseEntity.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
if(EntityElement.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
oClass = oDatabaseDocument.createVertexClass(typeDefinition.getName());
|
||||
} else if(BaseRelation.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
} else if(RelationElement.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
oClass = oDatabaseDocument.createEdgeClass(typeDefinition.getName());
|
||||
} else if(BaseProperty.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
} else if(PropertyElement.class.isAssignableFrom(baseType.getTypeClass())) {
|
||||
oClass = oSchema.createClass(typeDefinition.getName());
|
||||
} else {
|
||||
String error = String.format("Allowed superclass are %s, %s, %s, or any subclasses of them.",
|
||||
|
@ -288,7 +288,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
oClass.setSuperClasses(oSuperclasses);
|
||||
}
|
||||
|
||||
if(!(typeDefinition instanceof ResourceTypeDefinition)) {
|
||||
if(!(typeDefinition instanceof ResourceType)) {
|
||||
// A Resource cannot contains any properties.
|
||||
|
||||
Set<PropertyDefinition> propertyDefinitions = typeDefinition.getProperties();
|
||||
|
@ -306,10 +306,10 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
if(!typeDefinitionTypes.contains(typeDefinition.getName())) {
|
||||
switch(oType) {
|
||||
case EMBEDDEDLIST:
|
||||
throw new UnsupportedDataTypeException(Type.OType.PROPERTYLIST
|
||||
throw new UnsupportedDataTypeException(OrientDBType.OType.PROPERTYLIST
|
||||
+ " support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354");
|
||||
case EMBEDDEDSET:
|
||||
throw new UnsupportedDataTypeException(Type.OType.PROPERTYSET
|
||||
throw new UnsupportedDataTypeException(OrientDBType.OType.PROPERTYSET
|
||||
+ " support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354");
|
||||
default:
|
||||
break;
|
||||
|
@ -419,7 +419,7 @@ public class SchemaManagementImpl implements SchemaManagement {
|
|||
|
||||
registerTypeSchema(typeDefinition, accessType);
|
||||
|
||||
ERManagement<? extends OElement> erManagement = null;
|
||||
ElementManagement<? extends OElement> erManagement = null;
|
||||
|
||||
switch(accessType) {
|
||||
case PROPERTY:
|
||||
|
|
|
@ -14,11 +14,11 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.entities.BaseEntityManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -28,14 +28,14 @@ import com.orientechnologies.orient.core.record.OVertex;
|
|||
import com.orientechnologies.orient.core.sql.executor.OResult;
|
||||
import com.orientechnologies.orient.core.sql.executor.OResultSet;
|
||||
|
||||
public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinition> extends BaseEntityManagement<E> {
|
||||
public abstract class EntityTypeDefinitionManagement<E extends EntityType> extends BaseEntityManagement<E> {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(EntityTypeDefinitionManagement.class);
|
||||
|
||||
protected String name;
|
||||
|
||||
protected EntityTypeDefinitionManagement(Class<E> clz) {
|
||||
super(AccessType.ENTITY_TYPE_DEFINITION);
|
||||
super(AccessType.ENTITY_TYPE);
|
||||
this.elementType = TypeBinder.getType(clz);
|
||||
}
|
||||
|
||||
|
@ -62,10 +62,10 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
|
|||
if(name == null) {
|
||||
if(element == null) {
|
||||
if(jsonNode != null) {
|
||||
name = jsonNode.get(EntityTypeDefinition.NAME_PROPERTY).asText();
|
||||
name = jsonNode.get(EntityType.NAME_PROPERTY).asText();
|
||||
}
|
||||
} else {
|
||||
name = element.getProperty(EntityTypeDefinition.NAME_PROPERTY);
|
||||
name = element.getProperty(EntityType.NAME_PROPERTY);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
@ -92,7 +92,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
|
|||
protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException {
|
||||
logger.debug("Going to update {} for {}", this.elementType, getName());
|
||||
OVertex entityTypeDefinition = getElement();
|
||||
entityTypeDefinition = (OVertex) ERManagement.updateProperties(oClass, entityTypeDefinition, jsonNode,
|
||||
entityTypeDefinition = (OVertex) ElementManagement.updateProperties(oClass, entityTypeDefinition, jsonNode,
|
||||
ignoreKeys, ignoreStartWithKeys);
|
||||
return entityTypeDefinition;
|
||||
}
|
||||
|
@ -132,7 +132,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
|
|||
throw new NotFoundException("null name does not allow to retrieve the Element");
|
||||
}
|
||||
|
||||
String select = "SELECT FROM " + elementType + " WHERE " + EntityTypeDefinition.NAME_PROPERTY + " = \""
|
||||
String select = "SELECT FROM " + elementType + " WHERE " + EntityType.NAME_PROPERTY + " = \""
|
||||
+ getName() + "\"";
|
||||
|
||||
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
|
||||
|
@ -144,7 +144,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
|
|||
}
|
||||
|
||||
OResult oResult = resultSet.next();
|
||||
OVertex element = (OVertex) ERManagement.getElementFromOptional(oResult.getElement());
|
||||
OVertex element = (OVertex) ElementManagement.getElementFromOptional(oResult.getElement());
|
||||
|
||||
logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true));
|
||||
|
||||
|
@ -173,7 +173,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
|
|||
|
||||
this.element = oDatabaseDocument.newVertex(elementType);
|
||||
|
||||
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
|
||||
logger.info("Created {} is {}", OVertex.class.getSimpleName(), Utility.toJsonString(element, true));
|
||||
|
||||
|
|
|
@ -2,18 +2,18 @@ package org.gcube.informationsystem.resourceregistry.types.entities;
|
|||
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
|
||||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
|
||||
public class FacetTypeDefinitionManagement extends EntityTypeDefinitionManagement<FacetTypeDefinition> {
|
||||
public class FacetTypeDefinitionManagement extends EntityTypeDefinitionManagement<FacetType> {
|
||||
|
||||
public FacetTypeDefinitionManagement() {
|
||||
super(FacetTypeDefinition.class);
|
||||
super(FacetType.class);
|
||||
}
|
||||
|
||||
public FacetTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
|
||||
super(securityContext, oDatabaseDocument, FacetTypeDefinition.class);
|
||||
super(securityContext, oDatabaseDocument, FacetType.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,18 +2,18 @@ package org.gcube.informationsystem.resourceregistry.types.entities;
|
|||
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
|
||||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
|
||||
public class ResourceTypeDefinitionManagement extends EntityTypeDefinitionManagement<ResourceTypeDefinition> {
|
||||
public class ResourceTypeDefinitionManagement extends EntityTypeDefinitionManagement<ResourceType> {
|
||||
|
||||
public ResourceTypeDefinitionManagement() {
|
||||
super(ResourceTypeDefinition.class);
|
||||
super(ResourceType.class);
|
||||
}
|
||||
|
||||
public ResourceTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
|
||||
super(securityContext, oDatabaseDocument, ResourceTypeDefinition.class);
|
||||
super(securityContext, oDatabaseDocument, ResourceType.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,10 +13,10 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -27,15 +27,15 @@ import com.orientechnologies.orient.core.record.impl.ODocument;
|
|||
import com.orientechnologies.orient.core.sql.executor.OResult;
|
||||
import com.orientechnologies.orient.core.sql.executor.OResultSet;
|
||||
|
||||
public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
|
||||
public class PropertyTypeDefinitionManagement extends ElementManagement<OElement> {
|
||||
|
||||
private static Logger logger = LoggerFactory.getLogger(PropertyTypeDefinitionManagement.class);
|
||||
|
||||
protected String name;
|
||||
|
||||
public PropertyTypeDefinitionManagement() {
|
||||
super(AccessType.PROPERTY_TYPE_DEFINITION);
|
||||
this.elementType = PropertyTypeDefinition.NAME;
|
||||
super(AccessType.PROPERTY_TYPE);
|
||||
this.elementType = PropertyType.NAME;
|
||||
}
|
||||
|
||||
public PropertyTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
|
||||
|
@ -61,10 +61,10 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
|
|||
if(name == null) {
|
||||
if(element == null) {
|
||||
if(jsonNode != null) {
|
||||
name = jsonNode.get(PropertyTypeDefinition.NAME_PROPERTY).asText();
|
||||
name = jsonNode.get(PropertyType.NAME_PROPERTY).asText();
|
||||
}
|
||||
} else {
|
||||
name = element.getProperty(PropertyTypeDefinition.NAME_PROPERTY);
|
||||
name = element.getProperty(PropertyType.NAME_PROPERTY);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
@ -82,22 +82,22 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
|
|||
|
||||
@Override
|
||||
protected OElement reallyCreate() throws AlreadyPresentException, ResourceRegistryException {
|
||||
logger.debug("Going to create {} for {}", PropertyTypeDefinition.NAME, getName());
|
||||
logger.debug("Going to create {} for {}", PropertyType.NAME, getName());
|
||||
return createElement();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OElement reallyUpdate() throws NotFoundException, ResourceRegistryException {
|
||||
logger.debug("Going to update {} for {}", PropertyTypeDefinition.NAME, getName());
|
||||
logger.debug("Going to update {} for {}", PropertyType.NAME, getName());
|
||||
OElement propertyTypeDefinition = getElement();
|
||||
propertyTypeDefinition = (OElement) ERManagement.updateProperties(oClass, propertyTypeDefinition, jsonNode,
|
||||
propertyTypeDefinition = (OElement) ElementManagement.updateProperties(oClass, propertyTypeDefinition, jsonNode,
|
||||
ignoreKeys, ignoreStartWithKeys);
|
||||
return propertyTypeDefinition;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean reallyDelete() throws NotFoundException, ResourceRegistryException {
|
||||
logger.debug("Going to remove {} for {}", EntityTypeDefinition.NAME, getName());
|
||||
logger.debug("Going to remove {} for {}", EntityType.NAME, getName());
|
||||
getElement().delete();
|
||||
return true;
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
|
|||
throw new NotFoundException("null name does not allow to retrieve the Element");
|
||||
}
|
||||
|
||||
String select = "SELECT FROM " + elementType + " WHERE " + PropertyTypeDefinition.NAME_PROPERTY + " = \""
|
||||
String select = "SELECT FROM " + elementType + " WHERE " + PropertyType.NAME_PROPERTY + " = \""
|
||||
+ getName() + "\"";
|
||||
|
||||
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
|
||||
|
@ -142,7 +142,7 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
|
|||
}
|
||||
|
||||
OResult oResult = resultSet.next();
|
||||
OElement element = (OElement) ERManagement.getElementFromOptional(oResult.getElement());
|
||||
OElement element = (OElement) ElementManagement.getElementFromOptional(oResult.getElement());
|
||||
|
||||
logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true));
|
||||
|
||||
|
@ -165,9 +165,9 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
|
|||
try {
|
||||
this.element = new ODocument(elementType);
|
||||
|
||||
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
|
||||
logger.debug("Created {} is {}", PropertyTypeDefinition.NAME, Utility.toJsonString(element, true));
|
||||
logger.debug("Created {} is {}", PropertyType.NAME, Utility.toJsonString(element, true));
|
||||
|
||||
return element;
|
||||
} catch(ResourceRegistryException e) {
|
||||
|
|
|
@ -3,23 +3,23 @@ package org.gcube.informationsystem.resourceregistry.types.relations;
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.types.entities.FacetTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.FacetType;
|
||||
import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
|
||||
|
||||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
|
||||
public class ConsistsOfTypeDefinitionManagement
|
||||
extends RelationTypeDefinitionManagement<FacetTypeDefinitionManagement,FacetTypeDefinition> {
|
||||
extends RelationTypeDefinitionManagement<FacetTypeDefinitionManagement,FacetType> {
|
||||
|
||||
public ConsistsOfTypeDefinitionManagement() {
|
||||
super(FacetTypeDefinition.class);
|
||||
this.elementType = ConsistsOfTypeDefinition.NAME;
|
||||
super(FacetType.class);
|
||||
this.elementType = ConsistsOfType.NAME;
|
||||
}
|
||||
|
||||
public ConsistsOfTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument)
|
||||
throws ResourceRegistryException {
|
||||
super(securityContext, oDatabaseDocument, FacetTypeDefinition.class);
|
||||
this.elementType = ConsistsOfTypeDefinition.NAME;
|
||||
super(securityContext, oDatabaseDocument, FacetType.class);
|
||||
this.elementType = ConsistsOfType.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -3,23 +3,23 @@ package org.gcube.informationsystem.resourceregistry.types.relations;
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
|
||||
|
||||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
|
||||
public class IsRelatedToTypeDefinitionManagement
|
||||
extends RelationTypeDefinitionManagement<ResourceTypeDefinitionManagement,ResourceTypeDefinition> {
|
||||
extends RelationTypeDefinitionManagement<ResourceTypeDefinitionManagement,ResourceType> {
|
||||
|
||||
public IsRelatedToTypeDefinitionManagement() {
|
||||
super(ResourceTypeDefinition.class);
|
||||
this.elementType = IsRelatedToTypeDefinition.NAME;
|
||||
super(ResourceType.class);
|
||||
this.elementType = IsRelatedToType.NAME;
|
||||
}
|
||||
|
||||
public IsRelatedToTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument)
|
||||
throws ResourceRegistryException {
|
||||
super(securityContext, oDatabaseDocument, ResourceTypeDefinition.class);
|
||||
this.elementType = IsRelatedToTypeDefinition.NAME;
|
||||
super(securityContext, oDatabaseDocument, ResourceType.class);
|
||||
this.elementType = IsRelatedToType.NAME;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,14 +15,14 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.Schema
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.relations.BaseRelationManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.entities.EntityTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.utils.Utility;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.entities.ResourceType;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
|
||||
import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
|
||||
import com.orientechnologies.orient.core.record.OEdge;
|
||||
|
@ -30,14 +30,14 @@ import com.orientechnologies.orient.core.record.OVertex;
|
|||
import com.orientechnologies.orient.core.sql.executor.OResult;
|
||||
import com.orientechnologies.orient.core.sql.executor.OResultSet;
|
||||
|
||||
public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefinitionManagement<TT>, TT extends EntityTypeDefinition>
|
||||
public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefinitionManagement<TT>, TT extends EntityType>
|
||||
extends BaseRelationManagement<ResourceTypeDefinitionManagement, T> {
|
||||
|
||||
protected String name;
|
||||
|
||||
public RelationTypeDefinitionManagement(Class<TT> clz) {
|
||||
super(AccessType.RELATION_TYPE_DEFINITION, ResourceTypeDefinition.class, clz);
|
||||
this.elementType = RelationTypeDefinition.NAME;
|
||||
super(AccessType.RELATION_TYPE, ResourceType.class, clz);
|
||||
this.elementType = RelationType.NAME;
|
||||
}
|
||||
|
||||
public RelationTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument, Class<TT> clz) throws ResourceRegistryException {
|
||||
|
@ -63,10 +63,10 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
if(name == null) {
|
||||
if(element == null) {
|
||||
if(jsonNode != null) {
|
||||
name = jsonNode.get(RelationTypeDefinition.NAME_PROPERTY).asText();
|
||||
name = jsonNode.get(RelationType.NAME_PROPERTY).asText();
|
||||
}
|
||||
} else {
|
||||
name = element.getProperty(RelationTypeDefinition.NAME_PROPERTY);
|
||||
name = element.getProperty(RelationType.NAME_PROPERTY);
|
||||
}
|
||||
}
|
||||
return name;
|
||||
|
@ -74,7 +74,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
|
||||
@Override
|
||||
protected OEdge reallyCreate() throws ResourceRegistryException {
|
||||
logger.debug("Going to create {} for {}", RelationTypeDefinition.NAME, getName());
|
||||
logger.debug("Going to create {} for {}", RelationType.NAME, getName());
|
||||
if(sourceEntityManagement == null) {
|
||||
if(!jsonNode.has(Relation.SOURCE_PROPERTY)) {
|
||||
throw new ResourceRegistryException("Error while creating relation. No source definition found");
|
||||
|
@ -104,16 +104,16 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
|
||||
element = oDatabaseDocument.newEdge(source, target, elementType);
|
||||
|
||||
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
|
||||
|
||||
return element;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OEdge reallyUpdate() throws NotFoundException, ResourceRegistryException {
|
||||
logger.debug("Going to update {} for {}", RelationTypeDefinition.NAME, getName());
|
||||
logger.debug("Going to update {} for {}", RelationType.NAME, getName());
|
||||
OEdge relationTypeDefinition = getElement();
|
||||
relationTypeDefinition = (OEdge) ERManagement.updateProperties(oClass, relationTypeDefinition, jsonNode,
|
||||
relationTypeDefinition = (OEdge) ElementManagement.updateProperties(oClass, relationTypeDefinition, jsonNode,
|
||||
ignoreKeys, ignoreStartWithKeys);
|
||||
return relationTypeDefinition;
|
||||
|
||||
|
@ -121,7 +121,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
|
||||
@Override
|
||||
protected boolean reallyDelete() throws RelationNotFoundException, ResourceRegistryException {
|
||||
logger.debug("Going to remove {} for {}", RelationTypeDefinition.NAME, getName());
|
||||
logger.debug("Going to remove {} for {}", RelationType.NAME, getName());
|
||||
getElement().delete();
|
||||
return true;
|
||||
}
|
||||
|
@ -154,7 +154,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
throw new NotFoundException("null name does not allow to retrieve the Element");
|
||||
}
|
||||
|
||||
String select = "SELECT FROM " + elementType + " WHERE " + RelationTypeDefinition.NAME_PROPERTY + " = \""
|
||||
String select = "SELECT FROM " + elementType + " WHERE " + RelationType.NAME_PROPERTY + " = \""
|
||||
+ getName() + "\"";
|
||||
|
||||
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
|
||||
|
@ -166,7 +166,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
|
|||
}
|
||||
|
||||
OResult oResult = resultSet.next();
|
||||
OEdge element = (OEdge) ERManagement.getElementFromOptional(oResult.getElement());
|
||||
OEdge element = (OEdge) ElementManagement.getElementFromOptional(oResult.getElement());
|
||||
|
||||
logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true));
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.HashMap;
|
|||
import java.util.UUID;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.ER;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.properties.Header;
|
||||
import org.gcube.informationsystem.model.reference.relations.Relation;
|
||||
|
@ -13,7 +13,7 @@ import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegis
|
|||
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext;
|
||||
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
@ -111,7 +111,7 @@ public class Utility {
|
|||
|
||||
OResult oResult = resultSet.next();
|
||||
@SuppressWarnings("unchecked")
|
||||
El element = (El) ERManagement.getElementFromOptional(oResult.getElement());
|
||||
El element = (El) ElementManagement.getElementFromOptional(oResult.getElement());
|
||||
|
||||
logger.trace("{} with id {} is : {}", elementType, uuid.toString(), Utility.toJsonString(element, true));
|
||||
|
||||
|
@ -123,7 +123,7 @@ public class Utility {
|
|||
return element;
|
||||
}
|
||||
|
||||
public static <P extends BaseProperty> P getPropertyDocument(Class<P> clz, OElement element, String property)
|
||||
public static <P extends PropertyElement> P getPropertyDocument(Class<P> clz, OElement element, String property)
|
||||
throws ResourceRegistryException {
|
||||
try {
|
||||
ODocument oDocument = element.getProperty(property);
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.gcube.informationsystem.resourceregistry.ContextTest;
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement;
|
||||
|
@ -628,7 +628,7 @@ public class ERManagementTest extends ContextTest {
|
|||
|
||||
/* Getting all instances of created specific Resources*/
|
||||
for(String key : resources.keySet()){
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ERManagementUtility.getERManagement(key);
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ElementManagementUtility.getERManagement(key);
|
||||
String json = resourceManagement.all(false);
|
||||
|
||||
List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
|
||||
|
@ -639,7 +639,7 @@ public class ERManagementTest extends ContextTest {
|
|||
|
||||
/* Getting all Resources polymorphic and non polymorphic */
|
||||
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ERManagementUtility.getERManagement(Resource.NAME);
|
||||
ResourceManagement resourceManagement = (ResourceManagement) ElementManagementUtility.getERManagement(Resource.NAME);
|
||||
|
||||
String json = resourceManagement.all(true);
|
||||
List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
|
||||
|
@ -654,7 +654,7 @@ public class ERManagementTest extends ContextTest {
|
|||
|
||||
/* Getting all IsRelatedTo polymorphic and non polymorphic */
|
||||
|
||||
IsRelatedToManagement isRelatedToManagement = (IsRelatedToManagement) ERManagementUtility.getERManagement(IsRelatedTo.NAME);
|
||||
IsRelatedToManagement isRelatedToManagement = (IsRelatedToManagement) ElementManagementUtility.getERManagement(IsRelatedTo.NAME);
|
||||
|
||||
json = isRelatedToManagement.all(true);
|
||||
|
||||
|
@ -672,7 +672,7 @@ public class ERManagementTest extends ContextTest {
|
|||
|
||||
/* Getting all ConsistsOf polymorphic and non polymorphic */
|
||||
|
||||
ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ERManagementUtility.getERManagement(ConsistsOf.NAME);
|
||||
ConsistsOfManagement consistsOfManagement = (ConsistsOfManagement) ElementManagementUtility.getERManagement(ConsistsOf.NAME);
|
||||
|
||||
json = consistsOfManagement.all(true);
|
||||
List<Resource> consistsOfPolimorphicList = ISMapper.unmarshalList(Resource.class, json);
|
||||
|
|
|
@ -8,8 +8,8 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
|
|||
import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
|
||||
import org.gcube.informationsystem.resourceregistry.ContextTest;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
|
||||
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl;
|
||||
|
@ -99,7 +99,7 @@ public class ResourceManagementTest extends ContextTest {
|
|||
String type = Service.NAME;
|
||||
|
||||
@SuppressWarnings("rawtypes")
|
||||
ERManagement erManagement = ERManagementUtility.getERManagement(type);
|
||||
ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
|
||||
|
||||
if (erManagement instanceof ResourceManagement) {
|
||||
boolean[] booleans = new boolean[] {true, false};
|
||||
|
|
|
@ -6,8 +6,8 @@ package org.gcube.informationsystem.resourceregistry.types;
|
|||
import java.util.List;
|
||||
|
||||
import org.gcube.informationsystem.base.reference.AccessType;
|
||||
import org.gcube.informationsystem.base.reference.ISManageable;
|
||||
import org.gcube.informationsystem.base.reference.properties.BaseProperty;
|
||||
import org.gcube.informationsystem.base.reference.Element;
|
||||
import org.gcube.informationsystem.base.reference.properties.PropertyElement;
|
||||
import org.gcube.informationsystem.context.reference.entities.Context;
|
||||
import org.gcube.informationsystem.model.reference.entities.Entity;
|
||||
import org.gcube.informationsystem.model.reference.entities.Facet;
|
||||
|
@ -21,13 +21,13 @@ import org.gcube.informationsystem.model.reference.relations.Relation;
|
|||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaAlreadyPresentException;
|
||||
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
|
||||
import org.gcube.informationsystem.types.TypeBinder;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl;
|
||||
import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
|
||||
import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
|
||||
import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
|
||||
import org.gcube.informationsystem.types.reference.TypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition;
|
||||
import org.gcube.informationsystem.types.reference.entities.EntityType;
|
||||
import org.gcube.informationsystem.types.reference.properties.PropertyType;
|
||||
import org.gcube.informationsystem.types.reference.relations.RelationType;
|
||||
import org.gcube.informationsystem.utils.ISMapper;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
|
||||
import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet;
|
||||
|
@ -50,7 +50,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test
|
||||
public void registerPropertyTypeSchema() throws Exception {
|
||||
Class<? extends BaseProperty> clz = Header.class;
|
||||
Class<? extends PropertyElement> clz = Header.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
logger.debug(json);
|
||||
//new SchemaManagementImpl().create(json, AccessType.PROPERTY);
|
||||
|
@ -102,7 +102,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test
|
||||
public void registerRelation() throws Exception {
|
||||
Class<? extends ISManageable> clz = Hosts.class;
|
||||
Class<? extends Element> clz = Hosts.class;
|
||||
String json = TypeBinder.serializeType(clz);
|
||||
logger.trace(json);
|
||||
// new SchemaManagementImpl().registerFacetSchema(json);
|
||||
|
@ -166,8 +166,8 @@ public class SchemaManagementImplTest {
|
|||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
try {
|
||||
schemaManagement.read(BaseProperty.NAME, includeSubTypes);
|
||||
throw new Exception("Should not be allowed to get " + BaseProperty.NAME + " schema");
|
||||
schemaManagement.read(PropertyElement.NAME, includeSubTypes);
|
||||
throw new Exception("Should not be allowed to get " + PropertyElement.NAME + " schema");
|
||||
} catch (SchemaException e) {
|
||||
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test(expected=SchemaAlreadyPresentException.class)
|
||||
public void createPropertyType() throws Exception {
|
||||
PropertyTypeDefinition<ValueSchema> propertyTypeDefinition = new PropertyTypeDefinitionImpl<>(ValueSchema.class);
|
||||
PropertyType<ValueSchema> propertyTypeDefinition = new PropertyTypeImpl<>(ValueSchema.class);
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(ValueSchema.NAME);
|
||||
|
@ -202,7 +202,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test(expected=SchemaAlreadyPresentException.class)
|
||||
public void createEncryptedType() throws Exception {
|
||||
PropertyTypeDefinition<Encrypted> propertyTypeDefinition = new PropertyTypeDefinitionImpl<>(Encrypted.class);
|
||||
PropertyType<Encrypted> propertyTypeDefinition = new PropertyTypeImpl<>(Encrypted.class);
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(Encrypted.NAME);
|
||||
|
@ -214,11 +214,11 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test(expected=SchemaAlreadyPresentException.class)
|
||||
public void createContextType() throws Exception {
|
||||
EntityTypeDefinition entityTypeDefinition = new EntityTypeDefinitionImpl(Context.class);
|
||||
EntityType entityTypeDefinition = new EntityTypeImpl(Context.class);
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(Context.NAME);
|
||||
String ret = schemaManagement.create(ISMapper.marshal(entityTypeDefinition), AccessType.BASE_ENTITY);
|
||||
String ret = schemaManagement.create(ISMapper.marshal(entityTypeDefinition), AccessType.ENTITY_ELEMENT);
|
||||
|
||||
logger.debug(ret);
|
||||
|
||||
|
@ -226,7 +226,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test(expected=SchemaAlreadyPresentException.class)
|
||||
public void createFacetType() throws Exception {
|
||||
EntityTypeDefinition entityTypeDefinition = new EntityTypeDefinitionImpl(AccessPointFacet.class);
|
||||
EntityType entityTypeDefinition = new EntityTypeImpl(AccessPointFacet.class);
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(AccessPointFacet.NAME);
|
||||
|
@ -238,7 +238,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
@Test(expected=SchemaAlreadyPresentException.class)
|
||||
public void createResourceType() throws Exception {
|
||||
EntityTypeDefinition entityTypeDefinition = new EntityTypeDefinitionImpl(EService.class);
|
||||
EntityType entityTypeDefinition = new EntityTypeImpl(EService.class);
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(EService.NAME);
|
||||
|
@ -246,7 +246,7 @@ public class SchemaManagementImplTest {
|
|||
|
||||
logger.debug(ret);
|
||||
|
||||
entityTypeDefinition = new EntityTypeDefinitionImpl(RunningPlugin.class);
|
||||
entityTypeDefinition = new EntityTypeImpl(RunningPlugin.class);
|
||||
|
||||
schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(RunningPlugin.NAME);
|
||||
|
@ -259,10 +259,10 @@ public class SchemaManagementImplTest {
|
|||
@Test
|
||||
public void createRelationTypeDefinitionType() throws Exception {
|
||||
@SuppressWarnings({"unchecked", "rawtypes"})
|
||||
RelationTypeDefinition<?, ?> relationTypeDefinition = new RelationTypeDefinitionImpl(RelationTypeDefinition.class);
|
||||
RelationType<?, ?> relationTypeDefinition = new RelationTypeImpl(RelationType.class);
|
||||
|
||||
SchemaManagement schemaManagement = new SchemaManagementImpl();
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(RelationTypeDefinition.NAME);
|
||||
((SchemaManagementImpl) schemaManagement).setTypeName(RelationType.NAME);
|
||||
|
||||
String ret = ISMapper.marshal(relationTypeDefinition);
|
||||
|
||||
|
|
Loading…
Reference in New Issue