Class SnapshotService
- java.lang.Object
-
- org.imixs.archive.core.SnapshotService
-
@DeclareRoles("org.imixs.ACCESSLEVEL.MANAGERACCESS") @RunAs("org.imixs.ACCESSLEVEL.MANAGERACCESS") public class SnapshotService extends ObjectThis 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:- create a copy of the origin workitem instance
- compute a snapshot $uniqueId based on the origin workitem suffixed with a timestamp
- change the type of the snapshot-workitem with the prefix 'snapshot-'
- If an old snapshot already exists, Files are compared to the current $ files and, if necessary, stored in the Snapshot applied
- remove the file content form the origin-workitem
- store the snapshot uniqeId into the origin-workitem as a reference ($snapshotID)
- remove deprecated snapshots
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 Summary
Fields Modifier and Type Field Description static StringARCHIVE_SERVICE_AUTHMETHODstatic StringARCHIVE_SERVICE_DEADLOCKstatic StringARCHIVE_SERVICE_ENDPOINTstatic StringARCHIVE_SERVICE_INTERVALstatic StringARCHIVE_SERVICE_PASSWORDstatic StringARCHIVE_SERVICE_USERstatic StringBACKUP_SERVICE_ENDPOINTstatic StringEVENTLOG_TOPIC_ADDstatic StringEVENTLOG_TOPIC_BACKUPstatic StringEVENTLOG_TOPIC_REMOVEstatic StringITEM_BACKUPRESTOREstatic StringITEM_FILEDATA_FILE_COUNTstatic StringITEM_FILEDATA_FILE_NAMESstatic StringITEM_MD5_CHECKSUMstatic StringITEM_SNAPSHOT_OVERWRITEFILECONTENTstatic StringNOSNAPSHOTstatic StringPROPERTY_SNAPSHOT_HISTORYstatic StringPROPERTY_SNAPSHOT_OVERWRITEFILECONTENTstatic StringPROPERTY_SNAPSHOT_WORKITEMLOB_SUPPORTstatic StringREGEX_URL_PATTERNstatic StringSKIPSNAPSHOTstatic StringSNAPSHOTIDstatic StringTYPE_PRAFIX
-
Constructor Summary
Constructors Constructor Description SnapshotService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<org.imixs.workflow.ItemCollection>findAllSnapshots(String uniqueid)This method returns all existing Snapshot-workitems for a given $UNIQUEID.org.imixs.workflow.ItemCollectionfindSnapshot(org.imixs.workflow.ItemCollection workitem)This method loads the snapshot for a given origin workItem .org.imixs.workflow.FileDatagetWorkItemFile(String uniqueid, String file)This method returns the fileData from a snapshot by a given origin workItem uniqueid.voidonDelete(org.imixs.workflow.engine.DocumentEvent documentEvent)All existing snapshot-workitems will be deleted when the workitem is removed.voidonSave(org.imixs.workflow.engine.DocumentEvent documentEvent)The snapshot-workitem is created immediately after the workitem was processed and before the workitem is saved.
-
-
-
Field Detail
-
REGEX_URL_PATTERN
public static final String REGEX_URL_PATTERN
- See Also:
- Constant Field Values
-
SNAPSHOTID
public static final String SNAPSHOTID
- See Also:
- Constant Field Values
-
TYPE_PRAFIX
public static final String TYPE_PRAFIX
- See Also:
- Constant Field Values
-
NOSNAPSHOT
public static final String NOSNAPSHOT
- See Also:
- Constant Field Values
-
SKIPSNAPSHOT
public static final String SKIPSNAPSHOT
- See Also:
- Constant Field Values
-
ITEM_FILEDATA_FILE_NAMES
public static final String ITEM_FILEDATA_FILE_NAMES
- See Also:
- Constant Field Values
-
ITEM_FILEDATA_FILE_COUNT
public static final String ITEM_FILEDATA_FILE_COUNT
- See Also:
- Constant Field Values
-
ITEM_SNAPSHOT_OVERWRITEFILECONTENT
public static final String ITEM_SNAPSHOT_OVERWRITEFILECONTENT
- See Also:
- Constant Field Values
-
ITEM_BACKUPRESTORE
public static final String ITEM_BACKUPRESTORE
- See Also:
- Constant Field Values
-
PROPERTY_SNAPSHOT_WORKITEMLOB_SUPPORT
public static final String PROPERTY_SNAPSHOT_WORKITEMLOB_SUPPORT
- See Also:
- Constant Field Values
-
PROPERTY_SNAPSHOT_HISTORY
public static final String PROPERTY_SNAPSHOT_HISTORY
- See Also:
- Constant Field Values
-
PROPERTY_SNAPSHOT_OVERWRITEFILECONTENT
public static final String PROPERTY_SNAPSHOT_OVERWRITEFILECONTENT
- See Also:
- Constant Field Values
-
ARCHIVE_SERVICE_ENDPOINT
public static final String ARCHIVE_SERVICE_ENDPOINT
- See Also:
- Constant Field Values
-
ARCHIVE_SERVICE_INTERVAL
public static final String ARCHIVE_SERVICE_INTERVAL
- See Also:
- Constant Field Values
-
ARCHIVE_SERVICE_DEADLOCK
public static final String ARCHIVE_SERVICE_DEADLOCK
- See Also:
- Constant Field Values
-
ARCHIVE_SERVICE_USER
public static final String ARCHIVE_SERVICE_USER
- See Also:
- Constant Field Values
-
ARCHIVE_SERVICE_PASSWORD
public static final String ARCHIVE_SERVICE_PASSWORD
- See Also:
- Constant Field Values
-
ARCHIVE_SERVICE_AUTHMETHOD
public static final String ARCHIVE_SERVICE_AUTHMETHOD
- See Also:
- Constant Field Values
-
BACKUP_SERVICE_ENDPOINT
public static final String BACKUP_SERVICE_ENDPOINT
- See Also:
- Constant Field Values
-
EVENTLOG_TOPIC_ADD
public static final String EVENTLOG_TOPIC_ADD
- See Also:
- Constant Field Values
-
EVENTLOG_TOPIC_REMOVE
public static final String EVENTLOG_TOPIC_REMOVE
- See Also:
- Constant Field Values
-
EVENTLOG_TOPIC_BACKUP
public static final String EVENTLOG_TOPIC_BACKUP
- See Also:
- Constant Field Values
-
ITEM_MD5_CHECKSUM
public static final String ITEM_MD5_CHECKSUM
- See Also:
- Constant Field Values
-
-
Method Detail
-
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
-
-