Class LogbookLifeCycleTraceabilityHelper
java.lang.Object
fr.gouv.vitam.worker.core.plugin.lfc_traceability.LogbookLifeCycleTraceabilityHelper
- All Implemented Interfaces:
LogbookTraceabilityHelper
- Direct Known Subclasses:
LogbookObjectGroupLifeCycleTraceabilityHelper,LogbookUnitLifeCycleTraceabilityHelper
public abstract class LogbookLifeCycleTraceabilityHelper
extends Object
implements LogbookTraceabilityHelper
-
Field Summary
Fields inherited from interface fr.gouv.vitam.logbook.common.traceability.LogbookTraceabilityHelper
INITIAL_START_DATE -
Constructor Summary
ConstructorsConstructorDescriptionLogbookLifeCycleTraceabilityHelper(HandlerIO handlerIO, LogbookOperationsClient logbookOperationsClient, ItemStatus itemStatus, String operationID, String traceabilityEventFileName, String traceabilityZipFileName) -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status, TraceabilityEvent event) Update or finalize the traceability entry in the logbook collectionprotected voidextractAppendToFinalFile(CloseableIterator<com.fasterxml.jackson.databind.JsonNode> jsonLineIterator, TraceabilityFile traceabilityFile, MerkleTreeAlgo algo) Reduce part of the process : lets merge in one only file the disting lifecycles onesprotected abstract SelectlongWarning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIteratorbooleanGet 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 entryGet 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 (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 entryvoidSave the close master event if neededvoidPrepare and start the traceability operationvoidstoreAndDeleteZip(Integer tenant, String strategyId, File zipFile, String fileName, TraceabilityEvent event) Store the temporary zip.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface fr.gouv.vitam.logbook.common.traceability.LogbookTraceabilityHelper
getTraceabilityType, getZipName, saveDataInZip
-
Constructor Details
-
LogbookLifeCycleTraceabilityHelper
public LogbookLifeCycleTraceabilityHelper(HandlerIO handlerIO, LogbookOperationsClient logbookOperationsClient, ItemStatus itemStatus, String operationID, String traceabilityEventFileName, String traceabilityZipFileName) - Parameters:
handlerIO- Workflow Input/Output of the traceability eventlogbookOperationsClient- used to search the operation to secureitemStatus- used by workflow, event must be updated hereoperationID- of the current traceability processtraceabilityEventFileName-traceabilityZipFileName-
-
-
Method Details
-
startTraceability
Description copied from interface:LogbookTraceabilityHelperPrepare and start the traceability operation- 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
-
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
-
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
-
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)
-
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
-
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
- Throws:
InvalidParseOperationException- if any errors occurs while deserializing entry's data.
-
getPreviousMonthTimestampToken
public byte[] getPreviousMonthTimestampToken() throws InvalidParseOperationException, TraceabilityExceptionDescription copied from interface:LogbookTraceabilityHelperGet the first traceability (in logbook) one month before the given currentDate and return the timestampToken of the entry- Specified by:
getPreviousMonthTimestampTokenin interfaceLogbookTraceabilityHelper- Returns:
- the timestamp token of the matching entry or null if no matching entry
- Throws:
InvalidParseOperationException- if any errors occurs while deserializing entry's data.TraceabilityException- if any other error occurs
-
getPreviousYearTimestampToken
public byte[] getPreviousYearTimestampToken() throws InvalidParseOperationException, TraceabilityExceptionDescription copied from interface:LogbookTraceabilityHelperGet the first traceability (in logbook) one year before the given currentDate and return the timestampToken of the entry- Specified by:
getPreviousYearTimestampTokenin interfaceLogbookTraceabilityHelper- Returns:
- the timestamp token of the matching entry or null if no matching entry
- Throws:
InvalidParseOperationException- if any errors occurs while deserializing entry's data.TraceabilityException- if any other error occurs
-
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
- Throws:
InvalidParseOperationException- if any errors occurs while deserializing entry's data.
-
getPreviousMonthStartDate
public String getPreviousMonthStartDate() throws InvalidParseOperationException, TraceabilityExceptionDescription 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
- Throws:
InvalidParseOperationException- if any errors occurs while deserializing entry's data.TraceabilityException- if any other error occurs
-
getPreviousYearStartDate
public String getPreviousYearStartDate() throws InvalidParseOperationException, TraceabilityExceptionDescription 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
- Throws:
InvalidParseOperationException- if any errors occurs while deserializing entry's data.TraceabilityException- if any other error occurs
-
extractAppendToFinalFile
protected void extractAppendToFinalFile(CloseableIterator<com.fasterxml.jackson.databind.JsonNode> jsonLineIterator, TraceabilityFile traceabilityFile, MerkleTreeAlgo algo) throws TraceabilityException Reduce part of the process : lets merge in one only file the disting lifecycles ones- Parameters:
jsonLineIterator-traceabilityFile-algo-- Throws:
TraceabilityException
-
generateSelectLogbookOperation
protected abstract Select generateSelectLogbookOperation(LocalDateTime date) throws InvalidCreateOperationException - Throws:
InvalidCreateOperationException
-