Interface LogbookTraceabilityHelper
- All Known Implementing Classes:
LogbookLifeCycleTraceabilityHelper
,LogbookObjectGroupLifeCycleTraceabilityHelper
,LogbookOperationTraceabilityHelper
,LogbookStorageTraceabilityHelper
,LogbookUnitLifeCycleTraceabilityHelper
public interface LogbookTraceabilityHelper
Interface used to handle specific steps of the traceability process
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
createLogbookOperationEvent
(Integer tenantId, String eventType, StatusCode status, TraceabilityEvent event) Update or finalize the traceability entry in the logbook collectionlong
Warning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIteratorboolean
Get 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 entryvoid
saveDataInZip
(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.void
Save the close master event if neededvoid
Prepare and start the traceability operationvoid
storeAndDeleteZip
(Integer tenant, String strategyId, File zipFile, String fileName, TraceabilityEvent event) Store the temporary zip.
-
Field Details
-
INITIAL_START_DATE
-
-
Method Details
-
saveDataInZip
void saveDataInZip(MerkleTreeAlgo algo, TraceabilityFile file) throws IOException, TraceabilityException 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.- 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
-
startTraceability
Prepare and start the traceability operation- Throws:
TraceabilityException
- if any error occurs
-
createLogbookOperationEvent
void createLogbookOperationEvent(Integer tenantId, String eventType, StatusCode status, TraceabilityEvent event) throws TraceabilityException Update or finalize the traceability entry in the logbook collection- 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
-
storeAndDeleteZip
void storeAndDeleteZip(Integer tenant, String strategyId, File zipFile, String fileName, TraceabilityEvent event) throws TraceabilityException Store the temporary zip.- 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
-
getTraceabilityType
TraceabilityType getTraceabilityType()- Returns:
- the traceabilityType of the implementation class
-
getStepName
String getStepName()- Returns:
- the main eventType code for the specific implementation class
-
getTimestampStepName
String getTimestampStepName()- Returns:
- the timestamp eventType code for the specific implementation class
-
getZipName
String getZipName()- Returns:
- the name of the tmp zip file
-
getTraceabilityStartDate
- Returns:
- the start date of the traceability (computed from the end date of the last traceability)
- Throws:
TraceabilityException
- on error
-
getTraceabilityEndDate
- Returns:
- the end date of the traceability (now)
- Throws:
TraceabilityException
- on error
-
getDataSize
Warning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIterator- Returns:
- the number of items secured in traceabilityIterator
- Throws:
TraceabilityException
- if the traceabilityIterator isn't yet initialized
-
getPreviousTimestampToken
Get the last traceability (in logbook) event and return the timestampToken of the entry- 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
byte[] getPreviousMonthTimestampToken() throws InvalidParseOperationException, TraceabilityExceptionGet the first traceability (in logbook) one month before the given currentDate and return the timestampToken of the entry- 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
Get the first traceability (in logbook) one year before the given currentDate and return the timestampToken of the entry- 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
Get the last traceability (in logbook) event and return the startDate of the entry- Returns:
- the start date of the last traceability entry
- Throws:
InvalidParseOperationException
- if any errors occurs while deserializing entry's data.
-
getPreviousMonthStartDate
Get the first traceability (in logbook) one month before the given currentDate and return the startDate of the entry- 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
Get the first traceability (in logbook) one year before the given currentDate and return the startDate of the entry- 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
-
saveEmpty
Save the close master event if needed- Parameters:
tenantId
- the tenant used for log- Throws:
TraceabilityException
-
getMaxEntriesReached
boolean getMaxEntriesReached()- Returns:
- true if max entries reached (unit & object group lifecycle traceability operation are limited in size)
-
getTraceabilityStatistics
TraceabilityStatistics getTraceabilityStatistics()
-