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 Summary
FieldsModifier and TypeFieldDescriptionstatic final StringPrefix used by OrientDB schema classes for incoming edge fields.static final StringPrefix used by OrientDB schema classes for outgoing edge fields.protected Map<String,RelationElementManagement<?, ?, ?, ?>> Cache of edge-internal-id -> RelationManagement to avoid recreating the relationManagement of already visited edges.Fields 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
ConstructorsModifierConstructorDescriptionprotectedEntityElementManagement(org.gcube.informationsystem.base.reference.AccessType accessType) Creates a newEntityElementManagementinstance for the specified access type.protectedEntityElementManagement(org.gcube.informationsystem.base.reference.AccessType accessType, Environment workingContext, com.orientechnologies.orient.core.db.document.ODatabaseDocument oDatabaseDocument) Creates a newEntityElementManagementinstance bound to the specified environment and database session. -
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.protected voidaddToRelationManagement(RelationElementManagement<?, ?, ?, ?> baseRelationManagement) Cache-registers an existingRelationElementManagementhelper.protected com.orientechnologies.orient.core.record.OVertexInstantiates, validates, and persists a new OrientDB Vertex element.protected RelationElementManagement<?,?, ?, ?> getBaseRelationManagement(com.orientechnologies.orient.core.record.OEdge edge) Retrieves or instantiates theRelationElementManagementhelper for a givenOEdge.Methods 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, getElement, getIgnoredFields, getLimit, getMandatoryErrorMessage, getMandatoryErrorMessage, getMetadataPolicy, getOClass, getOffset, getPropertyForJson, getPropertyMap, getSpecificAlreadyPresentException, getSpecificNotFoundException, getTypeName, getUpdateMode, getUUID, getWorkingEnvironment, internalCreate, internalCreateOrUdate, internalDelete, internalUpdate, isDryRun, isMaskMetadata, isPolymorphic, isPreservePassedMetadata, isReload, isSanityCheckDeferred, read, reallyCreate, reallyDelete, reallyGetAll, 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, updateProperties
-
Field Details
-
IN_PREFIX
Prefix used by OrientDB schema classes for incoming edge fields.- See Also:
-
OUT_PREFIX
Prefix used by OrientDB schema classes for outgoing edge fields.- See Also:
-
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 newEntityElementManagementinstance 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 newEntityElementManagementinstance bound to the specified environment and database session.- Parameters:
accessType- the access type category of the entityworkingContext- the working database environmentoDatabaseDocument- 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 theRelationElementManagementhelper for a givenOEdge.- Parameters:
edge- the OrientDB edge- Returns:
- the bound
RelationElementManagementinstance - Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if lookup or initialization fails
-
addToRelationManagement
protected void addToRelationManagement(RelationElementManagement<?, ?, throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException?, ?> baseRelationManagement) Cache-registers an existingRelationElementManagementhelper.- 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 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.AlreadyPresentException, org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryExceptionInstantiates, 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 existsorg.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the schema class is abstract or if database creation fails
-