Interface LogbookTraceabilityHelper

    • Field Detail

      • INITIAL_START_DATE

        static final java.time.LocalDateTime INITIAL_START_DATE
    • Method Detail

      • saveDataInZip

        void saveDataInZip​(MerkleTreeAlgo algo,
                           TraceabilityFile file)
                    throws java.io.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:
        java.io.IOException - if any error occurs while writing in traceabilityFile
        TraceabilityException - for any other errors specifically in the search / data transformation
      • createLogbookOperationEvent

        void createLogbookOperationEvent​(java.lang.Integer tenantId,
                                         java.lang.String eventType,
                                         StatusCode status,
                                         TraceabilityEvent event)
                                  throws TraceabilityException
        Update or finalize the traceability entry in the logbook collection
        Parameters:
        tenantId - tenant used for the operation
        eventType - code of the eventType for the entry
        status - status of the entry
        event - data of the entry
        Throws:
        TraceabilityException - if any error occurs
      • storeAndDeleteZip

        void storeAndDeleteZip​(java.lang.Integer tenant,
                               java.lang.String strategyId,
                               java.io.File zipFile,
                               java.lang.String fileName,
                               TraceabilityEvent event)
                        throws TraceabilityException
        Store the temporary zip.
        Parameters:
        tenant - tenant used for the operation
        strategyId - strategy used for the storage
        zipFile - file containing multiple information about the traceability operation (data, merkle, computingData, ...)
        fileName - name of the file on the destination
        event - 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

        java.lang.String getStepName()
        Returns:
        the main eventType code for the specific implementation class
      • getTimestampStepName

        java.lang.String getTimestampStepName()
        Returns:
        the timestamp eventType code for the specific implementation class
      • getZipName

        java.lang.String getZipName()
        Returns:
        the name of the tmp zip file
      • getTraceabilityStartDate

        java.lang.String getTraceabilityStartDate()
                                           throws TraceabilityException
        Returns:
        the start date of the traceability (computed from the end date of the last traceability)
        Throws:
        TraceabilityException - on error
      • getDataSize

        long getDataSize()
                  throws TraceabilityException
        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

        byte[] getPreviousTimestampToken()
                                  throws InvalidParseOperationException
        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.
      • getPreviousStartDate

        java.lang.String getPreviousStartDate()
                                       throws InvalidParseOperationException
        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.
      • getMaxEntriesReached

        boolean getMaxEntriesReached()
        Returns:
        true if max entries reached (unit & object group lifecycle traceability operation are limited in size)