Class FacetManagement
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 Summary
FieldsModifier and TypeFieldDescriptionprotected ConsistsOfManagementThe associated ConsistsOf relation management helper.protected ResourceManagementThe parent Resource management helper.Fields inherited from class org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.entities.EntityManagement
activeOnlyHierarchical, contextsPolicy, forceAddToContext, hierarchical, orphanCandidates, propagationMode, skipped, sourceInstanceEnvironment, targetInstanceEnvironment, visited, workingContextUUIDFields inherited from class org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.EntityElementManagement
IN_PREFIX, OUT_PREFIX, relationManagementsFields inherited from class org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.ElementManagement
accessType, affectedInstances, AT, cachedType, complete, DELETED, DOLLAR, dryRun, element, elementClass, entryPoint, ignoredFields, ignoreKeys, ignoreStartWithKeys, jsonNode, limit, logger, maskMetadata, metadataPolicy, oClass, oDatabaseDocument, offset, operation, polymorphic, preservePassedMetadata, reload, sanityCheckDeferred, self, typeName, UNDERSCORE, updateMode, uuid, workingEnvironment -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThe modification of a Facet is a modification of the Resource it describes.protected voidValidates the topological schema sanity of the parent Resource.create()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.org.gcube.com.fasterxml.jackson.databind.JsonNodeAbstract method to create the complete JSON node representation of the element.protected org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetAlreadyPresentExceptiongetSpecificAlreadyPresentException(String message) Converts a generic AlreadyPresentException into a subclass-specific AlreadyPresentException.org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetAvailableInAnotherContextExceptionReturns the subclass-specific AvailableInAnotherContextException instance.protected org.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.facet.FacetNotFoundExceptiongetSpecificNotFoundException(org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException e) Converts a generic NotFoundException into a subclass-specific NotFoundException.com.orientechnologies.orient.core.record.OVertexCreates the Facet as part of its ConsistsOf; a creation that has the Facet as its entry point is a standalone creation and is rejected.protected voidAdds the Facet to the target Context.protected com.orientechnologies.orient.core.record.OVertexPersists a new element in the database (subclass hook).protected voidAbstract method implementation that performs the database-level operations to remove the entity from the target context, applying any cascade deletions if required.protected com.orientechnologies.orient.core.record.OVertexUpdates an existing element in the database (subclass hook).voidPerforms runtime validation of the schema constraints this service enforces from the definition rather than through OrientDB: the mandatory properties, and theminandmaxbounds of the numeric values a creation or an update wrote.Methods inherited from class org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.entities.EntityManagement
addRelation, addToContext, addToRelationManagements, createVertex, getContexts, getContextsAsObjectNode, getContextsPolicy, getContextsSet, getElement, getMembershipView, getOrphanCandidates, getPropagationMode, getRelationManagement, getSourceInstanceEnvironment, getTargetInstanceEnvironment, getVisited, getWorkingEnvironment, internalAddToContext, internalDelete, internalRemoveFromContext, isActiveOnlyHierarchical, isForceAddToContext, isHierarchical, query, reallyDelete, reallyGetAll, reallyQuery, removeFromContext, setActiveOnlyHierarchical, setContextsPolicy, setForceAddToContext, setHierarchical, setMembershipView, setOrphanCandidates, setPropagationMode, setSourceInstanceEnvironment, setTargetInstanceEnvironment, setVisited, setWorkingContextMethods inherited from class org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.EntityElementManagement
addToRelationManagement, getBaseRelationManagementMethods inherited from class org.gcube.informationsystem.resourceregistry.persistence.orientdb.base.ElementManagement
addIgnoredFields, all, applyPrivacyMask, applyPrivacyMask, checkERMatch, checkJsonNode, checkUUIDMatch, checkUUIDNotAlreadyInUse, cleanCachedSerialization, concludeTransaction, createOrUpdate, createOrUpdateElementWithResult, delete, exists, getAccessType, getAffectedInstances, getAllProperties, getCachedType, getCurrentODatabaseDocumentFromThreadLocal, getIgnoredFields, getLimit, getMandatoryErrorMessage, getMandatoryErrorMessage, getMetadataPolicy, getOClass, getOffset, getPropertyForJson, getPropertyMap, getTypeName, getUpdateMode, getUUID, internalCreateOrUdate, internalUpdate, isBackendLinkFieldName, isDryRun, isMaskMetadata, isPolymorphic, isPreservePassedMetadata, isReload, isSanityCheckDeferred, read, recordModification, requireExplicitUUID, retrieveElement, retrieveElementFromAnyContext, serializeAsAffectedInstance, serializeAsEndpointReference, serializeAsJsonNode, serializeSelfAsJsonNode, setAsEntryPoint, setDryRun, setElement, setElementType, setIgnoredFields, setJson, setJsonNode, setLimit, setMaskMetadata, setMetadataPolicy, setOClass, setODatabaseDocument, setOffset, setOperation, setPolymorphic, setPreservePassedMetadata, setProperty, setReload, setRequireExplicitUUID, setSanityCheckDeferred, setUpdateMode, setUUID, setWorkingEnvironment, typeSatified, update, updatePropertiesMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gcube.informationsystem.resourceregistry.persistence.ERManagement
getAffectedInstances
-
Field Details
-
consistsOfManagement
The associated ConsistsOf relation management helper. -
resourceManagement
The parent Resource management helper.
-
-
Constructor Details
-
FacetManagement
public FacetManagement()Creates a new, uninitializedFacetManagementinstance.
-
-
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:ElementManagementConverts a generic NotFoundException into a subclass-specific NotFoundException.- Specified by:
getSpecificNotFoundExceptionin classElementManagement<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:ERManagementReturns 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:ElementManagementConverts a generic AlreadyPresentException into a subclass-specific AlreadyPresentException.- Specified by:
getSpecificAlreadyPresentExceptionin classElementManagement<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.ResourceRegistryExceptionDescription copied from class:ElementManagementAbstract method to create the complete JSON node representation of the element.- Specified by:
createCompleteJsonNodein classElementManagement<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.ResourceRegistryExceptionDescription copied from class:ElementManagementPersists a new element in the database (subclass hook).- Specified by:
reallyCreatein classElementManagement<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 databaseorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on any database errororg.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.ResourceRegistryExceptionDescription copied from class:ElementManagementUpdates an existing element in the database (subclass hook).- Specified by:
reallyUpdatein classElementManagement<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 databaseorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on any database errororg.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.ResourceRegistryExceptionDescription copied from class:EntityManagementAbstract method implementation that performs the database-level operations to remove the entity from the target context, applying any cascade deletions if required.- Overrides:
reallyRemoveFromContextin classEntityManagement<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 violatedorg.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.ResourceRegistryExceptionAdds the Facet to the target Context. When the Facet is the direct target of the operation, theConsistsOfpointing 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:
reallyAddToContextin classEntityManagement<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 occursorg.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if the source Resource is not in the target Contextorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if database operations fail
-
afterModification
protected void afterModification() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionThe modification of a Facet is a modification of the Resource it describes.- Overrides:
afterModificationin classElementManagement<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.ResourceRegistryExceptionValidates the topological schema sanity of the parent Resource.- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if topological schema constraints are violatedorg.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.ResourceRegistryExceptionDescription copied from class:ElementManagementPerforms runtime validation of the schema constraints this service enforces from the definition rather than through OrientDB: the mandatory properties, and theminandmaxbounds of the numeric values a creation or an update wrote. A System Restore, the only caller that setsElementManagement.preservePassedMetadata, reproduces the archive as it is: it does not validate again the content the dumped registry held.- Overrides:
sanityCheckin classElementManagement<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 violatedorg.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.ResourceRegistryExceptionA 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:
createin classElementManagement<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- alwaysorg.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException- if the element already existsorg.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.ResourceRegistryExceptionCreates 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:
internalCreatein classElementManagement<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 creationorg.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException- if the element already existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or creation failure
-