Class LogbookOperationTraceabilityHelper
java.lang.Object
fr.gouv.vitam.logbook.administration.core.LogbookOperationTraceabilityHelper
- All Implemented Interfaces:
LogbookTraceabilityHelper
-
Field Summary
FieldsFields inherited from interface fr.gouv.vitam.logbook.common.traceability.LogbookTraceabilityHelper
INITIAL_START_DATE -
Constructor Summary
ConstructorsConstructorDescriptionLogbookOperationTraceabilityHelper(LogbookOperations logbookOperations, GUID operationID, int temporizationDelayInSeconds, int traceabilityExpirationInSeconds, int operationTraceabilityMaxEntries, String securisationVersion) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status, TraceabilityEvent event) Update or finalize the traceability entry in the logbook collectionlongWarning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIteratorbooleanGet the first traceability operation id (in logbook) one month before the given currentDateGet the first traceability (in logbook) one month before the given currentDate and return the startDate of the entrybyte[]Get the first traceability (in logbook) one month before the given currentDate and return the timestampToken of the entry for a specific securisation versionGet the last traceability operation IdGet the last traceability (in logbook) event and return the startDate of the entrybyte[]Get the last traceability (in logbook) event and return the timestampToken of the entryGet the first traceability operation id (in logbook) one year before the given currentDateGet the first traceability (in logbook) one year before the given currentDate and return the startDate of the entrybyte[]Get the first traceability (in logbook) one year before the given currentDate and return the timestampToken of the entry for a specific securisation versionvoidbooleanvoidsaveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) Search for entries to secure with the traceability process and store data in the given Traceability zip file.
Also, Merkle Algorithm should be updated by adding each wanted entry as a leaf of the tree.voidSave the close master event if neededvoidPrepare and start the traceability operation with a specific versionvoidstoreAndDeleteZip(Integer tenant, String strategyId, File zipFile, String fileName, TraceabilityEvent event) Store the temporary zip.
-
Field Details
-
STP_OP_SECURISATION
- See Also:
-
-
Constructor Details
-
LogbookOperationTraceabilityHelper
public LogbookOperationTraceabilityHelper(LogbookOperations logbookOperations, GUID operationID, int temporizationDelayInSeconds, int traceabilityExpirationInSeconds, int operationTraceabilityMaxEntries, String securisationVersion) - Parameters:
logbookOperations- used to search the operation to secureoperationID- guid of the traceability operationtemporizationDelayInSeconds- temporization delay (in seconds) for recent logbook operation events.traceabilityExpirationInSeconds-operationTraceabilityMaxEntries-
-
-
Method Details
-
initialize
- Throws:
TraceabilityException
-
isTraceabilityOperationRequired
- Throws:
TraceabilityException
-
saveDataInZip
public void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException Description copied from interface:LogbookTraceabilityHelperSearch for entries to secure with the traceability process and store data in the given Traceability zip file.
Also, Merkle Algorithm should be updated by adding each wanted entry as a leaf of the tree.- Specified by:
saveDataInZipin interfaceLogbookTraceabilityHelper- Parameters:
algo- algorithm used to generate MerkleTree with data.file- output zip to store data (in some TYPE_COLLECTION.json)- Throws:
IOException- if any error occurs while writing in traceabilityFileTraceabilityException- for any other errors specifically in the search / data transformation
-
getPreviousOperationId
Description copied from interface:LogbookTraceabilityHelperGet the last traceability operation Id- Specified by:
getPreviousOperationIdin interfaceLogbookTraceabilityHelper- Returns:
- the operation id of the last traceability entry or null if no previous traceability found
-
getPreviousStartDate
Description copied from interface:LogbookTraceabilityHelperGet the last traceability (in logbook) event and return the startDate of the entry- Specified by:
getPreviousStartDatein interfaceLogbookTraceabilityHelper- Returns:
- the start date of the last traceability entry
-
getPreviousTimestampToken
public byte[] getPreviousTimestampToken()Description copied from interface:LogbookTraceabilityHelperGet the last traceability (in logbook) event and return the timestampToken of the entry- Specified by:
getPreviousTimestampTokenin interfaceLogbookTraceabilityHelper- Returns:
- the timestamp token of the last traceability entry or null if no previous traceability OK for that type
-
getPreviousMonthOperationId
Description copied from interface:LogbookTraceabilityHelperGet the first traceability operation id (in logbook) one month before the given currentDate- Specified by:
getPreviousMonthOperationIdin interfaceLogbookTraceabilityHelper- Returns:
- the operation id, or null
-
getPreviousMonthStartDate
Description copied from interface:LogbookTraceabilityHelperGet the first traceability (in logbook) one month before the given currentDate and return the startDate of the entry- Specified by:
getPreviousMonthStartDatein interfaceLogbookTraceabilityHelper- Returns:
- the start date of the matching entry or null if no matching entry
-
getPreviousMonthTimestampToken
public byte[] getPreviousMonthTimestampToken()Description copied from interface:LogbookTraceabilityHelperGet the first traceability (in logbook) one month before the given currentDate and return the timestampToken of the entry for a specific securisation version- Specified by:
getPreviousMonthTimestampTokenin interfaceLogbookTraceabilityHelper- Returns:
- the timestamp token of the matching entry or null if no matching entry
-
getPreviousYearOperationId
Description copied from interface:LogbookTraceabilityHelperGet the first traceability operation id (in logbook) one year before the given currentDate- Specified by:
getPreviousYearOperationIdin interfaceLogbookTraceabilityHelper- Returns:
- the operation id
-
getPreviousYearStartDate
Description copied from interface:LogbookTraceabilityHelperGet the first traceability (in logbook) one year before the given currentDate and return the startDate of the entry- Specified by:
getPreviousYearStartDatein interfaceLogbookTraceabilityHelper- Returns:
- the start date of the matching entry or null if no matching entry
-
getPreviousYearTimestampToken
public byte[] getPreviousYearTimestampToken()Description copied from interface:LogbookTraceabilityHelperGet the first traceability (in logbook) one year before the given currentDate and return the timestampToken of the entry for a specific securisation version- Specified by:
getPreviousYearTimestampTokenin interfaceLogbookTraceabilityHelper- Returns:
- the timestamp token of the matching entry or null if no matching entry
-
startTraceability
Description copied from interface:LogbookTraceabilityHelperPrepare and start the traceability operation with a specific version- Specified by:
startTraceabilityin interfaceLogbookTraceabilityHelper- Throws:
TraceabilityException- if any error occurs
-
createLogbookOperationEvent
public void createLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status, TraceabilityEvent event) throws TraceabilityException Description copied from interface:LogbookTraceabilityHelperUpdate or finalize the traceability entry in the logbook collection- Specified by:
createLogbookOperationEventin interfaceLogbookTraceabilityHelper- Parameters:
tenantId- tenant used for the operationeventType- code of the eventType for the entrystatus- status of the entryevent- data of the entry- Throws:
TraceabilityException- if any error occurs
-
saveEmpty
Description copied from interface:LogbookTraceabilityHelperSave the close master event if needed- Specified by:
saveEmptyin interfaceLogbookTraceabilityHelper- Parameters:
tenantId- the tenant used for log- Throws:
TraceabilityException
-
storeAndDeleteZip
public void storeAndDeleteZip(Integer tenant, String strategyId, File zipFile, String fileName, TraceabilityEvent event) throws TraceabilityException Description copied from interface:LogbookTraceabilityHelperStore the temporary zip.- Specified by:
storeAndDeleteZipin interfaceLogbookTraceabilityHelper- Parameters:
tenant- tenant used for the operationstrategyId- strategy used for the storagezipFile- file containing multiple information about the traceability operation (data, merkle, computingData, ...)fileName- name of the file on the destinationevent- traceability event that should be updated by this operation- Throws:
TraceabilityException- if any error occurs
-
getStepName
- Specified by:
getStepNamein interfaceLogbookTraceabilityHelper- Returns:
- the main eventType code for the specific implementation class
-
getTimestampStepName
- Specified by:
getTimestampStepNamein interfaceLogbookTraceabilityHelper- Returns:
- the timestamp eventType code for the specific implementation class
-
getZipName
- Specified by:
getZipNamein interfaceLogbookTraceabilityHelper- Returns:
- the name of the tmp zip file
-
getTraceabilityType
- Specified by:
getTraceabilityTypein interfaceLogbookTraceabilityHelper- Returns:
- the traceabilityType of the implementation class
-
getMaxEntriesReached
public boolean getMaxEntriesReached()- Specified by:
getMaxEntriesReachedin interfaceLogbookTraceabilityHelper- Returns:
- true if max entries reached (unit & object group lifecycle traceability operation are limited in size)
-
getTraceabilityStatistics
- Specified by:
getTraceabilityStatisticsin interfaceLogbookTraceabilityHelper
-
getDataSize
public long getDataSize()Description copied from interface:LogbookTraceabilityHelperWarning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIterator- Specified by:
getDataSizein interfaceLogbookTraceabilityHelper- Returns:
- the number of items secured in traceabilityIterator
-
getTraceabilityStartDate
- Specified by:
getTraceabilityStartDatein interfaceLogbookTraceabilityHelper- Returns:
- the start date of the traceability (computed from the end date of the last traceability)
-
getTraceabilityEndDate
- Specified by:
getTraceabilityEndDatein interfaceLogbookTraceabilityHelper- Returns:
- the end date of the traceability (now)
-
getSecurisationVersion
- Specified by:
getSecurisationVersionin interfaceLogbookTraceabilityHelper
-