Class EntityManagement<E extends org.gcube.informationsystem.model.reference.entities.Entity,ET extends org.gcube.informationsystem.types.reference.entities.EntityType>
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.base.ElementManagement<com.orientechnologies.orient.core.record.OVertex,ET>
-
- org.gcube.informationsystem.resourceregistry.base.entities.EntityElementManagement<E,ET>
-
- org.gcube.informationsystem.resourceregistry.instances.model.entities.EntityManagement<E,ET>
-
- All Implemented Interfaces:
ERManagement
- Direct Known Subclasses:
FacetManagement,ResourceManagement
public abstract class EntityManagement<E extends org.gcube.informationsystem.model.reference.entities.Entity,ET extends org.gcube.informationsystem.types.reference.entities.EntityType> extends EntityElementManagement<E,ET> implements ERManagement
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanforceAddToContextprotected booleanhonourPropagationConstraintsInContextSharingBy default the system honour the propagation constraints so this variable is initialised as true.protected Map<String,RelationManagement<?,?>>relationManagementsProvide a cache edge-internal-id -> RelationManagement this avoid to recreate the relationManagement of already visited edgesprotected booleanskippedprotected InstanceEnvironmentsourceInstanceEnvironmentThe source context of an addToContexprotected InstanceEnvironmenttargetInstanceEnvironmentThe target context of an addToContex/RemoveFromContext-
Fields inherited from class org.gcube.informationsystem.resourceregistry.base.entities.EntityElementManagement
IN_PREFIX, OUT_PREFIX
-
Fields inherited from class org.gcube.informationsystem.resourceregistry.base.ElementManagement
accessType, affectedInstances, AT, cachedType, complete, DELETED, DOLLAR, dryRun, element, elementClass, entryPoint, forceIncludeAllMeta, forceIncludeMeta, ignoreKeys, ignoreStartWithKeys, jsonNode, logger, oClass, oDatabaseDocument, operation, reload, self, typeName, UNDERSCORE, uuid, workingEnvironment
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedEntityManagement(org.gcube.informationsystem.base.reference.AccessType accessType)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static org.gcube.com.fasterxml.jackson.databind.JsonNodeaddRelation(org.gcube.com.fasterxml.jackson.databind.JsonNode sourceResource, org.gcube.com.fasterxml.jackson.databind.JsonNode relation, String arrayKey)voidaddToContext(UUID contextUUID)voidaddToRelationManagements(RelationManagement<?,?> relationManagement)protected com.orientechnologies.orient.core.record.OVertexcreateVertex()com.orientechnologies.orient.core.record.OVertexgetElement()protected RelationManagement<?,?>getRelationManagement(com.orientechnologies.orient.core.record.OEdge edge)InstanceEnvironmentgetSourceInstanceEnvironment()InstanceEnvironmentgetTargetInstanceEnvironment()protected EnvironmentgetWorkingEnvironment()voidinternalAddToContext()voidinternalRemoveFromContext()booleanisHonourPropagationConstraintsInContextSharing()Stringquery(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String,String> constraint)protected voidreallyAddToContext()StringreallyGetAll(boolean polymorphic)StringreallyQuery(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String,String> constraint)protected voidreallyRemoveFromContext()voidremoveFromContext(UUID contextUUID)voidsetForceAddToContext(Boolean forceAddToContext)voidsetHonourPropagationConstraintsInContextSharing(boolean honourPropagationConstraintsInContextSharing)voidsetSourceInstanceEnvironment(InstanceEnvironment source)Set source InstanceEnvironment to evaluate addToContextvoidsetTargetInstanceEnvironment(InstanceEnvironment target)Set target security context of addToContext/removeFromContext-
Methods inherited from class org.gcube.informationsystem.resourceregistry.base.entities.EntityElementManagement
addToRelationManagement, getBaseRelationManagement
-
Methods inherited from class org.gcube.informationsystem.resourceregistry.base.ElementManagement
all, checkERMatch, checkJsonNode, checkUUIDMatch, cleanCachedSerialization, create, createCompleteJsonNode, createOrUpdate, delete, exists, getAccessType, getAffectedInstances, getAllProperties, getCachedType, getContexts, getContextsAsObjectNode, getContextsSet, getMandatoryErrorMessage, getNotNullErrorMessage, getOClass, getPropertyForJson, getPropertyMap, getSpecificAlreadyPresentException, getSpecificNotFoundException, getTypeName, getUUID, internalCreate, internalCreateOrUdate, internalDelete, internalUpdate, isDryRun, isForceIncludeAllMeta, isForceIncludeMeta, isReload, isUserAllowedToGetPrivacyMeta, read, reallyCreate, reallyDelete, reallyUpdate, retrieveElement, retrieveElementFromAnyContext, sanityCheck, serializeAsAffectedInstance, serializeAsJsonNode, serializeSelfAsJsonNode, setAsEntryPoint, setDryRun, setElement, setElementType, setForceIncludeAllMeta, setForceIncludeMeta, setJson, setJsonNode, setOClass, setODatabaseDocument, setOperation, setProperty, setReload, setUUID, setWorkingEnvironment, typeSatified, update, updateProperties
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.gcube.informationsystem.resourceregistry.instances.model.ERManagement
getAffectedInstances, getSpecificAvailableInAnotherContextException
-
-
-
-
Field Detail
-
sourceInstanceEnvironment
protected InstanceEnvironment sourceInstanceEnvironment
The source context of an addToContex
-
targetInstanceEnvironment
protected InstanceEnvironment targetInstanceEnvironment
The target context of an addToContex/RemoveFromContext
-
honourPropagationConstraintsInContextSharing
protected boolean honourPropagationConstraintsInContextSharing
By default the system honour the propagation constraints so this variable is initialised as true. To revert a previous operation or for a particular maintenance we could request to the service do not honour the propagation constraints but under certain conditions and with some limitation only. These limitation are required to keep the system in a consistent state. In fact, this directive is only valid for Resources and IsRelatedTo relations. We need to take in account that to add an IsRelatedTo to a context always the source and target Resources must be in such a Context. Please also take into account that adding a Resource to a context always imply to honour the propagation constraints of ConsistsOf relations. In fact, a resource must be characterised least by one facet in any context it belongs. Giving that we cannot made assumption on which facets must be used. A way could be to consider just the facets are mandatory for such a Resource Type, but the type could not have mandatory facets (even every Resource Type in the gCube Model has one mandatory facet). As counterpart, when a Resource is removed from a Context all the facets charactering it must be removed. This option can also be used in conjunction withElementManagement.dryRun=true. This allow to simulate a sharing operation which requires do not honour the propagation constraints.
-
relationManagements
protected Map<String,RelationManagement<?,?>> relationManagements
Provide a cache edge-internal-id -> RelationManagement this avoid to recreate the relationManagement of already visited edges
-
forceAddToContext
protected boolean forceAddToContext
-
skipped
protected boolean skipped
-
-
Method Detail
-
setSourceInstanceEnvironment
public void setSourceInstanceEnvironment(InstanceEnvironment source)
Description copied from interface:ERManagementSet source InstanceEnvironment to evaluate addToContext- Specified by:
setSourceInstanceEnvironmentin interfaceERManagement- Parameters:
source- the source security context
-
getSourceInstanceEnvironment
public InstanceEnvironment getSourceInstanceEnvironment()
- Specified by:
getSourceInstanceEnvironmentin interfaceERManagement
-
setTargetInstanceEnvironment
public void setTargetInstanceEnvironment(InstanceEnvironment target)
Description copied from interface:ERManagementSet target security context of addToContext/removeFromContext- Specified by:
setTargetInstanceEnvironmentin interfaceERManagement
-
getTargetInstanceEnvironment
public InstanceEnvironment getTargetInstanceEnvironment()
- Specified by:
getTargetInstanceEnvironmentin interfaceERManagement
-
isHonourPropagationConstraintsInContextSharing
public boolean isHonourPropagationConstraintsInContextSharing()
- Specified by:
isHonourPropagationConstraintsInContextSharingin interfaceERManagement
-
setHonourPropagationConstraintsInContextSharing
public void setHonourPropagationConstraintsInContextSharing(boolean honourPropagationConstraintsInContextSharing)
- Specified by:
setHonourPropagationConstraintsInContextSharingin interfaceERManagement
-
getWorkingEnvironment
protected Environment getWorkingEnvironment() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Specified by:
getWorkingEnvironmentin classElementManagement<com.orientechnologies.orient.core.record.OVertex,ET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getElement
public com.orientechnologies.orient.core.record.OVertex getElement() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Overrides:
getElementin classElementManagement<com.orientechnologies.orient.core.record.OVertex,ET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getRelationManagement
protected RelationManagement<?,?> getRelationManagement(com.orientechnologies.orient.core.record.OEdge edge) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addToRelationManagements
public void addToRelationManagements(RelationManagement<?,?> relationManagement) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addRelation
protected static org.gcube.com.fasterxml.jackson.databind.JsonNode addRelation(org.gcube.com.fasterxml.jackson.databind.JsonNode sourceResource, org.gcube.com.fasterxml.jackson.databind.JsonNode relation, String arrayKey) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
createVertex
protected com.orientechnologies.orient.core.record.OVertex createVertex() throws org.gcube.informationsystem.resourceregistry.api.exceptions.entities.EntityAlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Overrides:
createVertexin classEntityElementManagement<E extends org.gcube.informationsystem.model.reference.entities.Entity,ET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.entities.EntityAlreadyPresentExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyAddToContext
protected void reallyAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
internalAddToContext
public void internalAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Specified by:
internalAddToContextin interfaceERManagement- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
addToContext
public void addToContext(UUID contextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Specified by:
addToContextin interfaceERManagement- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
internalRemoveFromContext
public void internalRemoveFromContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Specified by:
internalRemoveFromContextin interfaceERManagement- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyRemoveFromContext
protected void reallyRemoveFromContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
removeFromContext
public void removeFromContext(UUID contextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Specified by:
removeFromContextin interfaceERManagement- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyGetAll
public String reallyGetAll(boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Specified by:
reallyGetAllin classElementManagement<com.orientechnologies.orient.core.record.OVertex,ET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyQuery
public String reallyQuery(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String,String> constraint) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
query
public String query(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String,String> constraint) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
setForceAddToContext
public void setForceAddToContext(Boolean forceAddToContext)
- Specified by:
setForceAddToContextin interfaceERManagement
-
-