Class EntityElementManagement<E extends org.gcube.informationsystem.base.reference.entities.EntityElement,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema>

java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.ElementManagement<com.orientechnologies.orient.core.record.OVertex,ET>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.EntityElementManagement<E,ET>
Direct Known Subclasses:
AbstractEntitySchemaManagement, ContextManagement, EntityManagement, QueryTemplateManagement

public abstract class EntityElementManagement<E extends org.gcube.informationsystem.base.reference.entities.EntityElement,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema> extends ElementManagement<com.orientechnologies.orient.core.record.OVertex,ET>
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • IN_PREFIX

      public static final String IN_PREFIX
      Prefix used by OrientDB schema classes for incoming edge fields.
      See Also:
    • OUT_PREFIX

      public static final String OUT_PREFIX
      Prefix used by OrientDB schema classes for outgoing edge fields.
      See Also:
    • relationManagements

      protected Map<String,RelationElementManagement<?,?,?,?>> relationManagements
      Cache of edge-internal-id -> RelationManagement to avoid recreating the relationManagement of already visited edges.
  • Constructor Details

    • EntityElementManagement

      protected EntityElementManagement(org.gcube.informationsystem.base.reference.AccessType accessType)
      Creates a new EntityElementManagement instance for the specified access type.
      Parameters:
      accessType - the access type category of the entity
    • EntityElementManagement

      protected EntityElementManagement(org.gcube.informationsystem.base.reference.AccessType accessType, Environment workingContext, com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument)
      Creates a new EntityElementManagement instance bound to the specified environment and database session.
      Parameters:
      accessType - the access type category of the entity
      workingContext - the working database environment
      oDatabaseDocument - the active OrientDB database session
  • Method Details

    • getBaseRelationManagement

      protected RelationElementManagement<?,?,?,?> getBaseRelationManagement(com.orientechnologies.orient.core.record.OEdge edge) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Retrieves or instantiates the RelationElementManagement helper for a given OEdge.
      Parameters:
      edge - the OrientDB edge
      Returns:
      the bound RelationElementManagement instance
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if lookup or initialization fails
    • addToRelationManagement

      protected void addToRelationManagement(RelationElementManagement<?,?,?,?> baseRelationManagement) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Cache-registers an existing RelationElementManagement helper.
      Parameters:
      baseRelationManagement - the relation management helper to register
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if a different instance is already registered for the same edge
    • 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
      Appends a relation JSON representation to an existing source resource JSON node.
      Parameters:
      sourceResource - the parent/source resource JSON node
      relation - the relation JSON node to append
      arrayKey - the JSON property key of the relation array
      Returns:
      the updated source resource JSON node
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on mapping or serialization error
    • createVertex

      protected com.orientechnologies.orient.core.record.OVertex createVertex() throws org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Instantiates, validates, and persists a new OrientDB Vertex element.
      Returns:
      the created OrientDB vertex
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException - if a vertex with the specified UUID already exists
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the schema class is abstract or if database creation fails