Class SystemRestoreManagement
java.lang.Object
org.gcube.informationsystem.resourceregistry.persistence.orientdb.system.SystemRestoreManagement
OrientDB-specific System Restore writes: recreates a Resource or IsRelatedTo relation in an
explicit "primary" Context with its original UUID and metadata preserved, then replays its
remaining Context memberships verbatim (no avalanche propagation constraints, since the dump
already captured the definitive per-instance membership set).
Every write sets ElementManagement.setPreservePassedMetadata(boolean): a restore is
not a modification, so each restored instance keeps the metadata of the archive,
whatever the number of Contexts it is replayed into.
- Author:
- Luca Frosini (ISTI - CNR)
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToContext(String type, UUID instanceUUID, UUID primaryContextUUID, UUID contextUUID) Replays the membership of an already-created instance into one additional Context, exactly as captured by the dump: no avalanche propagation constraints are evaluated, since the dumped per-instance Context set is already the definitive, historically-derived result of whatever propagation originally applied.voidcreateQueryTemplate(String json) Creates a new Query Template, preserving the original UUID and metadata from the submitted JSON.voidcreateRelation(String json, UUID primaryContextUUID) Creates a new IsRelatedTo relation directly in the given Context, preserving the original UUID and metadata from the submitted JSON.voidcreateResource(String json, UUID primaryContextUUID) Creates a new Resource (with embedded ConsistsOf/Facets) directly in the given Context, preserving the original UUID and metadata from the submitted JSON.
-
Constructor Details
-
SystemRestoreManagement
public SystemRestoreManagement()
-
-
Method Details
-
createResource
public void createResource(String json, UUID primaryContextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates a new Resource (with embedded ConsistsOf/Facets) directly in the given Context, preserving the original UUID and metadata from the submitted JSON.- Parameters:
json- the Resource representation as produced by a System DumpprimaryContextUUID- the Context in which the Resource is created- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the creation fails
-
createRelation
public void createRelation(String json, UUID primaryContextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates a new IsRelatedTo relation directly in the given Context, preserving the original UUID and metadata from the submitted JSON. Both source and target Resources must already exist in that Context.- Parameters:
json- the IsRelatedTo representation as produced by a System DumpprimaryContextUUID- the Context in which the relation is created- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the creation fails
-
createQueryTemplate
public void createQueryTemplate(String json) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Creates a new Query Template, preserving the original UUID and metadata from the submitted JSON.- Parameters:
json- the Query Template representation as produced by a System Dump- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the creation fails
-
addToContext
public void addToContext(String type, UUID instanceUUID, UUID primaryContextUUID, UUID contextUUID) throws org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException Replays the membership of an already-created instance into one additional Context, exactly as captured by the dump: no avalanche propagation constraints are evaluated, since the dumped per-instance Context set is already the definitive, historically-derived result of whatever propagation originally applied. A Resource brings the ConsistsOf and Facet instances it was created with in its primary Context; an IsRelatedTo is added as the direct target of the operation, whatever its add constraint, and its Resources are already there. Themetadataof every instance reached stay those of the archive.- Parameters:
type- the concrete Entity or Relation type name of the instanceinstanceUUID- the UUID of the instance to placeprimaryContextUUID- the Context the instance was created incontextUUID- the additional Context to add the instance to- Throws:
org.gcube.informationsystem.resourceregistry.api.exceptions.ResourceRegistryException- if the membership cannot be established
-