Class EntityManagement<E extends org.gcube.informationsystem.model.reference.entities.Entity,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>
org.gcube.informationsystem.resourceregistry.persistence.orientdb.instances.entities.EntityManagement<E,ET>
- Type Parameters:
E- the specificEntitymodel interface managed by a concrete subclassET- the correspondingEntitySchematype-definition interface
- All Implemented Interfaces:
ERManagement
- Direct Known Subclasses:
FacetManagement,ResourceManagement
public abstract class EntityManagement<E extends org.gcube.informationsystem.model.reference.entities.Entity,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema>
extends EntityElementManagement<E,ET>
implements ERManagement
Base OrientDB persistence class for the two Entity categories,
Resource and
Facet (see the concrete ResourceManagement and FacetManagement
subclasses). Implements the ERManagement contract shared with relations
(RelationManagement) — context membership, Avalanche Effect propagation, and
hierarchical reads — by leaving the selection of the listed memberships to a
MembershipView, and implements the vertex-specific parts: creation, deletion,
and traversal of ConsistsOf edges to embedded Facets. As of this evolution,
this class carries no security-role logic of its own: it behaves deterministically from its
explicit method arguments (e.g. PropagationMode and the flags inherited from
ElementManagement), authorization being the exclusive
responsibility of the Instances Policy Enforcement Point.- Author:
- Luca Frosini (ISTI - CNR)
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether the active-only hierarchical reader channel must be used.protected org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicyThe contexts inclusion policy for responses.protected booleanThe instance is added to the context even if not in source context.protected booleanWhether hierarchical lookup is enabled.protected org.gcube.informationsystem.resourceregistry.api.rest.PropagationModeBy default the system honours the propagation constraints so this variable is initialised as true.protected booleanIndicates that AddToContext skipped the instance because it was not in the source context.protected InstanceEnvironmentThe source context of an addToContextprotected InstanceEnvironmentThe target context of an addToContext/removeFromContextShared, mutable set of UUIDs (entities and relations alike) already visited during the currentaddToContext(UUID)cascade.Fields 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
ConstructorsModifierConstructorDescriptionprotectedEntityManagement(org.gcube.informationsystem.base.reference.AccessType accessType) Creates a newEntityManagementinstance for the specified access type. -
Method Summary
Modifier and TypeMethodDescriptionprotected static org.gcube.com.fasterxml.jackson.databind.JsonNodeaddRelation(org.gcube.com.fasterxml.jackson.databind.JsonNode sourceResource, org.gcube.com.fasterxml.jackson.databind.JsonNode relation, String arrayKey) Appends a relation JSON representation to an existing source resource JSON node.voidaddToContext(UUID contextUUID) Adds the entity/relationship to the specified context, evaluating schemas and constraints.voidaddToRelationManagements(RelationManagement<?, ?> relationManagement) Cache-registers an existingRelationManagementhelper.protected com.orientechnologies.orient.core.record.OVertexInstantiates, validates, and persists a new OrientDB Vertex element.Returns all contexts where this element is visible as a formatted JSON string.org.gcube.com.fasterxml.jackson.databind.node.ObjectNodeReturns all contexts where this element is visible as an ObjectNode mapping Context UUIDs to paths.org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicyReturns the contexts inclusion policy for responses.Returns the Context UUID strings of the memberships listed byERManagement.getMembershipView().com.orientechnologies.orient.core.record.OVertexReturns the OrientDB element instance, retrieving and caching it if not already present.Gets the view that selects the memberships listed by thecontextsmaps.org.gcube.informationsystem.resourceregistry.api.rest.PropagationModeReturns the propagation mode configured for this operation.protected RelationManagement<?,?> getRelationManagement(com.orientechnologies.orient.core.record.OEdge edge) Retrieves or instantiates theRelationManagementhelper for a givenOEdge.Returns the source instance environment of an addToContext operation.Returns the target instance environment of an addToContext/removeFromContext operation.Returns the shared, mutable set of UUIDs already visited during the currentERManagement.addToContext(UUID)cascade.protected EnvironmentReturns the active database working environment.voidPerforms the internal low-level operations to add the entity/relationship to the target context.voidPerforms the internal low-level operations to remove the entity/relationship from the context.booleanGets whether the active-only hierarchical reader channel must be used instead of the unrestricted one - meaningless unlessERManagement.isHierarchical()is alsotrue.booleanGets whether the operation should force add to context even if the instance is not in source context.booleanGets whether hierarchical lookup is enabled.query(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String, String> constraint) High-level query execution method that manages its own database session, performs schema validations, and delegates traversal execution toreallyQuery(java.lang.String, java.lang.String, java.util.UUID, com.orientechnologies.orient.core.record.ODirection, boolean, java.util.Map<java.lang.String, java.lang.String>).protected voidAbstract method implementation that performs the database-level operations to add the entity and its propagated components to the target context.Serializes the Entity page using the configured projection and Context visibility.reallyQuery(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String, String> constraint) Low-level query execution method that runs the graph traversal query on OrientDB and returns the matching entities as a serialized JSON array string.protected voidAbstract method implementation that performs the database-level operations to remove the entity from the target context, applying any cascade deletions if required.voidremoveFromContext(UUID contextUUID) Removes the entity/relationship from the specified context.voidsetActiveOnlyHierarchical(boolean activeOnlyHierarchical) Sets whether the active-only hierarchical reader channel must be used instead of the unrestricted one.voidsetContextsPolicy(org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy contextsPolicy) Sets the contexts inclusion policy for responses.voidsetForceAddToContext(boolean forceAddToContext) Sets whether the operation should force add to context even if the instance is not in source context.voidsetHierarchical(boolean hierarchical) Sets whether hierarchical lookup is enabled.voidsetMembershipView(MembershipView membershipView) Sets the view that selects the memberships listed by thecontextsmaps.voidsetPropagationMode(org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode propagationMode) Sets the propagation mode configured for this operation.voidSets the source InstanceEnvironment used to evaluate addToContextvoidSets the target instance environment of an addToContext/removeFromContext operation.voidsetVisited(Set<UUID> visited) Sets the shared, mutable set of UUIDs (entities and relations alike) already visited during the currentERManagement.addToContext(UUID)cascade.Methods 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, create, createCompleteJsonNode, createOrUpdate, createOrUpdateElementWithResult, delete, exists, getAccessType, getAffectedInstances, getAllProperties, getCachedType, getCurrentODatabaseDocumentFromThreadLocal, getIgnoredFields, getLimit, getMandatoryErrorMessage, getMandatoryErrorMessage, getMetadataPolicy, getOClass, getOffset, getPropertyForJson, getPropertyMap, getSpecificAlreadyPresentException, getSpecificNotFoundException, getTypeName, getUpdateMode, getUUID, internalCreate, internalCreateOrUdate, internalDelete, internalUpdate, isDryRun, isMaskMetadata, isPolymorphic, isPreservePassedMetadata, isReload, isSanityCheckDeferred, read, reallyCreate, reallyDelete, reallyUpdate, requireExplicitUUID, retrieveElement, retrieveElementFromAnyContext, sanityCheck, 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, getSpecificAvailableInAnotherContextException
-
Field Details
-
sourceInstanceEnvironment
The source context of an addToContext -
targetInstanceEnvironment
The target context of an addToContext/removeFromContext -
propagationMode
protected org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode propagationModeBy default the system honours the propagation constraints so this variable is initialised as true. To revert a previous operation or for a particular maintenance we could ask the service not to honour the propagation constraints, but only under certain conditions and with some limitations. These limitations are required to keep the system in a consistent state. In fact, this directive is only valid for Resources and IsRelatedTo relations. We need to take into account that when adding an IsRelatedTo to a context, the source and target Resources must always be in such a Context. Please also take into account that adding a Resource to a context always implies honouring the propagation constraints of ConsistsOf relations. In fact, a resource must be characterised by at least one facet in any context it belongs to. Given that we cannot make assumptions on which facets must be used, a way could be to consider only the facets that are mandatory for such a Resource Type, but the type could not have mandatory facets (even though every Resource Type in the gCube Model has one mandatory facet). Conversely, when a Resource is removed from a Context all the facets characterising it must be removed. This option can also be used in conjunction withElementManagement.dryRun=true. This allows simulating a sharing operation without honouring the propagation constraints. -
visited
Shared, mutable set of UUIDs (entities and relations alike) already visited during the currentaddToContext(UUID)cascade. Guarantees termination on a graph cycle (e.g. a cyclicIsRelatedTochain) independently ofPropagationMode— populated and checked unconditionally, even in modes (SHALLOW) whose own already-present check would already prevent a re-visit, so the guard stays uniform and orthogonal to mode semantics.Not the same bookkeeping as
ElementManagement.affectedInstances: this set is marked on entry, before recursing into children (pre-order) - a node re-entered mid-cycle is caught here even though its own processing hasn't finished yet.ElementManagement.affectedInstancesis only populated when processing completes successfully (post-order), so it cannot double as a cycle guard - a node being re-entered mid-recursion has not been added to it yet. -
hierarchical
protected boolean hierarchicalWhether hierarchical lookup is enabled. -
activeOnlyHierarchical
protected boolean activeOnlyHierarchicalWhether the active-only hierarchical reader channel must be used. -
contextsPolicy
protected org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy contextsPolicyThe contexts inclusion policy for responses. -
forceAddToContext
protected boolean forceAddToContextThe instance is added to the context even if not in source context. -
skipped
protected boolean skippedIndicates that AddToContext skipped the instance because it was not in the source context.
-
-
Constructor Details
-
EntityManagement
protected EntityManagement(org.gcube.informationsystem.base.reference.AccessType accessType) Creates a newEntityManagementinstance for the specified access type.- Parameters:
accessType- the access type category of the entity
-
-
Method Details
-
setMembershipView
Description copied from interface:ERManagementSets the view that selects the memberships listed by thecontextsmaps.- Specified by:
setMembershipViewin interfaceERManagement- Parameters:
membershipView- the membership view to apply
-
getMembershipView
Description copied from interface:ERManagementGets the view that selects the memberships listed by thecontextsmaps.- Specified by:
getMembershipViewin interfaceERManagement- Returns:
- the membership view
-
isHierarchical
public boolean isHierarchical()Description copied from interface:ERManagementGets whether hierarchical lookup is enabled.- Specified by:
isHierarchicalin interfaceERManagement- Returns:
trueif hierarchical,falseotherwise
-
setHierarchical
public void setHierarchical(boolean hierarchical) Description copied from interface:ERManagementSets whether hierarchical lookup is enabled.- Specified by:
setHierarchicalin interfaceERManagement- Parameters:
hierarchical-trueto enable hierarchical,falseotherwise
-
isActiveOnlyHierarchical
public boolean isActiveOnlyHierarchical()Description copied from interface:ERManagementGets whether the active-only hierarchical reader channel must be used instead of the unrestricted one - meaningless unlessERManagement.isHierarchical()is alsotrue.- Specified by:
isActiveOnlyHierarchicalin interfaceERManagement- Returns:
trueif the active-only channel must be used,falseotherwise
-
setActiveOnlyHierarchical
public void setActiveOnlyHierarchical(boolean activeOnlyHierarchical) Description copied from interface:ERManagementSets whether the active-only hierarchical reader channel must be used instead of the unrestricted one. The PEP layer sets this tofalseforALL_ADMIN_ROLESholders (unchanged, unrestricted behavior) andtruefor everyone else.- Specified by:
setActiveOnlyHierarchicalin interfaceERManagement- Parameters:
activeOnlyHierarchical-trueto use the active-only channel
-
getContextsPolicy
public org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy getContextsPolicy()Description copied from interface:ERManagementReturns the contexts inclusion policy for responses.- Specified by:
getContextsPolicyin interfaceERManagement- Returns:
- the contexts policy, or
nullif not explicitly set (falls back toContextsPolicy.DEFAULT)
-
setContextsPolicy
public void setContextsPolicy(org.gcube.informationsystem.resourceregistry.api.rest.ContextsPolicy contextsPolicy) Description copied from interface:ERManagementSets the contexts inclusion policy for responses.- Specified by:
setContextsPolicyin interfaceERManagement- Parameters:
contextsPolicy- the contexts policy to set
-
setSourceInstanceEnvironment
Description copied from interface:ERManagementSets the source InstanceEnvironment used to evaluate addToContext- Specified by:
setSourceInstanceEnvironmentin interfaceERManagement- Parameters:
source- the source security context
-
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.ResourceRegistryExceptionDescription copied from interface:ERManagementReturns the Context UUID strings of the memberships listed byERManagement.getMembershipView().- Specified by:
getContextsSetin interfaceERManagement- Returns:
- the set of Context UUID strings
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context mapping failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
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.ResourceRegistryExceptionReturns all contexts where this element is visible as a formatted JSON string.Warning: Any changes made to this implementation must also be applied to the corresponding method in
RelationManagementto keep both ER hierarchies synchronized.- Specified by:
getContextsin interfaceERManagement- Returns:
- the JSON string of contexts mapping
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context mapping failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
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.ResourceRegistryExceptionDescription copied from interface:ERManagementReturns all contexts where this element is visible as an ObjectNode mapping Context UUIDs to paths.- Specified by:
getContextsAsObjectNodein interfaceERManagement- Returns:
- the JSON ObjectNode of contexts mapping
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context mapping failsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
getSourceInstanceEnvironment
Returns the source instance environment of an addToContext operation.- Specified by:
getSourceInstanceEnvironmentin interfaceERManagement- Returns:
- the source instance environment
-
setTargetInstanceEnvironment
Sets the target instance environment of an addToContext/removeFromContext operation.- Specified by:
setTargetInstanceEnvironmentin interfaceERManagement- Parameters:
target- the target instance environment to set
-
getTargetInstanceEnvironment
Returns the target instance environment of an addToContext/removeFromContext operation.- Specified by:
getTargetInstanceEnvironmentin interfaceERManagement- Returns:
- the target instance environment
-
getPropagationMode
public org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode getPropagationMode()Returns the propagation mode configured for this operation.- Specified by:
getPropagationModein interfaceERManagement- Returns:
- the propagation mode
-
setPropagationMode
public void setPropagationMode(org.gcube.informationsystem.resourceregistry.api.rest.PropagationMode propagationMode) Sets the propagation mode configured for this operation.- Specified by:
setPropagationModein interfaceERManagement- Parameters:
propagationMode- the propagation mode to set
-
setVisited
Description copied from interface:ERManagementSets the shared, mutable set of UUIDs (entities and relations alike) already visited during the currentERManagement.addToContext(UUID)cascade. Checked and populated unconditionally by everyERManagementinstance in the cascade, regardless ofPropagationMode— cycle-safety is kept orthogonal to whatever each mode otherwise decides about re-visiting an already-present instance, so it does not need to be re-derived if propagation semantics change later.- Specified by:
setVisitedin interfaceERManagement- Parameters:
visited- the shared visited-UUID set; the same instance must be threaded through the whole cascade of a singleERManagement.addToContext(UUID)call
-
getVisited
Description copied from interface:ERManagementReturns the shared, mutable set of UUIDs already visited during the currentERManagement.addToContext(UUID)cascade.- Specified by:
getVisitedin interfaceERManagement- Returns:
- the shared visited-UUID set, or
nullif not yet initialised
-
isForceAddToContext
public boolean isForceAddToContext()Description copied from interface:ERManagementGets whether the operation should force add to context even if the instance is not in source context.- Specified by:
isForceAddToContextin interfaceERManagement- Returns:
trueif force add,falseotherwise
-
setForceAddToContext
public void setForceAddToContext(boolean forceAddToContext) Description copied from interface:ERManagementSets whether the operation should force add to context even if the instance is not in source context.- Specified by:
setForceAddToContextin interfaceERManagement- Parameters:
forceAddToContext-trueto force add,falseotherwise
-
getWorkingEnvironment
protected Environment getWorkingEnvironment() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionDescription copied from class:ElementManagementReturns the active database working environment.- Specified by:
getWorkingEnvironmentin classElementManagement<com.orientechnologies.orient.core.record.OVertex,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema> - Returns:
- the working environment
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the environment cannot be resolved
-
getElement
public com.orientechnologies.orient.core.record.OVertex getElement() throws org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.instances.AvailableInAnotherContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionDescription copied from class:ElementManagementReturns the OrientDB element instance, retrieving and caching it if not already present.- Overrides:
getElementin classElementManagement<com.orientechnologies.orient.core.record.OVertex,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema> - Returns:
- the OrientDB element instance
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the element does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.instances.AvailableInAnotherContextException- if the element belongs to another contextorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database error
-
getRelationManagement
protected RelationManagement<?,?> getRelationManagement(com.orientechnologies.orient.core.record.OEdge edge) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Retrieves or instantiates theRelationManagementhelper for a givenOEdge.- Parameters:
edge- the OrientDB edge- Returns:
- the bound
RelationManagementinstance - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if lookup or initialization fails
-
addToRelationManagements
public void addToRelationManagements(RelationManagement<?, ?> relationManagement) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionCache-registers an existingRelationManagementhelper.- Parameters:
relationManagement- 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 noderelation- the relation JSON node to appendarrayKey- 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.instances.entities.EntityAlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionDescription copied from class:EntityElementManagementInstantiates, validates, and persists a new OrientDB Vertex element.- Overrides:
createVertexin classEntityElementManagement<E extends org.gcube.informationsystem.model.reference.entities.Entity,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema> - Returns:
- the created OrientDB vertex
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.AlreadyPresentException- if a vertex with the specified UUID already existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the schema class is abstract or if database creation failsorg.gcube.informationsystem.resourceregistry.api.exceptions.instances.entities.EntityAlreadyPresentException
-
reallyAddToContext
protected void reallyAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionAbstract method implementation that performs the database-level operations to add the entity and its propagated components to the target context.- 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
-
internalAddToContext
public void internalAddToContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionDescription copied from interface:ERManagementPerforms the internal low-level operations to add the entity/relationship to the target context.- Specified by:
internalAddToContextin interfaceERManagement- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context assignment violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
addToContext
public void addToContext(UUID contextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Description copied from interface:ERManagementAdds the entity/relationship to the specified context, evaluating schemas and constraints.- Specified by:
addToContextin interfaceERManagement- Parameters:
contextUUID- the UUID of the destination context- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if schema rules are violatedorg.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the context does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if context assignment violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
internalRemoveFromContext
public void internalRemoveFromContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionDescription copied from interface:ERManagementPerforms the internal low-level operations to remove the entity/relationship from the context.- Specified by:
internalRemoveFromContextin interfaceERManagement- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if removal violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
reallyRemoveFromContext
protected void reallyRemoveFromContext() throws org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionAbstract method implementation that performs the database-level operations to remove the entity from the target context, applying any cascade deletions if required.- 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
-
removeFromContext
public void removeFromContext(UUID contextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException, org.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException, org.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Description copied from interface:ERManagementRemoves the entity/relationship from the specified context.- Specified by:
removeFromContextin interfaceERManagement- Parameters:
contextUUID- the UUID of the context from which to remove- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.types.SchemaViolationException- if schema rules are violatedorg.gcube.informationsystem.resourceregistry.api.exceptions.NotFoundException- if the context does not existorg.gcube.informationsystem.resourceregistry.api.exceptions.contexts.ContextException- if removal violates rulesorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database or system error
-
reallyGetAll
public String reallyGetAll() throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionSerializes the Entity page using the configured projection and Context visibility.- Specified by:
reallyGetAllin classElementManagement<com.orientechnologies.orient.core.record.OVertex,ET extends org.gcube.informationsystem.types.reference.entities.EntitySchema> - Returns:
- JSON array string of all elements
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database traversal or serialization error
-
reallyQuery
public String reallyQuery(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String, String> constraint) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionLow-level query execution method that runs the graph traversal query on OrientDB and returns the matching entities as a serialized JSON array string.- Parameters:
relationType- the relationship class name to traversereferenceType- the target entity class namereferenceUUID- the target entity UUID (optional)direction- the traversal direction (IN/OUT)polymorphic- whether to include subclasses of the target entityconstraint- map of additional property constraints- Returns:
- JSON array string of matching entities
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- on database, query, or serialization failure
-
query
public String query(String relationType, String referenceType, UUID referenceUUID, com.orientechnologies.orient.core.record.ODirection direction, boolean polymorphic, Map<String, String> constraint) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionHigh-level query execution method that manages its own database session, performs schema validations, and delegates traversal execution toreallyQuery(java.lang.String, java.lang.String, java.util.UUID, com.orientechnologies.orient.core.record.ODirection, boolean, java.util.Map<java.lang.String, java.lang.String>).- Parameters:
relationType- the relationship class name to traversereferenceType- the target entity class namereferenceUUID- the target entity UUID (optional)direction- the traversal direction (IN/OUT)polymorphic- whether to include subclasses of the target entityconstraint- map of additional property constraints- Returns:
- JSON array string of matching entities
- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if parameters are invalid or execution fails
-