Class ElementManagement<El extends com.orientechnologies.orient.core.record.OElement,T extends org.gcube.informationsystem.types.reference.Type>

java.lang.Object
org.gcube.informationsystem.resourceregistry.base.ElementManagement<El,T>
Direct Known Subclasses:
EntityElementManagement, PropertyTypeDefinitionManagement, RelationElementManagement

public abstract class ElementManagement<El extends com.orientechnologies.orient.core.record.OElement,T extends org.gcube.informationsystem.types.reference.Type> extends Object
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • logger

      protected org.slf4j.Logger logger
    • DELETED

      public static final String DELETED
      See Also:
    • AT

      public static final String AT
      See Also:
    • UNDERSCORE

      public static final String UNDERSCORE
      See Also:
    • DOLLAR

      public static final String DOLLAR
      See Also:
    • ignoreKeys

      protected final Set<String> ignoreKeys
    • ignoreStartWithKeys

      protected final Set<String> ignoreStartWithKeys
    • elementClass

      protected Class<El extends com.orientechnologies.orient.core.record.OElement> elementClass
    • accessType

      protected final org.gcube.informationsystem.base.reference.AccessType accessType
    • oDatabaseDocument

      protected com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument
    • uuid

      protected UUID uuid
    • jsonNode

      protected org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode
    • oClass

      protected com.orientechnologies.orient.core.metadata.schema.OClass oClass
    • typeName

      protected String typeName
    • self

      protected org.gcube.com.fasterxml.jackson.databind.JsonNode self
    • complete

      protected org.gcube.com.fasterxml.jackson.databind.JsonNode complete
    • cachedType

      protected CachedType<T extends org.gcube.informationsystem.types.reference.Type> cachedType
    • element

      protected El extends com.orientechnologies.orient.core.record.OElement element
    • reload

      protected boolean reload
    • forceIncludeMeta

      protected boolean forceIncludeMeta
      Used to force Meta inclusion. It is use for example to request to include meta by the context cache manager.
    • forceIncludeAllMeta

      protected boolean forceIncludeAllMeta
      Used to force Meta inclusion in all instances. It is use for example to request to include meta by the context cache manager.
    • dryRun

      protected boolean dryRun
      Some operation, e.g. delete has a cascade impact which is not know a priori by the client. Setting this variable to false the system just simulate the operation so an interested client could know the impact in advance. By the default the system execute effectively the requested operation. So this variable is initialised as false.
    • entryPoint

      protected boolean entryPoint
      An operation can affects multiple instances (e.g. create, update) We need to know if the instance is the entry point of the operation or if it is just a subordinated operation. This is required for example in delete to trigger sanity check in the Resource when the action is performed directly on the Facet. Resource sanity check is not required to be triggered by the Facet because the entry point of the action already take care of triggering this action (e.g. the delete was invoked on the Resource and each describing Facets must not trigger multiple time the sanityCheck).
    • operation

      protected Operation operation
      It is assigned only in the entry point
    • affectedInstances

      protected final Map<UUID,org.gcube.com.fasterxml.jackson.databind.JsonNode> affectedInstances
      A Delete an addToContext and a RemoveFromContext operation has a cascade impact we want to know the impact, i.e. instances involved
    • workingEnvironment

      protected Environment workingEnvironment
  • Constructor Details

    • ElementManagement

      protected ElementManagement(org.gcube.informationsystem.base.reference.AccessType accessType)
  • Method Details

    • isForceIncludeMeta

      public boolean isForceIncludeMeta()
    • setForceIncludeMeta

      public void setForceIncludeMeta(boolean forceIncludeMeta)
    • isForceIncludeAllMeta

      public boolean isForceIncludeAllMeta()
    • setForceIncludeAllMeta

      public void setForceIncludeAllMeta(boolean forceIncludeAllMeta)
    • getAffectedInstances

      public Map<UUID,org.gcube.com.fasterxml.jackson.databind.JsonNode> getAffectedInstances()
    • isDryRun

      public boolean isDryRun()
    • setDryRun

      public void setDryRun(boolean dryRun)
    • setAsEntryPoint

      public void setAsEntryPoint()
    • setOperation

      public void setOperation(Operation operation)
    • cleanCachedSerialization

      protected void cleanCachedSerialization()
    • getUUID

      public UUID getUUID()
    • isReload

      public boolean isReload()
    • setReload

      public void setReload(boolean reload)
    • getAccessType

      public org.gcube.informationsystem.base.reference.AccessType getAccessType()
    • getWorkingEnvironment

      protected abstract Environment getWorkingEnvironment() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setWorkingEnvironment

      public void setWorkingEnvironment(Environment workingContext)
    • setUUID

      public void setUUID(UUID uuid) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setJsonNode

      public void setJsonNode(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setJson

      public void setJson(String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setODatabaseDocument

      public void setODatabaseDocument(com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)
    • setOClass

      public void setOClass(com.orientechnologies.orient.core.metadata.schema.OClass oClass)
    • getOClass

      protected com.orientechnologies.orient.core.metadata.schema.OClass getOClass() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getCachedType

      protected CachedType<T> getCachedType()
    • setElementType

      public void setElementType(String elementType) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getTypeName

      public String getTypeName() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • checkJsonNode

      protected void checkJsonNode() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • checkERMatch

      protected void checkERMatch() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • checkUUIDMatch

      protected void checkUUIDMatch() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • serializeAsAffectedInstance

      public org.gcube.com.fasterxml.jackson.databind.JsonNode serializeAsAffectedInstance() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • serializeSelfAsJsonNode

      public org.gcube.com.fasterxml.jackson.databind.JsonNode serializeSelfAsJsonNode() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • createCompleteJsonNode

      protected abstract org.gcube.com.fasterxml.jackson.databind.JsonNode createCompleteJsonNode() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • serializeAsJsonNode

      public org.gcube.com.fasterxml.jackson.databind.JsonNode serializeAsJsonNode() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • reallyCreate

      protected abstract El reallyCreate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • internalCreate

      public El internalCreate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • reallyUpdate

      protected abstract El reallyUpdate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • internalUpdate

      public El internalUpdate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • internalCreateOrUdate

      public El internalCreateOrUdate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • reallyDelete

      protected abstract void reallyDelete() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • internalDelete

      public void internalDelete() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • setElement

      public void setElement(El element) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getSpecificNotFoundException

      protected abstract org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException getSpecificNotFoundException(org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException e)
    • getSpecificAlreadyPresentException

      protected abstract org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException getSpecificAlreadyPresentException(String message)
    • getElement

      public El getElement() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • retrieveElement

      public El retrieveElement() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • retrieveElementFromAnyContext

      public El retrieveElementFromAnyContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • reallyGetAll

      public abstract String reallyGetAll(boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • all

      public String all(boolean polymorphic) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • exists

      public boolean exists() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • createOrUpdate

      public String createOrUpdate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • create

      public String create() throws org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • read

      public String read() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • update

      public String update() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.AvailableInAnotherContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • delete

      public void delete() 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
      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
    • getContextsSet

      public 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
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getContexts

      public 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
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getContextsAsObjectNode

      public 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
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getPropertyMap

      public Map<String,org.gcube.com.fasterxml.jackson.databind.JsonNode> getPropertyMap(org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode, Set<String> ignoreKeys, Set<String> ignoreStartWith) throws org.gcube.com.fasterxml.jackson.core.JsonProcessingException, IOException
      Throws:
      org.gcube.com.fasterxml.jackson.core.JsonProcessingException
      IOException
    • setProperty

      public void setProperty(com.orientechnologies.orient.core.metadata.schema.OProperty oProperty, String key, org.gcube.com.fasterxml.jackson.databind.JsonNode value) throws Exception
      Throws:
      Exception
    • updateProperties

      public com.orientechnologies.orient.core.record.OElement updateProperties(com.orientechnologies.orient.core.metadata.schema.OClass oClass, com.orientechnologies.orient.core.record.OElement element, org.gcube.com.fasterxml.jackson.databind.JsonNode jsonNode, Set<String> ignoreKeys, Set<String> ignoreStartWithKeys) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • isUserAllowedToGetPrivacyMeta

      public boolean isUserAllowedToGetPrivacyMeta()
    • getPropertyForJson

      protected org.gcube.com.fasterxml.jackson.databind.JsonNode getPropertyForJson(String key, Object object) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getNotNullErrorMessage

      protected String getNotNullErrorMessage(String fieldName)
    • getMandatoryErrorMessage

      protected String getMandatoryErrorMessage(String fieldName)
    • typeSatified

      protected boolean typeSatified(TypesCache typesCache, String requiredType, String effectiveType) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • getAllProperties

      protected Set<org.gcube.informationsystem.types.reference.properties.PropertyDefinition> getAllProperties() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
    • sanityCheck

      public void sanityCheck() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException