Class DataService
java.lang.Object
org.imixs.archive.service.cassandra.DataService
The SnapshotService is used to store a imixs snapshot into the cluster
keyspace.
- Author:
- rsoika
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected jakarta.enterprise.event.Event<ArchiveEvent>static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongcalculateSize(org.imixs.workflow.xml.XMLDocument xmldoc) count total value size...voiddeleteSnapshot(String snapshotID) This method deletes a single snapshot instance.booleanexistSnapshot(String snapshotID) This method test if a snapshot recored with a given ID already exists.org.imixs.workflow.ItemCollectiongetItemCollection(byte[] source) Converts a byte array into a XMLDocument and returns the ItemCollection object.byte[]getRawData(org.imixs.workflow.ItemCollection itemCol) Converts a ItemCollection into a XMLDocument and returns the byte data.longgetSnapshotTime(String snapshotID) Returns the snapshot time n millis of a $SnapshotIDgetSyncPointISO(long point) returns the date tiem from a date in iso formatgetUniqueID(String snapshotID) Returns the $uniqueID from a $SnapshotIDbooleanisSnapshotID(String uid) This method returns true if the given id is a valid Snapshot id (UUI + timestampbyte[]loadFileContent(String md5) This helper method loads the content of a document defned by its MD5 checksum.org.imixs.workflow.FileDataloadFileData(org.imixs.workflow.FileData fileData) This helper method loades the content of a document defned by a FileData object.org.imixs.workflow.ItemCollectionThis method loads the metadata object represended by an ItemCollection.org.imixs.workflow.ItemCollectionloadSnapshot(String snapshotID) This method loads a snapshot form the cassandra cluster.org.imixs.workflow.ItemCollectionloadSnapshot(String snapshotID, boolean mergeDocuments) Thist method loads a snapshot form the cassandra cluster.loadSnapshotsByDate(LocalDate date) This method loads all exsting snapshotIDs for a given date.loadSnapshotsByUnqiueID(String uniqueID, int maxCount, boolean descending) This method loads all existing snapshotIDs for a given unqiueID.voidsaveMetadata(org.imixs.workflow.ItemCollection metadata) This method saves the metadata represented by an ItemCollection.voidsaveSnapshot(org.imixs.workflow.ItemCollection snapshot) This method saves a ItemCollection into a specific KeySpace.
-
Field Details
-
ITEM_MD5_CHECKSUM
- See Also:
-
ITEM_SNAPSHOT_HISTORY
- See Also:
-
COLUMN_SNAPSHOT
- See Also:
-
COLUMN_MODIFIED
- See Also:
-
COLUMN_UNIQUEID
- See Also:
-
COLUMN_DATA
- See Also:
-
COLUMN_MD5
- See Also:
-
STATEMENT_UPSET_SNAPSHOTS
- See Also:
-
STATEMENT_UPSET_SNAPSHOTS_BY_UNIQUEID
- See Also:
-
STATEMENT_UPSET_SNAPSHOTS_BY_MODIFIED
- See Also:
-
STATEMENT_UPSET_DOCUMENTS
- See Also:
-
STATEMENT_UPSET_DOCUMENTS_DATA
- See Also:
-
STATEMENT_UPSET_SNAPSHOTS_BY_DOCUMENT
- See Also:
-
STATEMENT_SELECT_SNAPSHOT
- See Also:
-
STATEMENT_SELECT_METADATA
- See Also:
-
STATEMENT_SELECT_SNAPSHOT_ID
- See Also:
-
STATEMENT_SELECT_MD5
- See Also:
-
STATEMENT_SELECT_DOCUMENTS
- See Also:
-
STATEMENT_SELECT_DOCUMENTS_DATA
- See Also:
-
STATEMENT_SELECT_SNAPSHOTS_BY_DOCUMENT
- See Also:
-
STATEMENT_SELECT_SNAPSHOTS_BY_UNIQUEID
- See Also:
-
STATEMENT_SELECT_SNAPSHOTS_BY_MODIFIED
- See Also:
-
STATEMENT_DELETE_SNAPSHOTS
- See Also:
-
STATEMENT_DELETE_SNAPSHOTS_BY_MODIFIED
- See Also:
-
STATEMENT_DELETE_SNAPSHOTS_BY_UNIQUEID
- See Also:
-
STATEMENT_DELETE_SNAPSHOTS_BY_DOCUMENT
- See Also:
-
STATEMENT_DELETE_DOCUMENTS_DATA
- See Also:
-
STATEMENT_DELETE_DOCUMENTS
- See Also:
-
events
-
-
Constructor Details
-
DataService
public DataService()
-
-
Method Details
-
saveSnapshot
This method saves a ItemCollection into a specific KeySpace.The method expects a valid session instance which must be closed by the client.
- Parameters:
snapshot- - ItemCollection objectsession- - cassandra session- Throws:
ArchiveException
-
existSnapshot
This method test if a snapshot recored with a given ID already exists.- Parameters:
snapshotID-- Returns:
- true if the snapshot exists.
-
loadSnapshot
This method loads a snapshot form the cassandra cluster. The snapshot data includes also the accociated document data. In case you need only the snapshotdata without documents use loadSnapshot(id,false,session).- Parameters:
snapshotID- - snapshot idsession- - cassandra session- Returns:
- snapshot data including documents
- Throws:
ArchiveException
-
loadSnapshot
public org.imixs.workflow.ItemCollection loadSnapshot(String snapshotID, boolean mergeDocuments) throws ArchiveException Thist method loads a snapshot form the cassandra cluster.- Parameters:
snapshotID- - snapshot idmergeDocuments- - boolean, if true the accociated document data will be loaded and merged into the snapshot data object.session- - cassandra session- Returns:
- snapshot data
- Throws:
ArchiveException
-
loadSnapshotsByUnqiueID
This method loads all existing snapshotIDs for a given unqiueID.- Parameters:
uniqueID-maxCount- - max search resultdescending- - sort result descending- Returns:
- list of snapshots
-
loadSnapshotsByDate
This method loads all exsting snapshotIDs for a given date.- Parameters:
date-- Returns:
- list of snapshots or an empty list if no snapshots exist for the given date
-
loadFileData
public org.imixs.workflow.FileData loadFileData(org.imixs.workflow.FileData fileData) throws ArchiveException This helper method loades the content of a document defned by a FileData object. A document is uniquely identified by its md5 checksum which is part of the FileData custom attributes. The data of the document is stored in split 1md data blocks in the tabe 'documents_data'- Parameters:
itemCol-- Throws:
ArchiveException
-
loadFileContent
This helper method loads the content of a document defned by its MD5 checksum. The data of the document is stored in chunked 1md data blocks in the table 'documents_data'- Parameters:
itemCol-- Throws:
ArchiveException
-
loadMetadata
This method loads the metadata object represended by an ItemCollection. The snapshot id for the metadata object is always "0". This id is reserverd for metadata only.If no metadata object yet exists, the method returns an empty ItemCollection.
The method expects a valid session instance which must be closed by the client.
- Returns:
- metadata object
- Throws:
ArchiveException
-
saveMetadata
This method saves the metadata represented by an ItemCollection. The snapshot id for the metadata object is always "0". This id is reserverd for metadata only.The method expects a valid session instance which must be closed by the client.
- Parameters:
itemCol- - metadata- Throws:
ArchiveException
-
deleteSnapshot
This method deletes a single snapshot instance.The method also deletes the documents and all relations
- Parameters:
snapshotID- - id of the snapshot- Throws:
ArchiveException
-
getRawData
Converts a ItemCollection into a XMLDocument and returns the byte data.- Parameters:
itemCol-- Returns:
- Throws:
ArchiveException
-
getItemCollection
Converts a byte array into a XMLDocument and returns the ItemCollection object.- Throws:
ArchiveException
-
isSnapshotID
This method returns true if the given id is a valid Snapshot id (UUI + timestampWe also need to support the old snapshto format
4832b09a1a-20c38abd-1519421083952- Parameters:
uid-- Returns:
-
getUniqueID
Returns the $uniqueID from a $SnapshotID- Parameters:
snapshotID-- Returns:
- $uniqueid
-
getSnapshotTime
Returns the snapshot time n millis of a $SnapshotID- Parameters:
snapshotID-- Returns:
- long - snapshot time
-
calculateSize
public long calculateSize(org.imixs.workflow.xml.XMLDocument xmldoc) count total value size...- Parameters:
xmldoc-- Returns:
-
getSyncPointISO
returns the date tiem from a date in iso format- Returns:
-