public abstract class LogbookLifeCycleTraceabilityHelper extends Object implements LogbookTraceabilityHelper
INITIAL_START_DATE
Constructor and Description |
---|
LogbookLifeCycleTraceabilityHelper(HandlerIO handlerIO,
LogbookOperationsClient logbookOperationsClient,
ItemStatus itemStatus,
String operationID,
WorkspaceClientFactory workspaceClientFactory) |
Modifier and Type | Method and Description |
---|---|
void |
createLogbookOperationEvent(Integer tenantId,
String eventType,
StatusCode status,
TraceabilityEvent event)
Update or finalize the traceability entry in the logbook collection
|
void |
createLogbookOperationStructure()
initialize the traceability entry in the logbook collection
|
protected void |
extractAppendToFinalFile(List<URI> listOfFiles,
TraceabilityFile traceabilityFile,
MerkleTreeAlgo algo,
String rootFolder)
Reduce part of the process : lets merge in one only file the disting lifecycles ones
|
protected abstract Select |
generateSelectLogbookOperation(LocalDateTime date) |
long |
getDataSize()
Warning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIterator
|
boolean |
getMaxEntriesReached() |
String |
getPreviousMonthStartDate()
Get the first traceability (in logbook) one month before the given currentDate and return the startDate of the entry
|
byte[] |
getPreviousMonthTimestampToken()
Get the first traceability (in logbook) one month before the given currentDate and return the timestampToken of the entry
|
String |
getPreviousStartDate()
Get the last traceability (in logbook) event and return the startDate of the entry
|
byte[] |
getPreviousTimestampToken()
Get the last traceability (in logbook) event and return the timestampToken of the entry
|
String |
getPreviousYearStartDate()
Get the first traceability (in logbook) one year before the given currentDate and return the startDate of the entry
|
byte[] |
getPreviousYearTimestampToken()
Get the first traceability (in logbook) one year before the given currentDate and return the timestampToken of the entry
|
String |
getStepName() |
String |
getTimestampStepName() |
String |
getTraceabilityEndDate() |
String |
getTraceabilityStartDate() |
String |
getUriName() |
void |
initialize()
Initialize traceability.
|
void |
saveEmpty(Integer tenantId)
Save the close master event if needed
|
void |
saveEvent(TraceabilityEvent event)
Save the finalized event if needed
|
void |
storeAndDeleteZip(Integer tenant,
File zipFile,
String fileName,
String uri,
TraceabilityEvent event)
Store the temporary zip in the final destination (on a specific offer for example) and delete tmp file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getTraceabilityType, getZipName, saveDataInZip
public LogbookLifeCycleTraceabilityHelper(HandlerIO handlerIO, LogbookOperationsClient logbookOperationsClient, ItemStatus itemStatus, String operationID, WorkspaceClientFactory workspaceClientFactory)
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 processworkspaceClientFactory
- public void initialize() throws TraceabilityException
LogbookTraceabilityHelper
initialize
in interface LogbookTraceabilityHelper
TraceabilityException
- for any errorpublic void createLogbookOperationStructure() throws TraceabilityException
LogbookTraceabilityHelper
createLogbookOperationStructure
in interface LogbookTraceabilityHelper
TraceabilityException
- if any error occurspublic void createLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status, TraceabilityEvent event) throws TraceabilityException
LogbookTraceabilityHelper
createLogbookOperationEvent
in interface LogbookTraceabilityHelper
tenantId
- tenant used for the operationeventType
- code of the eventType for the entrystatus
- status of the entryevent
- data of the entryTraceabilityException
- if any error occurspublic void saveEvent(TraceabilityEvent event)
LogbookTraceabilityHelper
saveEvent
in interface LogbookTraceabilityHelper
event
- The TraceabilityEvent of the operationpublic void saveEmpty(Integer tenantId)
LogbookTraceabilityHelper
saveEmpty
in interface LogbookTraceabilityHelper
tenantId
- the tenant used for logpublic boolean getMaxEntriesReached()
getMaxEntriesReached
in interface LogbookTraceabilityHelper
public void storeAndDeleteZip(Integer tenant, File zipFile, String fileName, String uri, TraceabilityEvent event) throws TraceabilityException
LogbookTraceabilityHelper
storeAndDeleteZip
in interface LogbookTraceabilityHelper
tenant
- tenant used for the operationzipFile
- file containing multiple information about the traceability operation (data, merkle, computingData, ...)fileName
- name of the file on the destinationuri
- uri of the tmp fileevent
- traceability event that should be updated by this operationTraceabilityException
- if any error occurspublic String getStepName()
getStepName
in interface LogbookTraceabilityHelper
public String getTimestampStepName()
getTimestampStepName
in interface LogbookTraceabilityHelper
public String getUriName()
getUriName
in interface LogbookTraceabilityHelper
public String getTraceabilityStartDate()
getTraceabilityStartDate
in interface LogbookTraceabilityHelper
public String getTraceabilityEndDate()
getTraceabilityEndDate
in interface LogbookTraceabilityHelper
public long getDataSize()
LogbookTraceabilityHelper
getDataSize
in interface LogbookTraceabilityHelper
public byte[] getPreviousTimestampToken() throws InvalidParseOperationException
LogbookTraceabilityHelper
getPreviousTimestampToken
in interface LogbookTraceabilityHelper
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.public byte[] getPreviousMonthTimestampToken() throws InvalidParseOperationException, TraceabilityException
LogbookTraceabilityHelper
getPreviousMonthTimestampToken
in interface LogbookTraceabilityHelper
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.TraceabilityException
- if any other error occurspublic byte[] getPreviousYearTimestampToken() throws InvalidParseOperationException, TraceabilityException
LogbookTraceabilityHelper
getPreviousYearTimestampToken
in interface LogbookTraceabilityHelper
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.TraceabilityException
- if any other error occurspublic String getPreviousStartDate() throws InvalidParseOperationException
LogbookTraceabilityHelper
getPreviousStartDate
in interface LogbookTraceabilityHelper
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.public String getPreviousMonthStartDate() throws InvalidParseOperationException, TraceabilityException
LogbookTraceabilityHelper
getPreviousMonthStartDate
in interface LogbookTraceabilityHelper
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.TraceabilityException
- if any other error occurspublic String getPreviousYearStartDate() throws InvalidParseOperationException, TraceabilityException
LogbookTraceabilityHelper
getPreviousYearStartDate
in interface LogbookTraceabilityHelper
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.TraceabilityException
- if any other error occursprotected void extractAppendToFinalFile(List<URI> listOfFiles, TraceabilityFile traceabilityFile, MerkleTreeAlgo algo, String rootFolder) throws TraceabilityException
listOfFiles
- traceabilityFile
- algo
- rootFolder
- TraceabilityException
protected abstract Select generateSelectLogbookOperation(LocalDateTime date) throws InvalidCreateOperationException
InvalidCreateOperationException
Copyright © 2018 Vitam. All rights reserved.