Interface ERManagement
- All Known Implementing Classes:
ConsistsOfManagement,EntityManagement,FacetManagement,IsRelatedToManagement,RelationManagement,ResourceManagement
public interface ERManagement
Contract shared by the OrientDB persistence classes for both Entity Relationship
categories — Entities (
Resource/Facet, via EntityManagement) and
Relations (ConsistsOf/IsRelatedTo, via RelationManagement).
Covers Avalanche Effect context-membership propagation (addToContext(UUID) /
removeFromContext(UUID), with cycle-prevention via the shared getVisited()
set), and the read-path knobs (contexts-map membership view,
hierarchical/active-only-hierarchical reads, context inclusion) that the
Instances Policy Enforcement Point configures before delegating to a concrete
implementation.- Author:
- Luca Frosini (ISTI - CNR)
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddToContext(UUID contextUUID) Adds the entity/relationship to the specified context, evaluating schemas and constraints.Returns the map of affected instances during the operation, mapped by their UUID to their JSON representation.Returns all contexts where this element is visible as a formatted JSON string.org.gcube.com.fasterxml.jackson.databind.node.ObjectNodeReturns all contexts where this element is visible as an ObjectNode mapping Context UUIDs to paths.org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicyReturns the contexts inclusion policy for responses.Returns the Context UUID strings of the memberships listed bygetMembershipView().Gets the view that selects the memberships listed by thecontextsmaps.org.gcube.informationsystem.resourceregistry.api.rest.PropagationModeReturns the propagation mode for context sharing.Returns the sourceInstanceEnvironmentused to evaluate context sharing operations.org.gcube.informationsystem.resourceregistry.api.exceptions.instances.AvailableInAnotherContextExceptionReturns the subclass-specific AvailableInAnotherContextException instance.Returns the targetInstanceEnvironmentof the operation.Returns the shared, mutable set of UUIDs already visited during the currentaddToContext(UUID)cascade.voidPerforms the internal low-level operations to add the entity/relationship to the target context.voidPerforms the internal low-level operations to remove the entity/relationship from the context.booleanGets whether the active-only hierarchical reader channel must be used instead of the unrestricted one - meaningless unlessisHierarchical()is alsotrue.booleanGets whether the operation should force add to context even if the instance is not in source context.booleanGets whether hierarchical lookup is enabled.voidremoveFromContext(UUID contextUUID) Removes the entity/relationship from the specified context.voidsetActiveOnlyHierarchical(boolean activeOnlyHierarchical) Sets whether the active-only hierarchical reader channel must be used instead of the unrestricted one.voidsetContextsPolicy(org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy contextsPolicy) Sets the contexts inclusion policy for responses.voidsetForceAddToContext(boolean forceAddToContext) Sets whether the operation should force add to context even if the instance is not in source context.voidsetHierarchical(boolean hierarchical) Sets whether hierarchical lookup is enabled.voidsetMembershipView(MembershipView membershipView) Sets the view that selects the memberships listed by thecontextsmaps.voidsetPropagationMode(org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode propagationMode) Sets the propagation mode for context sharing.voidSets the source InstanceEnvironment used to evaluate addToContextvoidSets the target security context of addToContext/removeFromContextvoidsetVisited(Set<UUID> visited) Sets the shared, mutable set of UUIDs (entities and relations alike) already visited during the currentaddToContext(UUID)cascade.voidsetWorkingContext(UUID contextUUID) Sets the Context the instance is looked up in, in place of the token Context: the Context a Remove from Context acts on, and withisHierarchical()its descendants too.
-
Method Details
-
getPropagationMode
org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode getPropagationMode()Returns the propagation mode for context sharing.- Returns:
- the propagation mode
-
setPropagationMode
void setPropagationMode(org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode propagationMode) Sets the propagation mode for context sharing.- Parameters:
propagationMode- the propagation mode to set
-
isForceAddToContext
boolean isForceAddToContext()Gets whether the operation should force add to context even if the instance is not in source context.- Returns:
trueif force add,falseotherwise
-
setForceAddToContext
void setForceAddToContext(boolean forceAddToContext) Sets whether the operation should force add to context even if the instance is not in source context.- Parameters:
forceAddToContext-trueto force add,falseotherwise
-
getAffectedInstances
Returns the map of affected instances during the operation, mapped by their UUID to their JSON representation.- Returns:
- the map of affected instances
-
setWorkingContext
Sets the Context the instance is looked up in, in place of the token Context: the Context a Remove from Context acts on, and withisHierarchical()its descendants too.- Parameters:
contextUUID- the UUID of the Context, ornullfor the token Context
-
setSourceInstanceEnvironment
Sets the source InstanceEnvironment used to evaluate addToContext- Parameters:
source- the source security context
-
getSourceInstanceEnvironment
InstanceEnvironment getSourceInstanceEnvironment()Returns the sourceInstanceEnvironmentused to evaluate context sharing operations.- Returns:
- the source instance environment
-
setVisited
Sets the shared, mutable set of UUIDs (entities and relations alike) already visited during the currentaddToContext(UUID)cascade. Checked and populated unconditionally by everyERManagementinstance in the cascade, regardless ofPropagationMode— cycle-safety is kept orthogonal to whatever each mode otherwise decides about re-visiting an already-present instance, so it does not need to be re-derived if propagation semantics change later.- Parameters:
visited- the shared visited-UUID set; the same instance must be threaded through the whole cascade of a singleaddToContext(UUID)call
-
getVisited
Returns the shared, mutable set of UUIDs already visited during the currentaddToContext(UUID)cascade.- Returns:
- the shared visited-UUID set, or
nullif not yet initialised
-
internalAddToContext
void internalAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionPerforms the internal low-level operations to add the entity/relationship to the target context.- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context assignment violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
addToContext
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 Adds the entity/relationship to the specified context, evaluating schemas and constraints.- Parameters:
contextUUID- the UUID of the destination context- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if schema rules are violatedorg.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the context does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context assignment violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
setTargetInstanceEnvironment
Sets the target security context of addToContext/removeFromContext- Parameters:
target- the target instance environment to set
-
getTargetInstanceEnvironment
InstanceEnvironment getTargetInstanceEnvironment()Returns the targetInstanceEnvironmentof the operation.- Returns:
- the target instance environment
-
internalRemoveFromContext
void internalRemoveFromContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionPerforms the internal low-level operations to remove the entity/relationship from the context.- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if removal violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
removeFromContext
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 Removes the entity/relationship from the specified context.- Parameters:
contextUUID- the UUID of the context from which to remove- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if schema rules are violatedorg.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the context does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if removal violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
getSpecificAvailableInAnotherContextException
org.gcube.informationsystem.resourceregistry.api.exceptions.instances.AvailableInAnotherContextException getSpecificAvailableInAnotherContextException(String message) Returns the subclass-specific AvailableInAnotherContextException instance.- Parameters:
message- the exception message- Returns:
- the specific AvailableInAnotherContextException
-
setMembershipView
Sets the view that selects the memberships listed by thecontextsmaps.- Parameters:
membershipView- the membership view to apply
-
getMembershipView
MembershipView getMembershipView()Gets the view that selects the memberships listed by thecontextsmaps.- Returns:
- the membership view
-
getContextsSet
Set<String> getContextsSet() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturns the Context UUID strings of the memberships listed bygetMembershipView().- Returns:
- the set of Context UUID strings
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context mapping failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
getContexts
String getContexts() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturns all contexts where this element is visible as a formatted JSON string.- Returns:
- the JSON string of contexts mapping
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context mapping failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
getContextsAsObjectNode
org.gcube.com.fasterxml.jackson.databind.node.ObjectNode getContextsAsObjectNode() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionReturns all contexts where this element is visible as an ObjectNode mapping Context UUIDs to paths.- Returns:
- the JSON ObjectNode of contexts mapping
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context mapping failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
isHierarchical
boolean isHierarchical()Gets whether hierarchical lookup is enabled.- Returns:
trueif hierarchical,falseotherwise
-
setHierarchical
void setHierarchical(boolean hierarchical) Sets whether hierarchical lookup is enabled.- Parameters:
hierarchical-trueto enable hierarchical,falseotherwise
-
isActiveOnlyHierarchical
boolean isActiveOnlyHierarchical()Gets whether the active-only hierarchical reader channel must be used instead of the unrestricted one - meaningless unlessisHierarchical()is alsotrue.- Returns:
trueif the active-only channel must be used,falseotherwise
-
setActiveOnlyHierarchical
void setActiveOnlyHierarchical(boolean activeOnlyHierarchical) Sets whether the active-only hierarchical reader channel must be used instead of the unrestricted one. The PEP layer sets this tofalseforALL_ADMIN_ROLESholders (unchanged, unrestricted behavior) andtruefor everyone else.- Parameters:
activeOnlyHierarchical-trueto use the active-only channel
-
getContextsPolicy
org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy getContextsPolicy()Returns the contexts inclusion policy for responses.- Returns:
- the contexts policy, or
nullif not explicitly set (falls back toContextsPolicy.DEFAULT)
-
setContextsPolicy
void setContextsPolicy(org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy contextsPolicy) Sets the contexts inclusion policy for responses.- Parameters:
contextsPolicy- the contexts policy to set
-