Class AnnotationHistoryRepository
- java.lang.Object
-
- com.nuix.superutilities.annotations.AnnotationHistoryRepository
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable
public class AnnotationHistoryRepository extends java.lang.Object implements java.io.CloseableClass for recording annotation in a source case and replaying on a destination case. GUID is used to record items in source case and match items in destination case.
-
-
Constructor Summary
Constructors Constructor Description AnnotationHistoryRepository(java.io.File databaseFile)Creates a new instance against the given and database file.AnnotationHistoryRepository(java.lang.String databaseFile)Creates a new instance against the given and database file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AnnotationHistoryRepositorySummarybuildSummary()org.joda.time.DateTimecalculateLastDbEventStart()voidclose()voideachRecordedCustodianEvent(long startedAfter, java.util.function.Consumer<CustodianEvent> callback)voideachRecordedCustodianEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<CustodianEvent> callback)voideachRecordedCustomMetadataEvent(long startedAfter, java.util.function.Consumer<CustomMetadataEvent> callback)voideachRecordedCustomMetadataEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<CustomMetadataEvent> callback)voideachRecordedExclusionEvent(long startedAfter, java.util.function.Consumer<ExclusionEvent> callback)voideachRecordedExclusionEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<ExclusionEvent> callback)voideachRecordedItemSetEvent(long startedAfter, java.util.function.Consumer<ItemSetEvent> callback)voideachRecordedItemSetEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<ItemSetEvent> callback)voideachRecordedProductionSetEvent(long startedAfter, java.util.function.Consumer<ProductionSetEvent> callback)voideachRecordedProductionSetEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<ProductionSetEvent> callback)voideachRecordedTagEvent(long startedAfter, java.util.function.Consumer<TagEvent> callback)voideachRecordedTagEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<TagEvent> callback)voidexecuteInsert(java.lang.String sql, java.lang.Object... data)voidexecuteInsert(java.lang.String sql, java.util.List<java.lang.Object> data)Executes an insert query against the SQLite database filejava.lang.LongexecuteLongScalar(java.lang.String sql)java.lang.LongexecuteLongScalar(java.lang.String sql, java.lang.Object... data)java.lang.LongexecuteLongScalar(java.lang.String sql, java.util.List<java.lang.Object> data)voidexecuteQuery(java.lang.String sql, java.util.List<java.lang.Object> data, java.util.function.Consumer<java.sql.ResultSet> resultConsumer)Executes a query which is expected to return row data, providing the result set to the provided callback.<T> TexecuteScalar(java.lang.String sql, java.lang.Object... data)java.lang.StringexecuteStringScalar(java.lang.String sql)java.lang.StringexecuteStringScalar(java.lang.String sql, java.lang.Object... data)java.lang.StringexecuteStringScalar(java.lang.String sql, java.util.List<java.lang.Object> data)intexecuteUpdate(java.lang.String sql)intexecuteUpdate(java.lang.String sql, java.lang.Object... data)intexecuteUpdate(java.lang.String sql, java.util.List<java.lang.Object> data)Executes an update query against the SQLite database fileintgetGuidRefInsertBatchSize()java.lang.LonggetIntegerInfo(java.lang.String name)booleangetSnapshotFirstSync()Gets whether a more succinct snapshot should be created in a new database.java.lang.StringgetTextInfo(java.lang.String name)longgetTotalEventCount()Returns the total number of event entries in the database filevoidsetGuidRefInsertBatchSize(int guidRefInsertBatchSize)voidsetIntegerInfo(java.lang.String name, java.lang.Long value)voidsetSnapshotFirstSync(boolean snapshotFirstSync)Sets whether a more succinct snapshot should be created in a new database.voidsetSyncPoint(org.joda.time.DateTime dateTime)voidsetSyncPointFromDestinationCaseLastEvent(nuix.Case nuixCase)voidsetSyncPointToNow()voidsetTextInfo(java.lang.String name, java.lang.String value)voidsyncHistory(nuix.Case nuixCase, AnnotationSyncSettings settings)Records annotation event data to the database file.
-
-
-
Constructor Detail
-
AnnotationHistoryRepository
public AnnotationHistoryRepository(java.io.File databaseFile) throws java.sql.SQLExceptionCreates a new instance against the given and database file. If the database file does not already exist it will be created and initialized.- Parameters:
databaseFile- The database file to record annotations to or playback annotations from- Throws:
java.sql.SQLException- If the SQL bits throw an error
-
AnnotationHistoryRepository
public AnnotationHistoryRepository(java.lang.String databaseFile) throws java.sql.SQLExceptionCreates a new instance against the given and database file. If the database file does not already exist it will be created and initialized.- Parameters:
databaseFile- The database file to record annotations to or playback annotations from- Throws:
java.sql.SQLException- If the SQL bits throw an error
-
-
Method Detail
-
getIntegerInfo
public java.lang.Long getIntegerInfo(java.lang.String name) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setIntegerInfo
public void setIntegerInfo(java.lang.String name, java.lang.Long value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getTextInfo
public java.lang.String getTextInfo(java.lang.String name) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setTextInfo
public void setTextInfo(java.lang.String name, java.lang.String value) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setSyncPointToNow
public void setSyncPointToNow() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
setSyncPointFromDestinationCaseLastEvent
public void setSyncPointFromDestinationCaseLastEvent(nuix.Case nuixCase) throws java.lang.Exception- Throws:
java.lang.Exception
-
setSyncPoint
public void setSyncPoint(org.joda.time.DateTime dateTime) throws java.lang.Exception- Throws:
java.lang.Exception
-
executeUpdate
public int executeUpdate(java.lang.String sql, java.util.List<java.lang.Object> data) throws java.sql.SQLExceptionExecutes an update query against the SQLite database file- Parameters:
sql- The SQL to executedata- Optional list of associated data, can be null- Returns:
- Count of affected records
- Throws:
java.sql.SQLException- If the SQL bits throw an error
-
executeUpdate
public int executeUpdate(java.lang.String sql, java.lang.Object... data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeUpdate
public int executeUpdate(java.lang.String sql) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeInsert
public void executeInsert(java.lang.String sql, java.util.List<java.lang.Object> data) throws java.sql.SQLExceptionExecutes an insert query against the SQLite database file- Parameters:
sql- The SQL to executedata- Optional list of associated data, can be null- Throws:
java.sql.SQLException- If the SQL bits throw an error
-
executeInsert
public void executeInsert(java.lang.String sql, java.lang.Object... data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeLongScalar
public java.lang.Long executeLongScalar(java.lang.String sql, java.lang.Object... data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeLongScalar
public java.lang.Long executeLongScalar(java.lang.String sql, java.util.List<java.lang.Object> data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeLongScalar
public java.lang.Long executeLongScalar(java.lang.String sql) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeStringScalar
public java.lang.String executeStringScalar(java.lang.String sql, java.lang.Object... data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeStringScalar
public java.lang.String executeStringScalar(java.lang.String sql, java.util.List<java.lang.Object> data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeStringScalar
public java.lang.String executeStringScalar(java.lang.String sql) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeScalar
public <T> T executeScalar(java.lang.String sql, java.lang.Object... data) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
executeQuery
public void executeQuery(java.lang.String sql, java.util.List<java.lang.Object> data, java.util.function.Consumer<java.sql.ResultSet> resultConsumer) throws java.sql.SQLExceptionExecutes a query which is expected to return row data, providing the result set to the provided callback.- Parameters:
sql- The SQL query to executedata- Optional list of associated data, can be nullresultConsumer- Callback which will be provided the result set. This is where you provide code to make use of the results.- Throws:
java.sql.SQLException- If the SQL bits throw an error
-
getTotalEventCount
public long getTotalEventCount() throws java.sql.SQLExceptionReturns the total number of event entries in the database file- Returns:
- Total event row count
- Throws:
java.sql.SQLException- If the SQL bits throw an error
-
calculateLastDbEventStart
public org.joda.time.DateTime calculateLastDbEventStart() throws java.sql.SQLException- Throws:
java.sql.SQLException
-
syncHistory
public void syncHistory(nuix.Case nuixCase, AnnotationSyncSettings settings) throws java.io.IOException, java.sql.SQLExceptionRecords annotation event data to the database file. If there are 0 events currently recorded and snap shot on first sync is enabled (seesetSnapshotFirstSync(boolean), true is the default) then this will attempt to make a compacted representation of the state of the annotations in the case. Otherwise this method will iterate every single history event in the case and record it in the database. If the database already contains event entries, instead this method will determine the latest event started date and then query the Nuix case history for all further events started after that point, effectively obtaining and recording all new event history entries not yet recorded in this database.- Parameters:
nuixCase- The case to record history events fromsettings- The settings which determine how the sync is performed- Throws:
java.io.IOException- If there is an error: creating snapshot, getting case history or converting items into bitamp byte array for DBjava.sql.SQLException- If the SQL bits throw an error
-
eachRecordedTagEvent
public void eachRecordedTagEvent(long startedAfter, java.util.function.Consumer<TagEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedTagEvent
public void eachRecordedTagEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<TagEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedExclusionEvent
public void eachRecordedExclusionEvent(long startedAfter, java.util.function.Consumer<ExclusionEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedExclusionEvent
public void eachRecordedExclusionEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<ExclusionEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedCustomMetadataEvent
public void eachRecordedCustomMetadataEvent(long startedAfter, java.util.function.Consumer<CustomMetadataEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedCustomMetadataEvent
public void eachRecordedCustomMetadataEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<CustomMetadataEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedItemSetEvent
public void eachRecordedItemSetEvent(long startedAfter, java.util.function.Consumer<ItemSetEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedItemSetEvent
public void eachRecordedItemSetEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<ItemSetEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedCustodianEvent
public void eachRecordedCustodianEvent(long startedAfter, java.util.function.Consumer<CustodianEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedCustodianEvent
public void eachRecordedCustodianEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<CustodianEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedProductionSetEvent
public void eachRecordedProductionSetEvent(long startedAfter, java.util.function.Consumer<ProductionSetEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
eachRecordedProductionSetEvent
public void eachRecordedProductionSetEvent(org.joda.time.DateTime startedAfter, java.util.function.Consumer<ProductionSetEvent> callback) throws java.sql.SQLException- Throws:
java.sql.SQLException
-
getSnapshotFirstSync
public boolean getSnapshotFirstSync()
Gets whether a more succinct snapshot should be created in a new database.- Returns:
- True means the code will attempt to make a snapshot while false means the code will just record all annotation history events.
-
setSnapshotFirstSync
public void setSnapshotFirstSync(boolean snapshotFirstSync)
Sets whether a more succinct snapshot should be created in a new database.- Parameters:
snapshotFirstSync- True means the code will attempt to make a snapshot while false means the code will just record all annotation history events.
-
getGuidRefInsertBatchSize
public int getGuidRefInsertBatchSize()
-
setGuidRefInsertBatchSize
public void setGuidRefInsertBatchSize(int guidRefInsertBatchSize)
-
buildSummary
public AnnotationHistoryRepositorySummary buildSummary() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
-