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
Fields -
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 versionvoidsaveDataInZip(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
-
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 with a specific version- 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
String getTraceabilityStartDate()- Returns:
- the start date of the traceability (computed from the end date of the last traceability)
-
getTraceabilityEndDate
String getTraceabilityEndDate()- Returns:
- the end date of the traceability (now)
-
getDataSize
long getDataSize()Warning: This method MUST be used after "saveDataInZip" witch initialize traceabilityIterator- Returns:
- the number of items secured in traceabilityIterator
-
getPreviousOperationId
String getPreviousOperationId()Get the last traceability operation Id- Returns:
- the operation id of the last traceability entry or null if no previous traceability found
-
getPreviousTimestampToken
byte[] 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
-
getPreviousMonthTimestampToken
byte[] getPreviousMonthTimestampToken()Get the first traceability (in logbook) one month before the given currentDate and return the timestampToken of the entry for a specific securisation version- Returns:
- the timestamp token of the matching entry or null if no matching entry
-
getPreviousYearTimestampToken
byte[] getPreviousYearTimestampToken()Get the first traceability (in logbook) one year before the given currentDate and return the timestampToken of the entry for a specific securisation version- Returns:
- the timestamp token of the matching entry or null if no matching entry
-
getPreviousStartDate
String getPreviousStartDate()Get the last traceability (in logbook) event and return the startDate of the entry- Returns:
- the start date of the last traceability entry
-
getPreviousMonthOperationId
String getPreviousMonthOperationId()Get the first traceability operation id (in logbook) one month before the given currentDate- Returns:
- the operation id, or null
-
getPreviousMonthStartDate
String 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
-
getPreviousYearOperationId
String getPreviousYearOperationId()Get the first traceability operation id (in logbook) one year before the given currentDate- Returns:
- the operation id
-
getPreviousYearStartDate
String 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
-
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() -
getSecurisationVersion
String getSecurisationVersion()
-