Package fr.gouv.vitam.logbook.operations.api

# Interface LogbookOperations

All Known Implementing Classes:
  `AlertLogbookOperationsDecorator`, `LogbookOperationsDecorator`, `LogbookOperationsImpl`

public interface LogbookOperations
Logbook operations interface for database operations

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `checkNewEligibleLogbookOperationsSinceLastTraceabilityOperation(LocalDateTime traceabilityStartDate, LocalDateTime traceabilityEndDate)`
  `void`
  `create(String operationId, LogbookOperationParameters... parameters)`
  Create and insert logbook operation entries
  `LogbookOperation`
  `findFirstTraceabilityOperationOKAfterDate(LocalDateTime date)`
  Find One logbook TraceabilityOperation after a given date
  `LogbookOperation`
  `findLastLifecycleTraceabilityOperation(String eventType, boolean traceabilityWithZipOnly)`
  Find last OK or WARNING LFC traceability operation (even if no traceability zip has been generated)
  `Optional<LogbookOperation>`
  `findLastOperationByType(String operationType)`
  FInd last event of last operation by type
  `LogbookOperation`
  `findLastTraceabilityOperationOK()`
  Find last successful traceability operation
  `LogbookOperation`
  `getById(String idProcess)`
  `LogbookOperation`
  `getById(String idProcess, com.fasterxml.jackson.databind.JsonNode query, boolean sliced, boolean crossTenant)`
  Select logbook operation by the operation's ID
  `ReindexationResult`
  `reindex(IndexParameters indexParameters)`
  Reindex one or more collections
  `List<LogbookOperation>`
  `selectOperations(com.fasterxml.jackson.databind.JsonNode select)`
  Select logbook operation entries
  `List<LogbookOperation>`
  `selectOperations(com.fasterxml.jackson.databind.JsonNode select, boolean sliced, boolean crossTenant)`
  `RequestResponseOK<LogbookOperation>`
  `selectOperationsAsRequestResponse(com.fasterxml.jackson.databind.JsonNode select, boolean sliced, boolean crossTenant)`
  `com.mongodb.client.MongoCursor<LogbookOperation>`
  `selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate)`
  Select all logbook operations entries persisted within provided interval
  `SwitchIndexResult`
  `switchIndex(String alias, String newIndexName)`
  Switch indexes for one or more collections
  `void`
  `update(String operationId, LogbookOperationParameters... parameters)`
  Update and insert logbook operation entries

- ## Method Details

  - ### create

    void create(String operationId, LogbookOperationParameters... parameters) throws LogbookAlreadyExistsException, LogbookDatabaseException
    Create and insert logbook operation entries
    Parameters:
      `parameters` - the entry parameters
    Throws:
      `LogbookAlreadyExistsException` - if an operation with the same eventIdentifierProcess and outcome="Started" already exists
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database

  - ### update

    void update(String operationId, LogbookOperationParameters... parameters) throws LogbookNotFoundException, LogbookDatabaseException
    Update and insert logbook operation entries
    Parameters:
      `parameters` - the entry parameters
    Throws:
      `LogbookNotFoundException` - if no operation with the same eventIdentifierProcess exists
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database

  - ### selectOperations

    List<LogbookOperation> selectOperations(com.fasterxml.jackson.databind.JsonNode select) throws LogbookDatabaseException, InvalidParseOperationException, VitamDBException
    Select logbook operation entries
    Parameters:
      `select` - the select request in format of JsonNode
    Returns:
      List of the logbook operation
    Throws:
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database
      `InvalidParseOperationException` - if invalid parse for selecting the operation
      `VitamDBException` - in case a desynchro is recorded between Mongo and ES

  - ### selectOperations

    List<LogbookOperation> selectOperations(com.fasterxml.jackson.databind.JsonNode select, boolean sliced, boolean crossTenant) throws VitamDBException, LogbookDatabaseException
    Throws:
      `VitamDBException`
      `LogbookDatabaseException`

  - ### selectOperationsAsRequestResponse

    RequestResponseOK<LogbookOperation> selectOperationsAsRequestResponse(com.fasterxml.jackson.databind.JsonNode select, boolean sliced, boolean crossTenant) throws VitamDBException, LogbookDatabaseException
    Throws:
      `VitamDBException`
      `LogbookDatabaseException`

  - ### getById

    LogbookOperation getById(String idProcess) throws LogbookDatabaseException, LogbookNotFoundException
    Throws:
      `LogbookDatabaseException`
      `LogbookNotFoundException`

  - ### getById

    LogbookOperation getById(String idProcess, com.fasterxml.jackson.databind.JsonNode query, boolean sliced, boolean crossTenant) throws LogbookDatabaseException, LogbookNotFoundException
    Select logbook operation by the operation's ID
    Parameters:
      `idProcess` - the operation identifier
      `query` -
      `sliced` -
      `crossTenant` -
    Returns:
      the logbook operation found by the ID
    Throws:
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database
      `LogbookNotFoundException` - if no operation selected cannot be found
      `VitamDBException` - in case a desynchro is recorded between Mongo and ES

  - ### selectOperationsByLastPersistenceDateInterval

    com.mongodb.client.MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate) throws LogbookDatabaseException, LogbookNotFoundException, InvalidParseOperationException, InvalidCreateOperationException
    Select all logbook operations entries persisted within provided interval
    Parameters:
      `startDate` - the start date
      `endDate` - the end date
    Returns:
      the Closeable MongoCursor of LogbookOperation
    Throws:
      `LogbookNotFoundException` - if no operation selected cannot be found
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database
      `InvalidParseOperationException` - if invalid parse for selecting the operation
      `InvalidCreateOperationException` - if the query could not be created

  - ### findFirstTraceabilityOperationOKAfterDate

    LogbookOperation findFirstTraceabilityOperationOKAfterDate(LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException
    Find One logbook TraceabilityOperation after a given date
    Parameters:
      `date` - the select request in format of JsonNode
    Returns:
      the LogbookOperation
    Throws:
      `LogbookNotFoundException` - if no operation selected cannot be found
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database
      `InvalidParseOperationException` - if invalid parse for selecting the operation
      `InvalidCreateOperationException` - if the query could not be created

  - ### findLastTraceabilityOperationOK

    LogbookOperation findLastTraceabilityOperationOK() throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException, InvalidParseOperationException
    Find last successful traceability operation
    Returns:
      the last valid traceability operation
    Throws:
      `InvalidCreateOperationException` - if the query could not be created
      `LogbookNotFoundException` - if no operation selected cannot be found
      `LogbookDatabaseException` - if errors occur while connecting or writing to the database
      `InvalidParseOperationException` - if the query could not be created

  - ### findLastLifecycleTraceabilityOperation

    LogbookOperation findLastLifecycleTraceabilityOperation(String eventType, boolean traceabilityWithZipOnly) throws VitamException
    Find last OK or WARNING LFC traceability operation (even if no traceability zip has been generated)
    Parameters:
      `eventType` - Logbook event type
      `traceabilityWithZipOnly` - if true, skip operation without Zip (empty operations)
    Returns:
      the last valid traceability operation
    Throws:
      `VitamException` - if errors occur while retrieving data

  - ### reindex

    ReindexationResult reindex(IndexParameters indexParameters)
    Reindex one or more collections
    Parameters:
      `indexParameters` - the parameters specifying what to reindex
    Returns:
      the reindexation result as a IndexationResult Object

  - ### switchIndex

    SwitchIndexResult switchIndex(String alias, String newIndexName) throws DatabaseException
    Switch indexes for one or more collections
    Parameters:
      `alias` - the alias name
      `newIndexName` - the new index to be pointed on
    Returns:
    Throws:
      `DatabaseException` - in case error with database occurs

  - ### checkNewEligibleLogbookOperationsSinceLastTraceabilityOperation

    boolean checkNewEligibleLogbookOperationsSinceLastTraceabilityOperation(LocalDateTime traceabilityStartDate, LocalDateTime traceabilityEndDate) throws LogbookDatabaseException
    Throws:
      `LogbookDatabaseException`

  - ### findLastOperationByType

    Optional<LogbookOperation> findLastOperationByType(String operationType) throws InvalidCreateOperationException, LogbookDatabaseException, InvalidParseOperationException
    FInd last event of last operation by type
    Parameters:
      `operationType` -
    Returns:
    Throws:
      `InvalidCreateOperationException`
      `LogbookNotFoundException`
      `LogbookDatabaseException`
      `InvalidParseOperationException`