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 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:
      true if force add, false otherwise
    • 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 - true to force add, false otherwise
    • getAffectedInstances

      Map<UUID,org.gcube.com.fasterxml.jackson.databind.JsonNode> getAffectedInstances()
      Returns the map of affected instances during the operation, mapped by their UUID to their JSON representation.
      Returns:
      the map of affected instances
    • setSourceInstanceEnvironment

      void setSourceInstanceEnvironment(InstanceEnvironment source)
      Sets the source InstanceEnvironment used to evaluate addToContext
      Parameters:
      source - the source security context
    • getSourceInstanceEnvironment

      InstanceEnvironment getSourceInstanceEnvironment()
      Returns the source InstanceEnvironment used to evaluate context sharing operations.
      Returns:
      the source instance environment
    • setVisited

      void setVisited(Set<UUID> visited)
      Sets the shared, mutable set of UUIDs (entities and relations alike) already visited during the current addToContext(UUID) cascade. Checked and populated unconditionally by every ERManagement instance in the cascade, regardless of PropagationMode — 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 single addToContext(UUID) call
    • getVisited

      Set<UUID> getVisited()
      Returns the shared, mutable set of UUIDs already visited during the current addToContext(UUID) cascade.
      Returns:
      the shared visited-UUID set, or null if not yet initialised
    • internalAddToContext

      void internalAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Performs 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 rules
      org.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 violated
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the context does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if context assignment violates rules
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database or system error
    • setTargetInstanceEnvironment

      void setTargetInstanceEnvironment(InstanceEnvironment target)
      Sets the target security context of addToContext/removeFromContext
      Parameters:
      target - the target instance environment to set
    • getTargetInstanceEnvironment

      InstanceEnvironment getTargetInstanceEnvironment()
      Returns the target InstanceEnvironment of 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.ResourceRegistryException
      Performs 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 rules
      org.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 violated
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the context does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if removal violates rules
      org.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

      void setMembershipView(MembershipView membershipView)
      Sets the view that selects the memberships listed by the contexts maps.
      Parameters:
      membershipView - the membership view to apply
    • getMembershipView

      MembershipView getMembershipView()
      Gets the view that selects the memberships listed by the contexts maps.
      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.ResourceRegistryException
      Returns the Context UUID strings of the memberships listed by getMembershipView().
      Returns:
      the set of Context UUID strings
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the element does not exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if context mapping fails
      org.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.ResourceRegistryException
      Returns 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 exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if context mapping fails
      org.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.ResourceRegistryException
      Returns 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 exist
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if context mapping fails
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • isHierarchical

      boolean isHierarchical()
      Gets whether hierarchical lookup is enabled.
      Returns:
      true if hierarchical, false otherwise
    • setHierarchical

      void setHierarchical(boolean hierarchical)
      Sets whether hierarchical lookup is enabled.
      Parameters:
      hierarchical - true to enable hierarchical, false otherwise
    • isActiveOnlyHierarchical

      boolean isActiveOnlyHierarchical()
      Gets whether the active-only hierarchical reader channel must be used instead of the unrestricted one - meaningless unless isHierarchical() is also true.
      Returns:
      true if the active-only channel must be used, false otherwise
    • 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 to false for ALL_ADMIN_ROLES holders (unchanged, unrestricted behavior) and true for everyone else.
      Parameters:
      activeOnlyHierarchical - true to 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 null if not explicitly set (falls back to ContextsPolicy.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