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:
Luca Frosini 2020-01-30 11:04:16 +01:00
parent 58488f743e
commit 241b6269bc
29 changed files with 274 additions and 274 deletions

View File

@ -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;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; import org.gcube.informationsystem.resourceregistry.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.resourceregistry.utils.Utility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -224,7 +224,7 @@ public class ContextUtility {
} }
OResult oResult = resultSet.next(); 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)); logger.trace("Context Representing Vertex : {}", Utility.toJsonString(context, true));

View File

@ -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.relations.IsParentOfManagement;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; 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.instances.base.entities.BaseEntityManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -320,7 +320,7 @@ public class ContextManagement extends BaseEntityManagement<Context> {
move(newParentContextManagement, false); move(newParentContextManagement, false);
} }
element = (OVertex) ERManagement.updateProperties(oClass, getElement(), jsonNode, ignoreKeys, element = (OVertex) ElementManagement.updateProperties(oClass, getElement(), jsonNode, ignoreKeys,
ignoreStartWithKeys); ignoreStartWithKeys);
ContextUtility.getInstance().removeFromCache(uuid, (nameChanged && !parentChanged)); ContextUtility.getInstance().removeFromCache(uuid, (nameChanged && !parentChanged));

View File

@ -15,10 +15,10 @@ import java.util.UUID;
import org.gcube.common.encryption.SymmetricKey; import org.gcube.common.encryption.SymmetricKey;
import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.ISConstants; import org.gcube.informationsystem.base.reference.ISConstants;
import org.gcube.informationsystem.base.reference.ISManageable; import org.gcube.informationsystem.base.reference.Element;
import org.gcube.informationsystem.base.reference.entities.BaseEntity; import org.gcube.informationsystem.base.reference.entities.EntityElement;
import org.gcube.informationsystem.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.properties.Property; import org.gcube.informationsystem.model.reference.properties.Property;
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility; 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.ContextSecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SchemaSecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SchemaSecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; 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.resourceregistry.types.properties.PropertyTypeDefinitionManagement;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.discovery.ISMDiscovery; import org.gcube.informationsystem.utils.discovery.ISMDiscovery;
import org.gcube.informationsystem.utils.discovery.RegistrationProvider; import org.gcube.informationsystem.utils.discovery.RegistrationProvider;
import org.gcube.informationsystem.utils.discovery.SchemaAction; import org.gcube.informationsystem.utils.discovery.SchemaAction;
@ -228,39 +228,39 @@ public class DatabaseEnvironment {
schemaSecurityContext.create(); schemaSecurityContext.create();
List<Class<? extends ISManageable>> definitionToBeCreated = new ArrayList<>(); List<Class<? extends Element>> definitionToBeCreated = new ArrayList<>();
definitionToBeCreated.add(BaseProperty.class); definitionToBeCreated.add(PropertyElement.class);
definitionToBeCreated.add(Property.class); definitionToBeCreated.add(Property.class);
definitionToBeCreated.add(Header.class); definitionToBeCreated.add(Header.class);
definitionToBeCreated.add(PropertyDefinition.class); definitionToBeCreated.add(PropertyDefinition.class);
definitionToBeCreated.add(PropertyTypeDefinition.class); definitionToBeCreated.add(PropertyType.class);
definitionToBeCreated.add(ResourceEntryDefinition.class); definitionToBeCreated.add(LinkedEntity.class);
definitionToBeCreated.add(BaseEntity.class); definitionToBeCreated.add(EntityElement.class);
definitionToBeCreated.add(EntityTypeDefinition.class); definitionToBeCreated.add(EntityType.class);
definitionToBeCreated.add(FacetTypeDefinition.class); definitionToBeCreated.add(FacetType.class);
definitionToBeCreated.add(ResourceTypeDefinition.class); definitionToBeCreated.add(ResourceType.class);
definitionToBeCreated.add(BaseRelation.class); definitionToBeCreated.add(RelationElement.class);
definitionToBeCreated.add(RelationTypeDefinition.class); definitionToBeCreated.add(RelationType.class);
definitionToBeCreated.add(IsRelatedToTypeDefinition.class); definitionToBeCreated.add(IsRelatedToType.class);
definitionToBeCreated.add(ConsistsOfTypeDefinition.class); definitionToBeCreated.add(ConsistsOfType.class);
SchemaAction schemaAction = new SchemaActionImpl(); SchemaAction schemaAction = new SchemaActionImpl();
for(Class<? extends ISManageable> clz : definitionToBeCreated) { for(Class<? extends Element> clz : definitionToBeCreated) {
if(BaseProperty.class.isAssignableFrom(clz)) { if(PropertyElement.class.isAssignableFrom(clz)) {
schemaAction.managePropertyClass((Class<? extends BaseProperty>) clz); schemaAction.managePropertyClass((Class<? extends PropertyElement>) clz);
} else if(BaseEntity.class.isAssignableFrom(clz)) { } else if(EntityElement.class.isAssignableFrom(clz)) {
schemaAction.manageEntityClass((Class<? extends BaseEntity>) clz); schemaAction.manageEntityClass((Class<? extends EntityElement>) clz);
} else if(BaseRelation.class.isAssignableFrom(clz)) { } else if(RelationElement.class.isAssignableFrom(clz)) {
schemaAction.manageRelationClass((Class<? extends BaseRelation<? extends BaseEntity, ? extends BaseEntity>>) 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(Property.class);
schemaToBeCreated.add(Header.class); schemaToBeCreated.add(Header.class);
for(Class<? extends ISManageable> clz : schemaToBeCreated) { for(Class<? extends Element> clz : schemaToBeCreated) {
ERManagement<? extends OElement> erManagement = new PropertyTypeDefinitionManagement(); ElementManagement<? extends OElement> erManagement = new PropertyTypeDefinitionManagement();
erManagement.setJson(TypeBinder.serializeType(clz)); erManagement.setJson(TypeBinder.serializeType(clz));
erManagement.create(); erManagement.create();
} }
@ -273,7 +273,7 @@ public class DatabaseEnvironment {
AccessType[] accessTypes = AccessType.values(); AccessType[] accessTypes = AccessType.values();
for(AccessType accessType : accessTypes) { for(AccessType accessType : accessTypes) {
Class<ISManageable> clz = accessType.getTypeClass(); Class<Element> clz = accessType.getTypeClass();
packages.add(clz.getPackage()); packages.add(clz.getPackage());
} }

View File

@ -1,9 +1,9 @@
package org.gcube.informationsystem.resourceregistry.dbinitialization; package org.gcube.informationsystem.resourceregistry.dbinitialization;
import org.gcube.informationsystem.base.reference.AccessType; 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.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; import org.gcube.informationsystem.model.reference.entities.Resource;
import org.gcube.informationsystem.model.reference.properties.Header; 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); private static Logger logger = LoggerFactory.getLogger(SchemaActionImpl.class);
@Override @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 { throws Exception {
try { try {
SchemaManagementImpl schemaManagement = new SchemaManagementImpl(); SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
@ -37,18 +37,18 @@ public class SchemaActionImpl implements SchemaAction {
} else if(IsRelatedTo.class.isAssignableFrom(r)) { } else if(IsRelatedTo.class.isAssignableFrom(r)) {
schemaManagement.create(json, AccessType.IS_RELATED_TO); schemaManagement.create(json, AccessType.IS_RELATED_TO);
} else { } else {
schemaManagement.create(json, AccessType.BASE_RELATION); schemaManagement.create(json, AccessType.RELATION_ELEMENT);
} }
} catch(SchemaAlreadyPresentException sape) { } catch(SchemaAlreadyPresentException sape) {
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r)); logger.warn("{} already exists. It will be ignored", TypeBinder.getType(r));
} catch(Exception ex) { } 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; throw ex;
} }
} }
@Override @Override
public <E extends BaseEntity> void manageEntityClass(Class<E> e) throws Exception { public <E extends EntityElement> void manageEntityClass(Class<E> e) throws Exception {
try { try {
SchemaManagementImpl schemaManagement = new SchemaManagementImpl(); SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
schemaManagement.setTypeName(TypeBinder.getType(e)); schemaManagement.setTypeName(TypeBinder.getType(e));
@ -59,18 +59,18 @@ public class SchemaActionImpl implements SchemaAction {
} else if(Resource.class.isAssignableFrom(e)) { } else if(Resource.class.isAssignableFrom(e)) {
schemaManagement.create(json, AccessType.RESOURCE); schemaManagement.create(json, AccessType.RESOURCE);
} else { } else {
schemaManagement.create(json, AccessType.BASE_ENTITY); schemaManagement.create(json, AccessType.ENTITY_ELEMENT);
} }
} catch(SchemaAlreadyPresentException sape) { } catch(SchemaAlreadyPresentException sape) {
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e)); logger.warn("{} already exists. It will be ignored", TypeBinder.getType(e));
} catch(Exception ex) { } 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; throw ex;
} }
} }
@Override @Override
public <P extends BaseProperty> void managePropertyClass(Class<P> p) throws Exception { public <P extends PropertyElement> void managePropertyClass(Class<P> p) throws Exception {
try { try {
SchemaManagementImpl schemaManagement = new SchemaManagementImpl(); SchemaManagementImpl schemaManagement = new SchemaManagementImpl();
schemaManagement.setTypeName(TypeBinder.getType(p)); schemaManagement.setTypeName(TypeBinder.getType(p));
@ -82,12 +82,12 @@ public class SchemaActionImpl implements SchemaAction {
} }
schemaManagement.create(json, AccessType.PROPERTY); schemaManagement.create(json, AccessType.PROPERTY);
}else { }else {
schemaManagement.create(json, AccessType.BASE_PROPERTY); schemaManagement.create(json, AccessType.PROPERTY_ELEMENT);
} }
} catch(SchemaAlreadyPresentException sape) { } catch(SchemaAlreadyPresentException sape) {
logger.warn("{} already exists. It will be ignored", TypeBinder.getType(p)); logger.warn("{} already exists. It will be ignored", TypeBinder.getType(p));
} catch(Exception ex) { } 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; throw ex;
} }

View File

@ -19,7 +19,7 @@ import javax.activation.UnsupportedDataTypeException;
import org.gcube.informationsystem.base.reference.AccessType; import org.gcube.informationsystem.base.reference.AccessType;
import org.gcube.informationsystem.base.reference.ER; 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.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException;
@ -58,11 +58,11 @@ import com.tinkerpop.blueprints.util.StringFactory;
/** /**
* @author Luca Frosini (ISTI - CNR) * @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()); 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 AT = "@";
public final String UNDERSCORE = "_"; public final String UNDERSCORE = "_";
@ -114,7 +114,7 @@ public abstract class ERManagement<El extends OElement> {
this.workingContext = workingContext; this.workingContext = workingContext;
} }
protected ERManagement(AccessType accessType) { protected ElementManagement(AccessType accessType) {
this.accessType = accessType; this.accessType = accessType;
this.ignoreKeys = new HashSet<String>(); this.ignoreKeys = new HashSet<String>();
@ -176,7 +176,7 @@ public abstract class ERManagement<El extends OElement> {
if(element != null) { if(element != null) {
oClass = getOClass(element); oClass = getOClass(element);
} else { } else {
oClass = ERManagementUtility.getTypeSchema(elementType, accessType); oClass = ElementManagementUtility.getTypeSchema(elementType, accessType);
} }
} }
return oClass; return oClass;
@ -757,8 +757,8 @@ public abstract class ERManagement<El extends OElement> {
} }
public static String getClassProperty(JsonNode jsonNode) { public static String getClassProperty(JsonNode jsonNode) {
if(jsonNode.has(ISManageable.CLASS_PROPERTY)) { if(jsonNode.has(Element.CLASS_PROPERTY)) {
return jsonNode.get(ISManageable.CLASS_PROPERTY).asText(); return jsonNode.get(Element.CLASS_PROPERTY).asText();
} }
return null; return null;
} }
@ -1047,12 +1047,12 @@ public abstract class ERManagement<El extends OElement> {
OClass oClass = getOClass(); OClass oClass = getOClass();
String type = oClass.getName(); String type = oClass.getName();
objectNode.put(ISManageable.CLASS_PROPERTY, type); objectNode.put(Element.CLASS_PROPERTY, type);
Collection<String> superClasses = getSuperclasses(); Collection<String> superClasses = getSuperclasses();
ArrayNode arrayNode = objectMapper.valueToTree(superClasses); ArrayNode arrayNode = objectMapper.valueToTree(superClasses);
objectNode.replace(ISManageable.SUPERCLASSES_PROPERTY, arrayNode); objectNode.replace(Element.SUPERCLASSES_PROPERTY, arrayNode);
return objectNode; return objectNode;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {

View File

@ -39,13 +39,13 @@ import com.orientechnologies.orient.core.record.OVertex;
/** /**
* @author Luca Frosini (ISTI - CNR) * @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 { 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)) { if(oClass.isSubClassOf(Resource.NAME)) {
return AccessType.RESOURCE; return AccessType.RESOURCE;
@ -65,10 +65,10 @@ public class ERManagementUtility {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static ERManagement getERManagement(String type) throws ResourceRegistryException { public static ElementManagement getERManagement(String type) throws ResourceRegistryException {
OClass oClass = ERManagementUtility.getTypeSchema(type, null); OClass oClass = ElementManagementUtility.getTypeSchema(type, null);
ERManagement erManagement = null; ElementManagement erManagement = null;
if(oClass.isSubClassOf(Resource.NAME)) { if(oClass.isSubClassOf(Resource.NAME)) {
erManagement = new ResourceManagement(); erManagement = new ResourceManagement();
@ -88,7 +88,7 @@ public class ERManagementUtility {
return erManagement; return erManagement;
} }
public static ERManagement<?> getERManagement(SecurityContext workingContext, ODatabaseDocument orientGraph, public static ElementManagement<?> getERManagement(SecurityContext workingContext, ODatabaseDocument orientGraph,
OElement element) throws ResourceRegistryException { OElement element) throws ResourceRegistryException {
if(element instanceof OVertex) { if(element instanceof OVertex) {
return getEntityManagement(workingContext, orientGraph, (OVertex) element); return getEntityManagement(workingContext, orientGraph, (OVertex) element);
@ -125,7 +125,7 @@ public class ERManagementUtility {
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
public static ERManagement getERManagementFromUUID(SecurityContext workingContext, ODatabaseDocument orientGraph, public static ElementManagement getERManagementFromUUID(SecurityContext workingContext, ODatabaseDocument orientGraph,
UUID uuid) throws ResourceRegistryException { UUID uuid) throws ResourceRegistryException {
OElement element; OElement element;
try { try {
@ -153,7 +153,7 @@ public class ERManagementUtility {
OClass oClass = null; OClass oClass = null;
try { try {
oClass = ERManagement.getOClass(vertex); oClass = ElementManagement.getOClass(vertex);
} catch(Exception e) { } catch(Exception e) {
String error = String.format("Unable to detect type of %s. %s", vertex.toString(), String error = String.format("Unable to detect type of %s. %s", vertex.toString(),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); 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); 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; RelationManagement relationManagement = null;
if(oClass.isSubClassOf(ConsistsOf.NAME)) { if(oClass.isSubClassOf(ConsistsOf.NAME)) {

View File

@ -4,14 +4,14 @@ import java.util.HashMap;
import java.util.Map; import java.util.Map;
import org.gcube.informationsystem.base.reference.AccessType; 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.AvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.EntityAlreadyPresentException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.EntityAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; 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.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.relations.BaseRelationManagement; import org.gcube.informationsystem.resourceregistry.instances.base.relations.BaseRelationManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
@ -27,7 +27,7 @@ import com.orientechnologies.orient.core.record.OVertex;
/** /**
* @author Luca Frosini (ISTI - CNR) * @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 * Provide a cache edge-internal-id -> RelationManagement
@ -39,7 +39,7 @@ public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManag
protected BaseEntityManagement(AccessType accessType) { protected BaseEntityManagement(AccessType accessType) {
super(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_IN_PREFIX.toLowerCase());
this.ignoreStartWithKeys.add(com.tinkerpop.blueprints.impls.orient.OrientVertex.CONNECTION_OUT_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(); String id = edge.getIdentity().toString();
BaseRelationManagement relationManagement = relationManagements.get(id); BaseRelationManagement relationManagement = relationManagements.get(id);
if(relationManagement == null) { if(relationManagement == null) {
relationManagement = ERManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge); relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge);
relationManagements.put(id, relationManagement); relationManagements.put(id, relationManagement);
} }
return relationManagement; return relationManagement;
@ -134,7 +134,7 @@ public abstract class BaseEntityManagement<E extends BaseEntity> extends ERManag
} catch(NotFoundException e) { } catch(NotFoundException e) {
try { 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.", String error = String.format("UUID %s is already used by another %s. This is not allowed.",
uuid.toString(), uuid.toString(),
(el instanceof OVertex) ? org.gcube.informationsystem.model.reference.entities.Entity.NAME : (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) { if(accessType == AccessType.RESOURCE) {
// Facet and relation are created in calling method // Facet and relation are created in calling method
} else { } else {
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
} }
logger.info("Created {} is {}", OVertex.class.getSimpleName(), logger.info("Created {} is {}", OVertex.class.getSimpleName(),

View File

@ -5,7 +5,7 @@ import java.util.HashSet;
import java.util.Set; import java.util.Set;
import org.gcube.informationsystem.base.reference.AccessType; 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.impl.properties.EncryptedImpl;
import org.gcube.informationsystem.model.reference.properties.Encrypted; import org.gcube.informationsystem.model.reference.properties.Encrypted;
import org.gcube.informationsystem.model.reference.properties.Header; 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.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaNotFoundException;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; 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.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.utils.EncryptedOrient; import org.gcube.informationsystem.resourceregistry.utils.EncryptedOrient;
import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility; import org.gcube.informationsystem.resourceregistry.utils.HeaderUtility;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -50,13 +50,13 @@ public class BasePropertyManagement {
public static ODocument getPropertyDocument(JsonNode jsonNode) throws ResourceRegistryException { public static ODocument getPropertyDocument(JsonNode jsonNode) throws ResourceRegistryException {
ODocument oDocument = null; ODocument oDocument = null;
if(jsonNode.has(ISManageable.CLASS_PROPERTY)) { if(jsonNode.has(Element.CLASS_PROPERTY)) {
// Complex type // Complex type
String type = ERManagement.getClassProperty(jsonNode); String type = ElementManagement.getClassProperty(jsonNode);
OClass oClass = null; OClass oClass = null;
try { try {
oClass = ERManagementUtility.getTypeSchema(type, AccessType.BASE_PROPERTY); oClass = ElementManagementUtility.getTypeSchema(type, AccessType.PROPERTY_ELEMENT);
} catch(SchemaNotFoundException e) { } catch(SchemaNotFoundException e) {
throw e; throw e;
} }
@ -125,7 +125,7 @@ public class BasePropertyManagement {
return jsonNode; 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 * In case it is an Encrypted type the value is encrypted with the DB Key

View File

@ -3,13 +3,13 @@ package org.gcube.informationsystem.resourceregistry.instances.base.relations;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.base.reference.AccessType; 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.model.reference.relations.Relation;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.relation.RelationNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; 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.base.entities.BaseEntityManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
@ -24,16 +24,16 @@ import com.orientechnologies.orient.core.record.OVertex;
/** /**
* @author Luca Frosini (ISTI - CNR) * @author Luca Frosini (ISTI - CNR)
*/ */
public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<? extends BaseEntity>, TEM extends BaseEntityManagement<? extends BaseEntity>> public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<? extends EntityElement>, TEM extends BaseEntityManagement<? extends EntityElement>>
extends ERManagement<OEdge> { extends ElementManagement<OEdge> {
protected final Class<? extends BaseEntity> sourceEntityClass; protected final Class<? extends EntityElement> sourceEntityClass;
protected final Class<? extends BaseEntity> targetEntityClass; protected final Class<? extends EntityElement> targetEntityClass;
protected SEM sourceEntityManagement; protected SEM sourceEntityManagement;
protected TEM targetEntityManagement; 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); super(accessType);
this.ignoreKeys.add(Relation.HEADER_PROPERTY); this.ignoreKeys.add(Relation.HEADER_PROPERTY);
@ -51,7 +51,7 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
this.targetEntityManagement = null; 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(accessType, sourceEntityClass, targetEntityClass);
this.oDatabaseDocument = orientGraph; this.oDatabaseDocument = orientGraph;
setWorkingContext(workingContext); setWorkingContext(workingContext);
@ -100,12 +100,12 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
try { try {
if(includeSource) { if(includeSource) {
BaseEntityManagement<? extends BaseEntity> sourceEntityManagement = getSourceEntityManagement(); BaseEntityManagement<? extends EntityElement> sourceEntityManagement = getSourceEntityManagement();
((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelfOnly()); ((ObjectNode) relation).replace(Relation.SOURCE_PROPERTY, sourceEntityManagement.serializeSelfOnly());
} }
if(includeTarget) { if(includeTarget) {
BaseEntityManagement<? extends BaseEntity> targetEntityManagement = getTargetEntityManagement(); BaseEntityManagement<? extends EntityElement> targetEntityManagement = getTargetEntityManagement();
((ObjectNode) relation).replace(Relation.TARGET_PROPERTY, targetEntityManagement.serializeAsJson()); ((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); element = oDatabaseDocument.newEdge(source, target, elementType);
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
return element; return element;
} }
@ -187,7 +187,7 @@ public abstract class BaseRelationManagement<SEM extends BaseEntityManagement<?
logger.debug("Trying to update {} : {}", elementType, jsonNode); logger.debug("Trying to update {} : {}", elementType, jsonNode);
OEdge edge = getElement(); OEdge edge = getElement();
ERManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys); ElementManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
if(accessType.compareTo(AccessType.CONSISTS_OF) == 0) { if(accessType.compareTo(AccessType.CONSISTS_OF) == 0) {
JsonNode target = jsonNode.get(Relation.TARGET_PROPERTY); JsonNode target = jsonNode.get(Relation.TARGET_PROPERTY);

View File

@ -7,7 +7,7 @@ import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.base.reference.AccessType; 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.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; 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.api.exceptions.query.InvalidQueryException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; 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.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.entities.BaseEntityManagement; import org.gcube.informationsystem.resourceregistry.instances.base.entities.BaseEntityManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement; import org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
@ -46,7 +46,7 @@ import com.orientechnologies.orient.core.sql.executor.OResultSet;
/** /**
* @author Luca Frosini (ISTI - CNR) * @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 * 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(); String id = edge.getIdentity().toString();
RelationManagement relationManagement = relationManagements.get(id); RelationManagement relationManagement = relationManagements.get(id);
if(relationManagement == null) { if(relationManagement == null) {
relationManagement = ERManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge); relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(), oDatabaseDocument, edge);
relationManagements.put(id, relationManagement); relationManagements.put(id, relationManagement);
} }
return relationManagement; return relationManagement;
@ -153,7 +153,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
} catch(NotFoundException e) { } catch(NotFoundException e) {
try { 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.", 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); uuid.toString(), (el instanceof OVertex) ? Entity.NAME : Relation.NAME);
throw getSpecificERAvailableInAnotherContextException(error); throw getSpecificERAvailableInAnotherContextException(error);
@ -170,7 +170,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
if(accessType == AccessType.RESOURCE) { if(accessType == AccessType.RESOURCE) {
// Facet and relation are created in calling method // Facet and relation are created in calling method
} else { } else {
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
} }
logger.info("Created {} is {}", OVertex.class.getSimpleName(), 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); Iterable<ODocument> iterable = oDatabaseDocument.browseClass(elementType, polymorphic);
for(ODocument vertex : iterable) { for(ODocument vertex : iterable) {
EntityManagement<?> entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement<?> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, (OVertex) vertex); oDatabaseDocument, (OVertex) vertex);
try { try {
JsonNode jsonNode = entityManagement.serializeAsJson(); JsonNode jsonNode = entityManagement.serializeAsJson();
@ -252,10 +252,10 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
Iterable<?> references = null; Iterable<?> references = null;
if(referenceUUID != null) { if(referenceUUID != null) {
OElement element = ERManagementUtility.getAnyElementByUUID(referenceUUID); OElement element = ElementManagementUtility.getAnyElementByUUID(referenceUUID);
if(element instanceof OVertex) { if(element instanceof OVertex) {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
EntityManagement<Entity> entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement<Entity> entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, (OVertex) element); oDatabaseDocument, (OVertex) element);
String elementType = entityManagement.getElementType(); String elementType = entityManagement.getElementType();
@ -302,7 +302,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
continue; continue;
} }
OClass oClass = ERManagement.getOClass(vertex); OClass oClass = ElementManagement.getOClass(vertex);
if(polymorphic && oClass.isSubClassOf(elementType)) { if(polymorphic && oClass.isSubClassOf(elementType)) {
// OK // OK
} else { } else {
@ -311,7 +311,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
} }
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
EntityManagement entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, vertex); oDatabaseDocument, vertex);
try { try {
if(referenceUUID!=null && entityManagement.getUUID().compareTo(referenceUUID) == 0) { if(referenceUUID!=null && entityManagement.getUUID().compareTo(referenceUUID) == 0) {
@ -392,7 +392,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
while(resultSet.hasNext()) { while(resultSet.hasNext()) {
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OElement element = ERManagement.getElementFromOptional(oResult.getElement()); OElement element = ElementManagement.getElementFromOptional(oResult.getElement());
if(polymorphic) { if(polymorphic) {
OClass oClass = null; OClass oClass = null;
@ -400,7 +400,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
if(element instanceof OEdge) { if(element instanceof OEdge) {
continue; continue;
} }
oClass = ERManagement.getOClass(element); oClass = ElementManagement.getOClass(element);
} catch(Exception e) { } catch(Exception e) {
String error = String.format("Unable to detect type of %s. %s", element.toString(), String error = String.format("Unable to detect type of %s. %s", element.toString(),
Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE); Utility.SHOULD_NOT_OCCUR_ERROR_MESSAGE);
@ -417,7 +417,7 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
OVertex vertex = (OVertex) element; OVertex vertex = (OVertex) element;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
EntityManagement entityManagement = ERManagementUtility.getEntityManagement(getWorkingContext(), EntityManagement entityManagement = ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, vertex); oDatabaseDocument, vertex);
try { try {
if(constraint.containsKey(Entity.HEADER_PROPERTY + "." + Header.UUID_PROPERTY)) { if(constraint.containsKey(Entity.HEADER_PROPERTY + "." + Header.UUID_PROPERTY)) {
@ -446,13 +446,13 @@ public abstract class EntityManagement<E extends BaseEntity> extends BaseEntityM
try { try {
oDatabaseDocument = getWorkingContext().getDatabaseDocument(PermissionMode.READER); 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) { if(relationAccessType != AccessType.IS_RELATED_TO && relationAccessType != AccessType.CONSISTS_OF) {
String error = String.format("%s must be a relation type", relationType); String error = String.format("%s must be a relation type", relationType);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);
} }
AccessType referenceAccessType = ERManagementUtility.getBaseAccessType(referenceType); AccessType referenceAccessType = ElementManagementUtility.getBaseAccessType(referenceType);
if(referenceAccessType != AccessType.RESOURCE && referenceAccessType != AccessType.FACET) { if(referenceAccessType != AccessType.RESOURCE && referenceAccessType != AccessType.FACET) {
String error = String.format("%s must be a en entity type", referenceType); String error = String.format("%s must be a en entity type", referenceType);
throw new ResourceRegistryException(error); throw new ResourceRegistryException(error);

View File

@ -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.FacetAvailableInAnotherContextException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; 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.fasterxml.jackson.databind.JsonNode;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
@ -60,7 +60,7 @@ public class FacetManagement extends EntityManagement<Facet> {
@Override @Override
protected OVertex reallyUpdate() throws FacetNotFoundException, ResourceRegistryException { protected OVertex reallyUpdate() throws FacetNotFoundException, ResourceRegistryException {
OVertex facet = getElement(); OVertex facet = getElement();
facet = (OVertex) ERManagement.updateProperties(oClass, facet, jsonNode, ignoreKeys, ignoreStartWithKeys); facet = (OVertex) ElementManagement.updateProperties(oClass, facet, jsonNode, ignoreKeys, ignoreStartWithKeys);
return facet; return facet;
} }

View File

@ -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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; 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.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.base.relations.BaseRelationManagement; 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.EntityManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.entities.FacetManagement; 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; ResourceManagement resourceManagement = null;
if(sourceResource == null) { if(sourceResource == null) {
resourceManagement = (ResourceManagement) ERManagementUtility.getEntityManagement(getWorkingContext(), resourceManagement = (ResourceManagement) ElementManagementUtility.getEntityManagement(getWorkingContext(),
oDatabaseDocument, source); oDatabaseDocument, source);
if(this instanceof IsRelatedToManagement) { if(this instanceof IsRelatedToManagement) {
sourceResource = resourceManagement.serializeAsJson(); sourceResource = resourceManagement.serializeAsJson();
@ -243,7 +243,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
logger.debug("Trying to update {} : {}", elementType, jsonNode); logger.debug("Trying to update {} : {}", elementType, jsonNode);
OEdge edge = getElement(); OEdge edge = getElement();
ERManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys); ElementManagement.updateProperties(oClass, edge, jsonNode, ignoreKeys, ignoreStartWithKeys);
if(accessType.compareTo(AccessType.CONSISTS_OF) == 0) { if(accessType.compareTo(AccessType.CONSISTS_OF) == 0) {
JsonNode target = jsonNode.get(Relation.TARGET_PROPERTY); JsonNode target = jsonNode.get(Relation.TARGET_PROPERTY);
@ -471,7 +471,7 @@ public abstract class RelationManagement<T extends EntityManagement<? extends En
continue; continue;
} }
RelationManagement<T> relationManagement = ERManagementUtility.getRelationManagement(getWorkingContext(), RelationManagement<T> relationManagement = ElementManagementUtility.getRelationManagement(getWorkingContext(),
oDatabaseDocument, edge); oDatabaseDocument, edge);
visitedSourceResources = relationManagement.fullSerialize(visitedSourceResources); visitedSourceResources = relationManagement.fullSerialize(visitedSourceResources);
} }

View File

@ -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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; 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.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -68,7 +68,7 @@ public class QueryImpl implements Query {
while(resultSet.hasNext()) { while(resultSet.hasNext()) {
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
OElement element = ERManagement.getElementFromOptional(oResult.getElement()); OElement element = ElementManagement.getElementFromOptional(oResult.getElement());
try { try {
JsonNode jsonNode = null; JsonNode jsonNode = null;
@ -76,7 +76,7 @@ public class QueryImpl implements Query {
jsonNode = Utility.toJsonNode(element, false); jsonNode = Utility.toJsonNode(element, false);
} else { } else {
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(securityContext, oDatabaseDocument, ElementManagement erManagement = ElementManagementUtility.getERManagement(securityContext, oDatabaseDocument,
element); element);
jsonNode = erManagement.serializeAsJson(); jsonNode = erManagement.serializeAsJson();
} }

View File

@ -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.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility; import org.gcube.informationsystem.resourceregistry.contexts.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement; import org.gcube.informationsystem.resourceregistry.contexts.entities.ContextManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
import org.gcube.informationsystem.resourceregistry.query.Query; import org.gcube.informationsystem.resourceregistry.query.Query;
import org.gcube.informationsystem.resourceregistry.query.QueryImpl; import org.gcube.informationsystem.resourceregistry.query.QueryImpl;
@ -182,7 +182,7 @@ public class Access {
setCalledMethodLocal(HTTPMETHOD.GET, pathValues, map); setCalledMethodLocal(HTTPMETHOD.GET, pathValues, map);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
return erManagement.all(polymorphic); return erManagement.all(polymorphic);
} }
@ -206,7 +206,7 @@ public class Access {
setCalledMethodLocal(HTTPMETHOD.HEAD, pathValues); setCalledMethodLocal(HTTPMETHOD.HEAD, pathValues);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
try { try {
erManagement.setUUID(UUID.fromString(uuid)); erManagement.setUUID(UUID.fromString(uuid));
@ -246,7 +246,7 @@ public class Access {
setCalledMethodLocal(HTTPMETHOD.GET, pathValues); setCalledMethodLocal(HTTPMETHOD.GET, pathValues);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setElementType(type); erManagement.setElementType(type);
erManagement.setUUID(UUID.fromString(uuid)); erManagement.setUUID(UUID.fromString(uuid));
@ -338,7 +338,7 @@ public class Access {
pathValues.add(referenceType); pathValues.add(referenceType);
setCalledMethodLocal(HTTPMETHOD.GET, pathValues); setCalledMethodLocal(HTTPMETHOD.GET, pathValues);
ERManagement erManagement = ERManagementUtility.getERManagement(resourcetype); ElementManagement erManagement = ElementManagementUtility.getERManagement(resourcetype);
if(erManagement instanceof ResourceManagement) { if(erManagement instanceof ResourceManagement) {
UUID refereceUUID = null; UUID refereceUUID = null;

View File

@ -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.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath; import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -76,7 +76,7 @@ public class InstancesManager {
setCalledMethod(HTTPMETHOD.GET, type, map); setCalledMethod(HTTPMETHOD.GET, type, map);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
return erManagement.all(polymorphic); return erManagement.all(polymorphic);
} }
@ -95,7 +95,7 @@ public class InstancesManager {
setCalledMethod(HTTPMETHOD.HEAD, type, true); setCalledMethod(HTTPMETHOD.HEAD, type, true);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
try { try {
erManagement.setUUID(UUID.fromString(uuid)); erManagement.setUUID(UUID.fromString(uuid));
@ -131,7 +131,7 @@ public class InstancesManager {
setCalledMethod(HTTPMETHOD.GET, type, true); setCalledMethod(HTTPMETHOD.GET, type, true);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setElementType(type); erManagement.setElementType(type);
erManagement.setUUID(UUID.fromString(uuid)); erManagement.setUUID(UUID.fromString(uuid));
@ -156,7 +156,7 @@ public class InstancesManager {
setCalledMethod(HTTPMETHOD.PUT, type, true); setCalledMethod(HTTPMETHOD.PUT, type, true);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setUUID(UUID.fromString(uuid)); erManagement.setUUID(UUID.fromString(uuid));
erManagement.setElementType(type); erManagement.setElementType(type);
erManagement.setJson(json); erManagement.setJson(json);
@ -177,7 +177,7 @@ public class InstancesManager {
setCalledMethod(HTTPMETHOD.DELETE, type, true); setCalledMethod(HTTPMETHOD.DELETE, type, true);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
erManagement.setUUID(UUID.fromString(uuid)); erManagement.setUUID(UUID.fromString(uuid));
erManagement.delete(); erManagement.delete();

View File

@ -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.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath; import org.gcube.informationsystem.resourceregistry.api.rest.InstancePath;
import org.gcube.informationsystem.resourceregistry.api.rest.TypePath; 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.SchemaManagement;
import org.gcube.informationsystem.resourceregistry.types.SchemaManagementImpl; import org.gcube.informationsystem.resourceregistry.types.SchemaManagementImpl;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
@ -85,7 +85,7 @@ public class SchemaManager {
throw new ResourceRegistryException("No superclasses defined"); throw new ResourceRegistryException("No superclasses defined");
} }
for(String superClass : superClasses) { for(String superClass : superClasses) {
accessType = ERManagementUtility.getBaseAccessType(superClass); accessType = ElementManagementUtility.getBaseAccessType(superClass);
break; break;
} }
} catch (ResourceRegistryException e) { } catch (ResourceRegistryException e) {

View File

@ -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.exceptions.entity.resource.ResourceNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath; import org.gcube.informationsystem.resourceregistry.api.rest.AccessPath;
import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath; import org.gcube.informationsystem.resourceregistry.api.rest.SharingPath;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -57,7 +57,7 @@ public class SharingManagement {
setCalledMethod(HTTPMETHOD.PUT, type); setCalledMethod(HTTPMETHOD.PUT, type);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
UUID uuid = null; UUID uuid = null;
try { try {
uuid = UUID.fromString(id); uuid = UUID.fromString(id);
@ -94,7 +94,7 @@ public class SharingManagement {
setCalledMethod(HTTPMETHOD.DELETE, type); setCalledMethod(HTTPMETHOD.DELETE, type);
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
UUID uuid = null; UUID uuid = null;
try { try {
uuid = UUID.fromString(id); uuid = UUID.fromString(id);

View File

@ -12,9 +12,9 @@ import java.util.Set;
import javax.activation.UnsupportedDataTypeException; import javax.activation.UnsupportedDataTypeException;
import org.gcube.informationsystem.base.reference.AccessType; 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.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.base.reference.relations.BaseRelation; import org.gcube.informationsystem.base.reference.relations.RelationElement;
import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.entities.Resource; 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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.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.FacetTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.types.properties.PropertyTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.properties.PropertyTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.types.relations.ConsistsOfTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.relations.ConsistsOfTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.types.relations.IsRelatedToTypeDefinitionManagement; 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.TypeBinder;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.properties.PropertyDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyDefinition;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.properties.ResourceEntryDefinition; import org.gcube.informationsystem.types.reference.properties.LinkedEntity;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -134,7 +134,7 @@ public class SchemaManagementImpl implements SchemaManagement {
private TypeDefinition getTypeDefinition(OClass oClass) throws SchemaException { private TypeDefinition getTypeDefinition(OClass oClass) throws SchemaException {
try { try {
ERManagement<? extends OElement> erManagement = null; ElementManagement<? extends OElement> erManagement = null;
if(oClass.isSubClassOf(Property.NAME)) { if(oClass.isSubClassOf(Property.NAME)) {
erManagement = new PropertyTypeDefinitionManagement(); erManagement = new PropertyTypeDefinitionManagement();
@ -212,19 +212,19 @@ public class SchemaManagementImpl implements SchemaManagement {
static { static {
baseTypes = new HashSet<String>(); baseTypes = new HashSet<String>();
baseTypes.add(BaseProperty.NAME); baseTypes.add(PropertyElement.NAME);
baseTypes.add(BaseEntity.NAME); baseTypes.add(EntityElement.NAME);
baseTypes.add(BaseRelation.NAME); baseTypes.add(RelationElement.NAME);
typeDefinitionTypes = new HashSet<String>(); typeDefinitionTypes = new HashSet<String>();
typeDefinitionTypes.add(PropertyTypeDefinition.NAME); typeDefinitionTypes.add(PropertyType.NAME);
typeDefinitionTypes.add(ResourceEntryDefinition.NAME); typeDefinitionTypes.add(LinkedEntity.NAME);
typeDefinitionTypes.add(EntityTypeDefinition.NAME); typeDefinitionTypes.add(EntityType.NAME);
typeDefinitionTypes.add(ResourceTypeDefinition.NAME); typeDefinitionTypes.add(ResourceType.NAME);
typeDefinitionTypes.add(FacetTypeDefinition.NAME); typeDefinitionTypes.add(FacetType.NAME);
typeDefinitionTypes.add(RelationTypeDefinition.NAME); typeDefinitionTypes.add(RelationType.NAME);
typeDefinitionTypes.add(IsRelatedToTypeDefinition.NAME); typeDefinitionTypes.add(IsRelatedToType.NAME);
typeDefinitionTypes.add(ConsistsOfTypeDefinition.NAME); typeDefinitionTypes.add(ConsistsOfType.NAME);
} }
protected void registerTypeSchema(TypeDefinition typeDefinition, AccessType baseType) protected void registerTypeSchema(TypeDefinition typeDefinition, AccessType baseType)
@ -248,11 +248,11 @@ public class SchemaManagementImpl implements SchemaManagement {
OClass oClass = null; OClass oClass = null;
if(BaseEntity.class.isAssignableFrom(baseType.getTypeClass())) { if(EntityElement.class.isAssignableFrom(baseType.getTypeClass())) {
oClass = oDatabaseDocument.createVertexClass(typeDefinition.getName()); oClass = oDatabaseDocument.createVertexClass(typeDefinition.getName());
} else if(BaseRelation.class.isAssignableFrom(baseType.getTypeClass())) { } else if(RelationElement.class.isAssignableFrom(baseType.getTypeClass())) {
oClass = oDatabaseDocument.createEdgeClass(typeDefinition.getName()); oClass = oDatabaseDocument.createEdgeClass(typeDefinition.getName());
} else if(BaseProperty.class.isAssignableFrom(baseType.getTypeClass())) { } else if(PropertyElement.class.isAssignableFrom(baseType.getTypeClass())) {
oClass = oSchema.createClass(typeDefinition.getName()); oClass = oSchema.createClass(typeDefinition.getName());
} else { } else {
String error = String.format("Allowed superclass are %s, %s, %s, or any subclasses of them.", 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); oClass.setSuperClasses(oSuperclasses);
} }
if(!(typeDefinition instanceof ResourceTypeDefinition)) { if(!(typeDefinition instanceof ResourceType)) {
// A Resource cannot contains any properties. // A Resource cannot contains any properties.
Set<PropertyDefinition> propertyDefinitions = typeDefinition.getProperties(); Set<PropertyDefinition> propertyDefinitions = typeDefinition.getProperties();
@ -306,10 +306,10 @@ public class SchemaManagementImpl implements SchemaManagement {
if(!typeDefinitionTypes.contains(typeDefinition.getName())) { if(!typeDefinitionTypes.contains(typeDefinition.getName())) {
switch(oType) { switch(oType) {
case EMBEDDEDLIST: 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"); + " support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354");
case EMBEDDEDSET: 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"); + " support is currently disabled due to OrientDB bug see https://github.com/orientechnologies/orientdb/issues/7354");
default: default:
break; break;
@ -419,7 +419,7 @@ public class SchemaManagementImpl implements SchemaManagement {
registerTypeSchema(typeDefinition, accessType); registerTypeSchema(typeDefinition, accessType);
ERManagement<? extends OElement> erManagement = null; ElementManagement<? extends OElement> erManagement = null;
switch(accessType) { switch(accessType) {
case PROPERTY: case PROPERTY:

View File

@ -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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; 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.instances.base.entities.BaseEntityManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.gcube.informationsystem.types.TypeBinder; 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.Logger;
import org.slf4j.LoggerFactory; 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.OResult;
import com.orientechnologies.orient.core.sql.executor.OResultSet; 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); private static Logger logger = LoggerFactory.getLogger(EntityTypeDefinitionManagement.class);
protected String name; protected String name;
protected EntityTypeDefinitionManagement(Class<E> clz) { protected EntityTypeDefinitionManagement(Class<E> clz) {
super(AccessType.ENTITY_TYPE_DEFINITION); super(AccessType.ENTITY_TYPE);
this.elementType = TypeBinder.getType(clz); this.elementType = TypeBinder.getType(clz);
} }
@ -62,10 +62,10 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
if(name == null) { if(name == null) {
if(element == null) { if(element == null) {
if(jsonNode != null) { if(jsonNode != null) {
name = jsonNode.get(EntityTypeDefinition.NAME_PROPERTY).asText(); name = jsonNode.get(EntityType.NAME_PROPERTY).asText();
} }
} else { } else {
name = element.getProperty(EntityTypeDefinition.NAME_PROPERTY); name = element.getProperty(EntityType.NAME_PROPERTY);
} }
} }
return name; return name;
@ -92,7 +92,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException { protected OVertex reallyUpdate() throws NotFoundException, ResourceRegistryException {
logger.debug("Going to update {} for {}", this.elementType, getName()); logger.debug("Going to update {} for {}", this.elementType, getName());
OVertex entityTypeDefinition = getElement(); OVertex entityTypeDefinition = getElement();
entityTypeDefinition = (OVertex) ERManagement.updateProperties(oClass, entityTypeDefinition, jsonNode, entityTypeDefinition = (OVertex) ElementManagement.updateProperties(oClass, entityTypeDefinition, jsonNode,
ignoreKeys, ignoreStartWithKeys); ignoreKeys, ignoreStartWithKeys);
return entityTypeDefinition; 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"); 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() + "\""; + getName() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
@ -144,7 +144,7 @@ public abstract class EntityTypeDefinitionManagement<E extends EntityTypeDefinit
} }
OResult oResult = resultSet.next(); 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)); 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); 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)); logger.info("Created {} is {}", OVertex.class.getSimpleName(), Utility.toJsonString(element, true));

View File

@ -2,18 +2,18 @@ package org.gcube.informationsystem.resourceregistry.types.entities;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; 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; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
public class FacetTypeDefinitionManagement extends EntityTypeDefinitionManagement<FacetTypeDefinition> { public class FacetTypeDefinitionManagement extends EntityTypeDefinitionManagement<FacetType> {
public FacetTypeDefinitionManagement() { public FacetTypeDefinitionManagement() {
super(FacetTypeDefinition.class); super(FacetType.class);
} }
public FacetTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException { public FacetTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
super(securityContext, oDatabaseDocument, FacetTypeDefinition.class); super(securityContext, oDatabaseDocument, FacetType.class);
} }
} }

View File

@ -2,18 +2,18 @@ package org.gcube.informationsystem.resourceregistry.types.entities;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; 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; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
public class ResourceTypeDefinitionManagement extends EntityTypeDefinitionManagement<ResourceTypeDefinition> { public class ResourceTypeDefinitionManagement extends EntityTypeDefinitionManagement<ResourceType> {
public ResourceTypeDefinitionManagement() { public ResourceTypeDefinitionManagement() {
super(ResourceTypeDefinition.class); super(ResourceType.class);
} }
public ResourceTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException { public ResourceTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
super(securityContext, oDatabaseDocument, ResourceTypeDefinition.class); super(securityContext, oDatabaseDocument, ResourceType.class);
} }
} }

View File

@ -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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; 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.resourceregistry.utils.Utility;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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.OResult;
import com.orientechnologies.orient.core.sql.executor.OResultSet; 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); private static Logger logger = LoggerFactory.getLogger(PropertyTypeDefinitionManagement.class);
protected String name; protected String name;
public PropertyTypeDefinitionManagement() { public PropertyTypeDefinitionManagement() {
super(AccessType.PROPERTY_TYPE_DEFINITION); super(AccessType.PROPERTY_TYPE);
this.elementType = PropertyTypeDefinition.NAME; this.elementType = PropertyType.NAME;
} }
public PropertyTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException { public PropertyTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) throws ResourceRegistryException {
@ -61,10 +61,10 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
if(name == null) { if(name == null) {
if(element == null) { if(element == null) {
if(jsonNode != null) { if(jsonNode != null) {
name = jsonNode.get(PropertyTypeDefinition.NAME_PROPERTY).asText(); name = jsonNode.get(PropertyType.NAME_PROPERTY).asText();
} }
} else { } else {
name = element.getProperty(PropertyTypeDefinition.NAME_PROPERTY); name = element.getProperty(PropertyType.NAME_PROPERTY);
} }
} }
return name; return name;
@ -82,22 +82,22 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
@Override @Override
protected OElement reallyCreate() throws AlreadyPresentException, ResourceRegistryException { 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(); return createElement();
} }
@Override @Override
protected OElement reallyUpdate() throws NotFoundException, ResourceRegistryException { 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(); OElement propertyTypeDefinition = getElement();
propertyTypeDefinition = (OElement) ERManagement.updateProperties(oClass, propertyTypeDefinition, jsonNode, propertyTypeDefinition = (OElement) ElementManagement.updateProperties(oClass, propertyTypeDefinition, jsonNode,
ignoreKeys, ignoreStartWithKeys); ignoreKeys, ignoreStartWithKeys);
return propertyTypeDefinition; return propertyTypeDefinition;
} }
@Override @Override
protected boolean reallyDelete() throws NotFoundException, ResourceRegistryException { 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(); getElement().delete();
return true; return true;
} }
@ -130,7 +130,7 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
throw new NotFoundException("null name does not allow to retrieve the Element"); 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() + "\""; + getName() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
@ -142,7 +142,7 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
} }
OResult oResult = resultSet.next(); 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)); logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true));
@ -165,9 +165,9 @@ public class PropertyTypeDefinitionManagement extends ERManagement<OElement> {
try { try {
this.element = new ODocument(elementType); 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; return element;
} catch(ResourceRegistryException e) { } catch(ResourceRegistryException e) {

View File

@ -3,23 +3,23 @@ package org.gcube.informationsystem.resourceregistry.types.relations;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.types.entities.FacetTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.FacetTypeDefinitionManagement;
import org.gcube.informationsystem.types.reference.entities.FacetTypeDefinition; import org.gcube.informationsystem.types.reference.entities.FacetType;
import org.gcube.informationsystem.types.reference.relations.ConsistsOfTypeDefinition; import org.gcube.informationsystem.types.reference.relations.ConsistsOfType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
public class ConsistsOfTypeDefinitionManagement public class ConsistsOfTypeDefinitionManagement
extends RelationTypeDefinitionManagement<FacetTypeDefinitionManagement,FacetTypeDefinition> { extends RelationTypeDefinitionManagement<FacetTypeDefinitionManagement,FacetType> {
public ConsistsOfTypeDefinitionManagement() { public ConsistsOfTypeDefinitionManagement() {
super(FacetTypeDefinition.class); super(FacetType.class);
this.elementType = ConsistsOfTypeDefinition.NAME; this.elementType = ConsistsOfType.NAME;
} }
public ConsistsOfTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) public ConsistsOfTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument)
throws ResourceRegistryException { throws ResourceRegistryException {
super(securityContext, oDatabaseDocument, FacetTypeDefinition.class); super(securityContext, oDatabaseDocument, FacetType.class);
this.elementType = ConsistsOfTypeDefinition.NAME; this.elementType = ConsistsOfType.NAME;
} }
@Override @Override

View File

@ -3,23 +3,23 @@ package org.gcube.informationsystem.resourceregistry.types.relations;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.relations.IsRelatedToTypeDefinition; import org.gcube.informationsystem.types.reference.relations.IsRelatedToType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
public class IsRelatedToTypeDefinitionManagement public class IsRelatedToTypeDefinitionManagement
extends RelationTypeDefinitionManagement<ResourceTypeDefinitionManagement,ResourceTypeDefinition> { extends RelationTypeDefinitionManagement<ResourceTypeDefinitionManagement,ResourceType> {
public IsRelatedToTypeDefinitionManagement() { public IsRelatedToTypeDefinitionManagement() {
super(ResourceTypeDefinition.class); super(ResourceType.class);
this.elementType = IsRelatedToTypeDefinition.NAME; this.elementType = IsRelatedToType.NAME;
} }
public IsRelatedToTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument) public IsRelatedToTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument)
throws ResourceRegistryException { throws ResourceRegistryException {
super(securityContext, oDatabaseDocument, ResourceTypeDefinition.class); super(securityContext, oDatabaseDocument, ResourceType.class);
this.elementType = IsRelatedToTypeDefinition.NAME; this.elementType = IsRelatedToType.NAME;
} }
@Override @Override

View File

@ -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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext;
import org.gcube.informationsystem.resourceregistry.dbinitialization.DatabaseEnvironment; 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.instances.base.relations.BaseRelationManagement;
import org.gcube.informationsystem.resourceregistry.types.entities.EntityTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.EntityTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement; import org.gcube.informationsystem.resourceregistry.types.entities.ResourceTypeDefinitionManagement;
import org.gcube.informationsystem.resourceregistry.utils.Utility; import org.gcube.informationsystem.resourceregistry.utils.Utility;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.entities.ResourceTypeDefinition; import org.gcube.informationsystem.types.reference.entities.ResourceType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import com.orientechnologies.orient.core.db.document.ODatabaseDocument; import com.orientechnologies.orient.core.db.document.ODatabaseDocument;
import com.orientechnologies.orient.core.record.OEdge; 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.OResult;
import com.orientechnologies.orient.core.sql.executor.OResultSet; 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> { extends BaseRelationManagement<ResourceTypeDefinitionManagement, T> {
protected String name; protected String name;
public RelationTypeDefinitionManagement(Class<TT> clz) { public RelationTypeDefinitionManagement(Class<TT> clz) {
super(AccessType.RELATION_TYPE_DEFINITION, ResourceTypeDefinition.class, clz); super(AccessType.RELATION_TYPE, ResourceType.class, clz);
this.elementType = RelationTypeDefinition.NAME; this.elementType = RelationType.NAME;
} }
public RelationTypeDefinitionManagement(SecurityContext securityContext, ODatabaseDocument oDatabaseDocument, Class<TT> clz) throws ResourceRegistryException { 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(name == null) {
if(element == null) { if(element == null) {
if(jsonNode != null) { if(jsonNode != null) {
name = jsonNode.get(RelationTypeDefinition.NAME_PROPERTY).asText(); name = jsonNode.get(RelationType.NAME_PROPERTY).asText();
} }
} else { } else {
name = element.getProperty(RelationTypeDefinition.NAME_PROPERTY); name = element.getProperty(RelationType.NAME_PROPERTY);
} }
} }
return name; return name;
@ -74,7 +74,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
@Override @Override
protected OEdge reallyCreate() throws ResourceRegistryException { 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(sourceEntityManagement == null) {
if(!jsonNode.has(Relation.SOURCE_PROPERTY)) { if(!jsonNode.has(Relation.SOURCE_PROPERTY)) {
throw new ResourceRegistryException("Error while creating relation. No source definition found"); 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); element = oDatabaseDocument.newEdge(source, target, elementType);
ERManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys); ElementManagement.updateProperties(oClass, element, jsonNode, ignoreKeys, ignoreStartWithKeys);
return element; return element;
} }
@Override @Override
protected OEdge reallyUpdate() throws NotFoundException, ResourceRegistryException { 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(); OEdge relationTypeDefinition = getElement();
relationTypeDefinition = (OEdge) ERManagement.updateProperties(oClass, relationTypeDefinition, jsonNode, relationTypeDefinition = (OEdge) ElementManagement.updateProperties(oClass, relationTypeDefinition, jsonNode,
ignoreKeys, ignoreStartWithKeys); ignoreKeys, ignoreStartWithKeys);
return relationTypeDefinition; return relationTypeDefinition;
@ -121,7 +121,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
@Override @Override
protected boolean reallyDelete() throws RelationNotFoundException, ResourceRegistryException { 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(); getElement().delete();
return true; 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"); 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() + "\""; + getName() + "\"";
OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>()); OResultSet resultSet = oDatabaseDocument.query(select, new HashMap<>());
@ -166,7 +166,7 @@ public abstract class RelationTypeDefinitionManagement<T extends EntityTypeDefin
} }
OResult oResult = resultSet.next(); 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)); logger.trace("{} with id {} is : {}", elementType, getName(), Utility.toJsonString(element, true));

View File

@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import org.gcube.informationsystem.base.reference.ER; 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.entities.Entity;
import org.gcube.informationsystem.model.reference.properties.Header; import org.gcube.informationsystem.model.reference.properties.Header;
import org.gcube.informationsystem.model.reference.relations.Relation; 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.ContextUtility;
import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext; import org.gcube.informationsystem.resourceregistry.contexts.security.AdminSecurityContext;
import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode; import org.gcube.informationsystem.resourceregistry.contexts.security.SecurityContext.PermissionMode;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -111,7 +111,7 @@ public class Utility {
OResult oResult = resultSet.next(); OResult oResult = resultSet.next();
@SuppressWarnings("unchecked") @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)); logger.trace("{} with id {} is : {}", elementType, uuid.toString(), Utility.toJsonString(element, true));
@ -123,7 +123,7 @@ public class Utility {
return element; 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 { throws ResourceRegistryException {
try { try {
ODocument oDocument = element.getProperty(property); ODocument oDocument = element.getProperty(property);

View File

@ -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.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException; import org.gcube.informationsystem.resourceregistry.api.exceptions.entity.facet.FacetNotFoundException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.query.InvalidQueryException; 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.FacetManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
import org.gcube.informationsystem.resourceregistry.instances.model.relations.ConsistsOfManagement; 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*/ /* Getting all instances of created specific Resources*/
for(String key : resources.keySet()){ for(String key : resources.keySet()){
ResourceManagement resourceManagement = (ResourceManagement) ERManagementUtility.getERManagement(key); ResourceManagement resourceManagement = (ResourceManagement) ElementManagementUtility.getERManagement(key);
String json = resourceManagement.all(false); String json = resourceManagement.all(false);
List<Resource> list = ISMapper.unmarshalList(Resource.class, json); List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
@ -639,7 +639,7 @@ public class ERManagementTest extends ContextTest {
/* Getting all Resources polymorphic and non polymorphic */ /* 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); String json = resourceManagement.all(true);
List<Resource> list = ISMapper.unmarshalList(Resource.class, json); List<Resource> list = ISMapper.unmarshalList(Resource.class, json);
@ -654,7 +654,7 @@ public class ERManagementTest extends ContextTest {
/* Getting all IsRelatedTo polymorphic and non polymorphic */ /* 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); json = isRelatedToManagement.all(true);
@ -672,7 +672,7 @@ public class ERManagementTest extends ContextTest {
/* Getting all ConsistsOf polymorphic and non polymorphic */ /* 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); json = consistsOfManagement.all(true);
List<Resource> consistsOfPolimorphicList = ISMapper.unmarshalList(Resource.class, json); List<Resource> consistsOfPolimorphicList = ISMapper.unmarshalList(Resource.class, json);

View File

@ -8,8 +8,8 @@ import org.gcube.informationsystem.model.reference.entities.Facet;
import org.gcube.informationsystem.model.reference.relations.ConsistsOf; import org.gcube.informationsystem.model.reference.relations.ConsistsOf;
import org.gcube.informationsystem.resourceregistry.ContextTest; import org.gcube.informationsystem.resourceregistry.ContextTest;
import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException; import org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagement; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement;
import org.gcube.informationsystem.resourceregistry.instances.base.ERManagementUtility; import org.gcube.informationsystem.resourceregistry.instances.base.ElementManagementUtility;
import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement; import org.gcube.informationsystem.resourceregistry.instances.model.entities.ResourceManagement;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl; import org.gcube.resourcemanagement.model.impl.entities.resources.EServiceImpl;
@ -99,7 +99,7 @@ public class ResourceManagementTest extends ContextTest {
String type = Service.NAME; String type = Service.NAME;
@SuppressWarnings("rawtypes") @SuppressWarnings("rawtypes")
ERManagement erManagement = ERManagementUtility.getERManagement(type); ElementManagement erManagement = ElementManagementUtility.getERManagement(type);
if (erManagement instanceof ResourceManagement) { if (erManagement instanceof ResourceManagement) {
boolean[] booleans = new boolean[] {true, false}; boolean[] booleans = new boolean[] {true, false};

View File

@ -6,8 +6,8 @@ package org.gcube.informationsystem.resourceregistry.types;
import java.util.List; import java.util.List;
import org.gcube.informationsystem.base.reference.AccessType; 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.base.reference.properties.BaseProperty; import org.gcube.informationsystem.base.reference.properties.PropertyElement;
import org.gcube.informationsystem.context.reference.entities.Context; import org.gcube.informationsystem.context.reference.entities.Context;
import org.gcube.informationsystem.model.reference.entities.Entity; import org.gcube.informationsystem.model.reference.entities.Entity;
import org.gcube.informationsystem.model.reference.entities.Facet; 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.SchemaAlreadyPresentException;
import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException; import org.gcube.informationsystem.resourceregistry.api.exceptions.schema.SchemaException;
import org.gcube.informationsystem.types.TypeBinder; import org.gcube.informationsystem.types.TypeBinder;
import org.gcube.informationsystem.types.impl.entities.EntityTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.entities.EntityTypeImpl;
import org.gcube.informationsystem.types.impl.properties.PropertyTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.properties.PropertyTypeImpl;
import org.gcube.informationsystem.types.impl.relations.RelationTypeDefinitionImpl; import org.gcube.informationsystem.types.impl.relations.RelationTypeImpl;
import org.gcube.informationsystem.types.reference.TypeDefinition; import org.gcube.informationsystem.types.reference.TypeDefinition;
import org.gcube.informationsystem.types.reference.entities.EntityTypeDefinition; import org.gcube.informationsystem.types.reference.entities.EntityType;
import org.gcube.informationsystem.types.reference.properties.PropertyTypeDefinition; import org.gcube.informationsystem.types.reference.properties.PropertyType;
import org.gcube.informationsystem.types.reference.relations.RelationTypeDefinition; import org.gcube.informationsystem.types.reference.relations.RelationType;
import org.gcube.informationsystem.utils.ISMapper; import org.gcube.informationsystem.utils.ISMapper;
import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.AccessPointFacet;
import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet; import org.gcube.resourcemanagement.model.reference.entities.facets.ContactFacet;
@ -50,7 +50,7 @@ public class SchemaManagementImplTest {
@Test @Test
public void registerPropertyTypeSchema() throws Exception { public void registerPropertyTypeSchema() throws Exception {
Class<? extends BaseProperty> clz = Header.class; Class<? extends PropertyElement> clz = Header.class;
String json = TypeBinder.serializeType(clz); String json = TypeBinder.serializeType(clz);
logger.debug(json); logger.debug(json);
//new SchemaManagementImpl().create(json, AccessType.PROPERTY); //new SchemaManagementImpl().create(json, AccessType.PROPERTY);
@ -102,7 +102,7 @@ public class SchemaManagementImplTest {
@Test @Test
public void registerRelation() throws Exception { public void registerRelation() throws Exception {
Class<? extends ISManageable> clz = Hosts.class; Class<? extends Element> clz = Hosts.class;
String json = TypeBinder.serializeType(clz); String json = TypeBinder.serializeType(clz);
logger.trace(json); logger.trace(json);
// new SchemaManagementImpl().registerFacetSchema(json); // new SchemaManagementImpl().registerFacetSchema(json);
@ -166,8 +166,8 @@ public class SchemaManagementImplTest {
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
try { try {
schemaManagement.read(BaseProperty.NAME, includeSubTypes); schemaManagement.read(PropertyElement.NAME, includeSubTypes);
throw new Exception("Should not be allowed to get " + BaseProperty.NAME + " schema"); throw new Exception("Should not be allowed to get " + PropertyElement.NAME + " schema");
} catch (SchemaException e) { } catch (SchemaException e) {
} }
@ -190,7 +190,7 @@ public class SchemaManagementImplTest {
@Test(expected=SchemaAlreadyPresentException.class) @Test(expected=SchemaAlreadyPresentException.class)
public void createPropertyType() throws Exception { public void createPropertyType() throws Exception {
PropertyTypeDefinition<ValueSchema> propertyTypeDefinition = new PropertyTypeDefinitionImpl<>(ValueSchema.class); PropertyType<ValueSchema> propertyTypeDefinition = new PropertyTypeImpl<>(ValueSchema.class);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(ValueSchema.NAME); ((SchemaManagementImpl) schemaManagement).setTypeName(ValueSchema.NAME);
@ -202,7 +202,7 @@ public class SchemaManagementImplTest {
@Test(expected=SchemaAlreadyPresentException.class) @Test(expected=SchemaAlreadyPresentException.class)
public void createEncryptedType() throws Exception { public void createEncryptedType() throws Exception {
PropertyTypeDefinition<Encrypted> propertyTypeDefinition = new PropertyTypeDefinitionImpl<>(Encrypted.class); PropertyType<Encrypted> propertyTypeDefinition = new PropertyTypeImpl<>(Encrypted.class);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(Encrypted.NAME); ((SchemaManagementImpl) schemaManagement).setTypeName(Encrypted.NAME);
@ -214,11 +214,11 @@ public class SchemaManagementImplTest {
@Test(expected=SchemaAlreadyPresentException.class) @Test(expected=SchemaAlreadyPresentException.class)
public void createContextType() throws Exception { public void createContextType() throws Exception {
EntityTypeDefinition entityTypeDefinition = new EntityTypeDefinitionImpl(Context.class); EntityType entityTypeDefinition = new EntityTypeImpl(Context.class);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(Context.NAME); ((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); logger.debug(ret);
@ -226,7 +226,7 @@ public class SchemaManagementImplTest {
@Test(expected=SchemaAlreadyPresentException.class) @Test(expected=SchemaAlreadyPresentException.class)
public void createFacetType() throws Exception { public void createFacetType() throws Exception {
EntityTypeDefinition entityTypeDefinition = new EntityTypeDefinitionImpl(AccessPointFacet.class); EntityType entityTypeDefinition = new EntityTypeImpl(AccessPointFacet.class);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(AccessPointFacet.NAME); ((SchemaManagementImpl) schemaManagement).setTypeName(AccessPointFacet.NAME);
@ -238,7 +238,7 @@ public class SchemaManagementImplTest {
@Test(expected=SchemaAlreadyPresentException.class) @Test(expected=SchemaAlreadyPresentException.class)
public void createResourceType() throws Exception { public void createResourceType() throws Exception {
EntityTypeDefinition entityTypeDefinition = new EntityTypeDefinitionImpl(EService.class); EntityType entityTypeDefinition = new EntityTypeImpl(EService.class);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(EService.NAME); ((SchemaManagementImpl) schemaManagement).setTypeName(EService.NAME);
@ -246,7 +246,7 @@ public class SchemaManagementImplTest {
logger.debug(ret); logger.debug(ret);
entityTypeDefinition = new EntityTypeDefinitionImpl(RunningPlugin.class); entityTypeDefinition = new EntityTypeImpl(RunningPlugin.class);
schemaManagement = new SchemaManagementImpl(); schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(RunningPlugin.NAME); ((SchemaManagementImpl) schemaManagement).setTypeName(RunningPlugin.NAME);
@ -259,10 +259,10 @@ public class SchemaManagementImplTest {
@Test @Test
public void createRelationTypeDefinitionType() throws Exception { public void createRelationTypeDefinitionType() throws Exception {
@SuppressWarnings({"unchecked", "rawtypes"}) @SuppressWarnings({"unchecked", "rawtypes"})
RelationTypeDefinition<?, ?> relationTypeDefinition = new RelationTypeDefinitionImpl(RelationTypeDefinition.class); RelationType<?, ?> relationTypeDefinition = new RelationTypeImpl(RelationType.class);
SchemaManagement schemaManagement = new SchemaManagementImpl(); SchemaManagement schemaManagement = new SchemaManagementImpl();
((SchemaManagementImpl) schemaManagement).setTypeName(RelationTypeDefinition.NAME); ((SchemaManagementImpl) schemaManagement).setTypeName(RelationType.NAME);
String ret = ISMapper.marshal(relationTypeDefinition); String ret = ISMapper.marshal(relationTypeDefinition);