Class RelationManagement<T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,TET extends org.gcube.informationsystem.types.reference.entities.EntityType>
- java.lang.Object
-
- org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement<com.orientechnologies.orient.core.record.OEdge,org.gcube.informationsystem.types.reference.relations.RelationType<SET,TET>>
-
- org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement<ResourceManagement,T,org.gcube.informationsystem.types.reference.entities.ResourceType,TET>
-
- org.gcube.informationsystem.resourceregistry.instances.model.relations.RelationManagement<T,TET>
-
- All Implemented Interfaces:
ERManagement
- Direct Known Subclasses:
ConsistsOfManagement,IsRelatedToManagement
public abstract class RelationManagement<T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,TET extends org.gcube.informationsystem.types.reference.entities.EntityType> extends RelationElementManagement<ResourceManagement,T,org.gcube.informationsystem.types.reference.entities.ResourceType,TET> implements ERManagement
- Author:
- Luca Frosini (ISTI - CNR)
-
-
Field Summary
Fields Modifier and Type Field Description org.gcube.informationsystem.model.reference.properties.PropagationConstraintdefaultPropagationConstraintprotected booleanforceAddToContextprotected booleanhonourPropagationConstraintsInContextSharingBy the default the system honour the propagation constraints so this variable is initialised as true.protected org.gcube.informationsystem.model.reference.properties.PropagationConstraintpropagationConstraintprotected booleanskippedprotected SecurityContextsourceSecurityContextThe source context of an addToContexprotected SecurityContexttargetSecurityContextThe target context of an addToContex/RemoveFromContext-
Fields inherited from class org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement
IN, includeSource, includeTarget, OUT, sourceEntityClass, sourceEntityManagement, targetEntityClass, targetEntityManagement
-
Fields inherited from class org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement
accessType, affectedInstances, AT, cachedType, complete, DELETED, dryRun, element, elementClass, entryPoint, forceIncludeAllMeta, forceIncludeMeta, ignoreKeys, ignoreStartWithKeys, jsonNode, logger, oClass, oDatabaseDocument, operation, reload, self, typeName, UNDERSCORE, uuid, workingContext
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedRelationManagement(org.gcube.informationsystem.base.reference.AccessType accessType, Class<? extends org.gcube.informationsystem.model.reference.entities.Entity> targetEntityClass, org.gcube.informationsystem.model.reference.properties.PropagationConstraint defaultPropagationConstraint)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToContext(UUID contextUUID)protected voidcheckPropagationConstraint()protected voidchecksourceAndTargetEntityCompliancy()voidforcedAddToContext()protected Map<String,org.gcube.com.fasterxml.jackson.databind.JsonNode>fullSerialize(Map<String,org.gcube.com.fasterxml.jackson.databind.JsonNode> visitedSourceResources)com.orientechnologies.orient.core.record.OEdgegetElement()protected StringgetEntityTypeNotValidErrroMessage(String entityPosition, String requiredType, String effectiveType)protected PropagationConstraintOrientgetPropagationConstraint(com.orientechnologies.orient.core.record.impl.ODocument oDocument)SecurityContextgetSourceSecurityContext()SecurityContextgetTargetSecurityContext()ResourceManagementgiveMeSourceEntityManagementAsIs()voidinternalAddToContext()voidinternalRemoveFromContext()booleanisAvailableOnContext(SecurityContext securityContext)booleanisHonourPropagationConstraintsInContextSharing()protected ResourceManagementnewSourceEntityManagement()protected voidreallyAddToContext()protected com.orientechnologies.orient.core.record.OEdgereallyCreate()protected voidreallyDelete()StringreallyGetAll(boolean polymorphic)protected Map<UUID,org.gcube.com.fasterxml.jackson.databind.JsonNode>reallyRemoveFromContext()protected com.orientechnologies.orient.core.record.OEdgereallyUpdate()voidremoveFromContext(UUID contextUUID)protected Collection<org.gcube.com.fasterxml.jackson.databind.JsonNode>serializeEdges(Iterable<com.orientechnologies.orient.core.record.impl.ODocument> edges, boolean postFilterPolymorphic)protected StringserializeJsonNodeCollectionAsString(Collection<org.gcube.com.fasterxml.jackson.databind.JsonNode> collection)voidsetForceAddToContext(Boolean forceAddToContext)voidsetHonourPropagationConstraintsInContextSharing(boolean honourPropagationConstraintsInContextSharing)voidsetSourceSecurityContext(SecurityContext sourceSecurityContext)Set source security context to evaluate addToContextvoidsetTargetSecurityContext(SecurityContext targetSecurityContext)Set target security context of addToContext/removeFromContext-
Methods inherited from class org.gcube.informationsystem.resourceregistry.instances.base.relations.RelationElementManagement
createCompleteJsonNode, getSourceEntityManagement, getTargetEntityManagement, includeSource, includeTarget, newTargetEntityManagement, setSourceEntityManagement, setTargetEntityManagement
-
Methods inherited from class org.gcube.informationsystem.resourceregistry.instances.base.ElementManagement
all, checkERMatch, checkJsonNode, checkUUIDMatch, cleanCachedSerialization, create, createOrUpdate, delete, exists, getAccessType, getAffectedInstances, getAllProperties, getCachedType, getContexts, getContextsAsObjectNode, getContextsSet, getMandatoryErrorMessage, getNotNullErrorMessage, getObjectFromJsonNode, getOClass, getPropertyForJson, getPropertyMap, getSpecificAlreadyPresentException, getSpecificNotFoundException, getTypeName, getUUID, getWorkingContext, internalCreate, internalCreateOrUdate, internalDelete, internalUpdate, isDryRun, isForceIncludeAllMeta, isForceIncludeMeta, isReload, isUserAllowedToGetPrivacyMeta, read, retrieveElement, retrieveElementFromAnyContext, sanityCheck, serializeAsAffectedInstance, serializeAsJsonNode, serializeSelfAsJsonNode, setAsEntryPoint, setDryRun, setElement, setElementType, setForceIncludeAllMeta, setForceIncludeMeta, setJson, setJsonNode, setOClass, setODatabaseDocument, setOperation, setProperty, setReload, setUUID, setWorkingContext, 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
-
sourceSecurityContext
protected SecurityContext sourceSecurityContext
The source context of an addToContex
-
targetSecurityContext
protected SecurityContext targetSecurityContext
The target context of an addToContex/RemoveFromContext
-
honourPropagationConstraintsInContextSharing
protected boolean honourPropagationConstraintsInContextSharing
By the default the system honour the propagation constraints so this variable is initialised as true. To revert a previous operation or for particular a 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.
-
defaultPropagationConstraint
public final org.gcube.informationsystem.model.reference.properties.PropagationConstraint defaultPropagationConstraint
-
propagationConstraint
protected org.gcube.informationsystem.model.reference.properties.PropagationConstraint propagationConstraint
-
forceAddToContext
protected boolean forceAddToContext
-
skipped
protected boolean skipped
-
-
Constructor Detail
-
RelationManagement
protected RelationManagement(org.gcube.informationsystem.base.reference.AccessType accessType, Class<? extends org.gcube.informationsystem.model.reference.entities.Entity> targetEntityClass, org.gcube.informationsystem.model.reference.properties.PropagationConstraint defaultPropagationConstraint)
-
-
Method Detail
-
setSourceSecurityContext
public void setSourceSecurityContext(SecurityContext sourceSecurityContext)
Description copied from interface:ERManagementSet source security context to evaluate addToContext- Specified by:
setSourceSecurityContextin interfaceERManagement- Parameters:
sourceSecurityContext- the source security context
-
getSourceSecurityContext
public SecurityContext getSourceSecurityContext()
- Specified by:
getSourceSecurityContextin interfaceERManagement
-
setTargetSecurityContext
public void setTargetSecurityContext(SecurityContext targetSecurityContext)
Description copied from interface:ERManagementSet target security context of addToContext/removeFromContext- Specified by:
setTargetSecurityContextin interfaceERManagement
-
getTargetSecurityContext
public SecurityContext getTargetSecurityContext()
- Specified by:
getTargetSecurityContextin interfaceERManagement
-
isHonourPropagationConstraintsInContextSharing
public boolean isHonourPropagationConstraintsInContextSharing()
- Specified by:
isHonourPropagationConstraintsInContextSharingin interfaceERManagement
-
setHonourPropagationConstraintsInContextSharing
public void setHonourPropagationConstraintsInContextSharing(boolean honourPropagationConstraintsInContextSharing)
- Specified by:
setHonourPropagationConstraintsInContextSharingin interfaceERManagement
-
isAvailableOnContext
public boolean isAvailableOnContext(SecurityContext securityContext)
-
getElement
public com.orientechnologies.orient.core.record.OEdge 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.OEdge,org.gcube.informationsystem.types.reference.relations.RelationType<org.gcube.informationsystem.types.reference.entities.ResourceType,TET 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
-
giveMeSourceEntityManagementAsIs
public ResourceManagement giveMeSourceEntityManagementAsIs() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
fullSerialize
protected Map<String,org.gcube.com.fasterxml.jackson.databind.JsonNode> fullSerialize(Map<String,org.gcube.com.fasterxml.jackson.databind.JsonNode> visitedSourceResources) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getPropagationConstraint
protected PropagationConstraintOrient getPropagationConstraint(com.orientechnologies.orient.core.record.impl.ODocument oDocument) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
checkPropagationConstraint
protected void checkPropagationConstraint() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyCreate
protected com.orientechnologies.orient.core.record.OEdge reallyCreate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Overrides:
reallyCreatein classRelationElementManagement<ResourceManagement,T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,org.gcube.informationsystem.types.reference.entities.ResourceType,TET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
newSourceEntityManagement
protected ResourceManagement newSourceEntityManagement() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Specified by:
newSourceEntityManagementin classRelationElementManagement<ResourceManagement,T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,org.gcube.informationsystem.types.reference.entities.ResourceType,TET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
getEntityTypeNotValidErrroMessage
protected String getEntityTypeNotValidErrroMessage(String entityPosition, String requiredType, String effectiveType)
-
checksourceAndTargetEntityCompliancy
protected void checksourceAndTargetEntityCompliancy() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Specified by:
checksourceAndTargetEntityCompliancyin classRelationElementManagement<ResourceManagement,T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,org.gcube.informationsystem.types.reference.entities.ResourceType,TET 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.types.SchemaViolationExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyUpdate
protected com.orientechnologies.orient.core.record.OEdge reallyUpdate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Overrides:
reallyUpdatein classRelationElementManagement<ResourceManagement,T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,org.gcube.informationsystem.types.reference.entities.ResourceType,TET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.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
-
forcedAddToContext
public void forcedAddToContext() 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
-
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
-
reallyRemoveFromContext
protected Map<UUID,org.gcube.com.fasterxml.jackson.databind.JsonNode> 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
-
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
-
removeFromContext
public void removeFromContext(UUID contextUUID) throws 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.NotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
reallyDelete
protected void reallyDelete() throws org.gcube.informationsystem.resourceregistry.api.exceptions.relations.RelationNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- Overrides:
reallyDeletein classRelationElementManagement<ResourceManagement,T extends EntityManagement<? extends org.gcube.informationsystem.model.reference.entities.Entity,TET>,org.gcube.informationsystem.types.reference.entities.ResourceType,TET extends org.gcube.informationsystem.types.reference.entities.EntityType>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.relations.RelationNotFoundExceptionorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
serializeEdges
protected Collection<org.gcube.com.fasterxml.jackson.databind.JsonNode> serializeEdges(Iterable<com.orientechnologies.orient.core.record.impl.ODocument> edges, boolean postFilterPolymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
serializeJsonNodeCollectionAsString
protected String serializeJsonNodeCollectionAsString(Collection<org.gcube.com.fasterxml.jackson.databind.JsonNode> collection) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
- Throws:
org.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.OEdge,org.gcube.informationsystem.types.reference.relations.RelationType<org.gcube.informationsystem.types.reference.entities.ResourceType,TET extends org.gcube.informationsystem.types.reference.entities.EntityType>>- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
-
setForceAddToContext
public void setForceAddToContext(Boolean forceAddToContext)
- Specified by:
setForceAddToContextin interfaceERManagement
-
-