java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.ElementManagement<com.orientechnologies.orient.core.record.OEdge,org.gcube.informationsystem.types.reference.relations.RelationSchema<SET,TET>>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.RelationElementManagement<ResourceManagement,T,org.gcube.informationsystem.types.reference.entities.ResourceSchema,TET>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.relations.RelationManagement<FacetManagement,org.gcube.informationsystem.types.reference.entities.FacetSchema>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.relations.ConsistsOfManagement
All Implemented Interfaces:
ERManagement

public class ConsistsOfManagement extends RelationManagement<FacetManagement,org.gcube.informationsystem.types.reference.entities.FacetSchema>
Author:
Luca Frosini (ISTI - CNR)
  • Field Details

    • DEFAULT_CONSISTS_OF_PC

      public static final org.gcube.informationsystem.model.reference.properties.PropagationConstraint DEFAULT_CONSISTS_OF_PC
      The default propagation constraint for ConsistsOf relations.
  • Constructor Details

    • ConsistsOfManagement

      public ConsistsOfManagement()
      Creates a new ConsistsOfManagement instance with default propagation constraints.
  • Method Details

    • getSpecificNotFoundException

      protected org.gcube.informationsystem.resourceregistry.api.exceptions.instances.relations.consistsof.ConsistsOfNotFoundException getSpecificNotFoundException(org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException e)
      Description copied from class: ElementManagement
      Converts a generic NotFoundException into a subclass-specific NotFoundException.
      Specified by:
      getSpecificNotFoundException in class ElementManagement<com.orientechnologies.orient.core.record.OEdge,org.gcube.informationsystem.types.reference.relations.RelationSchema<org.gcube.informationsystem.types.reference.entities.ResourceSchema,org.gcube.informationsystem.types.reference.entities.FacetSchema>>
      Parameters:
      e - the generic exception
      Returns:
      the specific NotFoundException
    • getSpecificAvailableInAnotherContextException

      public org.gcube.informationsystem.resourceregistry.api.exceptions.instances.relations.consistsof.ConsistsOfAvailableInAnotherContextException getSpecificAvailableInAnotherContextException(String message)
      Description copied from interface: ERManagement
      Returns the subclass-specific AvailableInAnotherContextException instance.
      Parameters:
      message - the exception message
      Returns:
      the specific AvailableInAnotherContextException
    • getSpecificAlreadyPresentException

      protected org.gcube.informationsystem.resourceregistry.api.exceptions.instances.relations.consistsof.ConsistsOfAlreadyPresentException getSpecificAlreadyPresentException(String message)
      Description copied from class: ElementManagement
      Converts a generic AlreadyPresentException into a subclass-specific AlreadyPresentException.
      Specified by:
      getSpecificAlreadyPresentException in class ElementManagement<com.orientechnologies.orient.core.record.OEdge,org.gcube.informationsystem.types.reference.relations.RelationSchema<org.gcube.informationsystem.types.reference.entities.ResourceSchema,org.gcube.informationsystem.types.reference.entities.FacetSchema>>
      Parameters:
      message - the exception message
      Returns:
      the specific AlreadyPresentException
    • newTargetEntityManagement

      protected FacetManagement newTargetEntityManagement() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: RelationElementManagement
      Creates a new management instance for the target entity of the relation (subclass hook).
      Specified by:
      newTargetEntityManagement in class RelationElementManagement<ResourceManagement,FacetManagement,org.gcube.informationsystem.types.reference.entities.ResourceSchema,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Returns:
      the target entity management instance
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database or lookup error
    • writeTarget

      protected void writeTarget(org.gcube.com.fasterxml.jackson.databind.JsonNode target) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      The target of a ConsistsOf being created is always a new Facet, created with it: a Facet already has its own ConsistsOf and cannot have another one, so a target whose UUID is already in use is a conflict, whether it is a reference or a complete representation.
      Overrides:
      writeTarget in class RelationElementManagement<ResourceManagement,FacetManagement,org.gcube.informationsystem.types.reference.entities.ResourceSchema,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Parameters:
      target - the submitted target
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the target cannot be resolved or written
    • reallyCreate

      protected com.orientechnologies.orient.core.record.OEdge reallyCreate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: ElementManagement
      Persists a new element in the database (subclass hook).
      Overrides:
      reallyCreate in class RelationManagement<FacetManagement,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Returns:
      the persisted OrientDB vertex
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException - if the element already exists in the database
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on any database error
    • afterModification

      protected void afterModification() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      The modification of a ConsistsOf is a modification of its source Resource.
      Overrides:
      afterModification in class ElementManagement<com.orientechnologies.orient.core.record.OEdge,org.gcube.informationsystem.types.reference.relations.RelationSchema<org.gcube.informationsystem.types.reference.entities.ResourceSchema,org.gcube.informationsystem.types.reference.entities.FacetSchema>>
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if the modification cannot be recorded
    • checkResource

      protected void checkResource() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Validates the topological sanity constraints of the associated resource.
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException - if topological validation fails
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database lookup failure
    • sanityCheck

      public void sanityCheck() throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: ElementManagement
      Performs runtime validation of the schema constraints this service enforces from the definition rather than through OrientDB: the mandatory properties, and the min and max bounds of the numeric values a creation or an update wrote. A System Restore, the only caller that sets ElementManagement.preservePassedMetadata, reproduces the archive as it is: it does not validate again the content the dumped registry held.
      Overrides:
      sanityCheck in class ElementManagement<com.orientechnologies.orient.core.record.OEdge,org.gcube.informationsystem.types.reference.relations.RelationSchema<org.gcube.informationsystem.types.reference.entities.ResourceSchema,org.gcube.informationsystem.types.reference.entities.FacetSchema>>
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException - if a schema constraint is violated
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database lookup failure