Class SnapshotService

java.lang.Object
org.imixs.archive.core.SnapshotService

@DeclareRoles("org.imixs.ACCESSLEVEL.MANAGERACCESS") @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS") public class SnapshotService extends Object
This service component provides a mechanism to transfer the content of a workitem into a snapshot workitem. Attached files will be linked from the snapshot-workitem to the origin-workitem. The snapshot process includes the following stages:
  1. create a copy of the origin workitem instance
  2. compute a snapshot $uniqueId based on the origin workitem suffixed with a timestamp
  3. change the type of the snapshot-workitem with the prefix 'snapshot-'
  4. If an old snapshot already exists, Files are compared to the current $ files and, if necessary, stored in the Snapshot applied
  5. remove the file content form the origin-workitem
  6. store the snapshot uniqeId into the origin-workitem as a reference ($snapshotID)
  7. remove deprecated snapshots
A snapshot workitem holds a reference to the origin workitem by its own $uniqueId which is always the $uniqueId from the origin workitem suffixed with a timestamp.

 7009e427-7078-4492-af78-0a1145a736df-[SNAPSHOT TIMESTAMP]
 

During the snapshot creation the snapshot-uniquId is stored into the origin workitem.

The SnapshotService implements the CDI Observer pattern provided from the DocumentService.

Model entries are not part of the snapshot concept

Note: The SnapshotService replaces the BlobWorkitems mechanism which was earlier part of the DMSPlugin from the imixs-marty project. The SnapshotService provides a migration mechanism for old BlobWorkitems. The old BlobWorkitems will not be deleted. If the DMSPlugin is still active and documents from the type 'workitemlob' will be saved, the SnapshotService throws a SnapshotException.

SnapshotService
Since version 2.0 a Imixs Archive Service can be connected to a Imixs-Workflow instance. If the environment variable 'ARCHIVE_SERVICE_ENDPONT' is set, than the snapshot service creates a EventLog entry each time a snapshot was generated. The Archive SyncService scans for the EventLog entries in an asynchronous way and pulls the snaphots directly into the Archive (Cassandra).

BackupService
Since version 2.4 an optional BackupService can be connected to a Imixs-Workflow instance. If the environment variable 'BACKUP_SERVICE_ENDPONT' is set, than the snapshot service creates a EventLog entry each time a snapshot was generated. The BackupService scans for these EventLog entries in an asynchronous way and stores the snaphots into a backup space

Version:
2.0
Author:
rsoika
  • Field Details

  • Constructor Details

    • SnapshotService

      public SnapshotService()
  • Method Details

    • onSave

      public void onSave(@Observes org.imixs.workflow.engine.DocumentEvent documentEvent)
      The snapshot-workitem is created immediately after the workitem was processed and before the workitem is saved.
    • onDelete

      public void onDelete(@Observes org.imixs.workflow.engine.DocumentEvent documentEvent)
      All existing snapshot-workitems will be deleted when the workitem is removed.
    • findAllSnapshots

      public List<org.imixs.workflow.ItemCollection> findAllSnapshots(String uniqueid)
      This method returns all existing Snapshot-workitems for a given $UNIQUEID. The method queries the possible snapshot id-range for a given $UniqueId sorted by creation date descending.
      Parameters:
      uniqueid -
      Returns:
    • findSnapshot

      public org.imixs.workflow.ItemCollection findSnapshot(org.imixs.workflow.ItemCollection workitem)
      This method loads the snapshot for a given origin workItem .
      Parameters:
      workitem -
      Returns:
      ItemCollection - snapshot object if found
    • getWorkItemFile

      public org.imixs.workflow.FileData getWorkItemFile(String uniqueid, String file)
      This method returns the fileData from a snapshot by a given origin workItem uniqueid.
      Parameters:
      uniqueid -
      file - - file name
      Returns:
      FileData object for the given filename.