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>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.entities.EntityManagement<org.gcube.informationsystem.model.reference.entities.Facet,org.gcube.informationsystem.types.reference.entities.FacetSchema>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.entities.FacetManagement
All Implemented Interfaces:
ERManagement

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

    • consistsOfManagement

      protected ConsistsOfManagement consistsOfManagement
      The associated ConsistsOf relation management helper.
    • resourceManagement

      protected ResourceManagement resourceManagement
      The parent Resource management helper.
  • Constructor Details

    • FacetManagement

      public FacetManagement()
      Creates a new, uninitialized FacetManagement instance.
  • Method Details

    • getSpecificNotFoundException

      protected org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetNotFoundException 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.OVertex,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.entities.facet.FacetAvailableInAnotherContextException 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.entities.facet.FacetAlreadyPresentException 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.OVertex,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Parameters:
      message - the exception message
      Returns:
      the specific AlreadyPresentException
    • createCompleteJsonNode

      public org.gcube.com.fasterxml.jackson.databind.JsonNode createCompleteJsonNode() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: ElementManagement
      Abstract method to create the complete JSON node representation of the element.
      Specified by:
      createCompleteJsonNode in class ElementManagement<com.orientechnologies.orient.core.record.OVertex,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Returns:
      the complete JSON node representing the element and its relationships
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on serialization or mapping error
    • reallyCreate

      protected com.orientechnologies.orient.core.record.OVertex reallyCreate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetAlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: ElementManagement
      Persists a new element in the database (subclass hook).
      Specified by:
      reallyCreate in class ElementManagement<com.orientechnologies.orient.core.record.OVertex,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
      org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetAlreadyPresentException
    • reallyUpdate

      protected com.orientechnologies.orient.core.record.OVertex reallyUpdate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetNotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: ElementManagement
      Updates an existing element in the database (subclass hook).
      Specified by:
      reallyUpdate in class ElementManagement<com.orientechnologies.orient.core.record.OVertex,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Returns:
      the updated OrientDB vertex
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException - if the element does not exist in the database
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on any database error
      org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetNotFoundException
    • reallyRemoveFromContext

      protected void reallyRemoveFromContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Description copied from class: EntityManagement
      Abstract method implementation that performs the database-level operations to remove the entity from the target context, applying any cascade deletions if required.
      Overrides:
      reallyRemoveFromContext in class EntityManagement<org.gcube.informationsystem.model.reference.entities.Facet,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if context rules or scoping constraints are violated
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database or execution error
    • reallyAddToContext

      protected void reallyAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Adds the Facet to the target Context. When the Facet is the direct target of the operation, the ConsistsOf pointing to it comes along, in every propagation mode, since a Facet cannot exist in a Context without it; its source Resource must already be in the target Context.
      Overrides:
      reallyAddToContext in class EntityManagement<org.gcube.informationsystem.model.reference.entities.Facet,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException - if a context error occurs
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException - if the source Resource is not in the target Context
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - if database operations fail
    • afterModification

      protected void afterModification() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      The modification of a Facet is a modification of the Resource it describes.
      Overrides:
      afterModification in class ElementManagement<com.orientechnologies.orient.core.record.OVertex,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 schema sanity of the parent Resource.
      Throws:
      org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException - if topological schema constraints are violated
      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.OVertex,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
    • create

      public String create() throws org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      A Facet is never created on its own: it is created together with its ConsistsOf, nested in a Resource or as the target of a ConsistsOf.
      Overrides:
      create in class ElementManagement<com.orientechnologies.orient.core.record.OVertex,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Returns:
      the serialized JSON representation of the created element
      Throws:
      jakarta.ws.rs.BadRequestException - always
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException - if the element already exists
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database error
    • internalCreate

      public com.orientechnologies.orient.core.record.OVertex internalCreate() throws org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException
      Creates the Facet as part of its ConsistsOf; a creation that has the Facet as its entry point is a standalone creation and is rejected.
      Overrides:
      internalCreate in class ElementManagement<com.orientechnologies.orient.core.record.OVertex,org.gcube.informationsystem.types.reference.entities.FacetSchema>
      Returns:
      the newly created OrientDB vertex
      Throws:
      jakarta.ws.rs.BadRequestException - if the Facet is the entry point of the creation
      org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException - if the element already exists
      org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException - on database or creation failure