Class LogbookOperationsImpl
- java.lang.Object
-
- fr.gouv.vitam.logbook.operations.core.LogbookOperationsImpl
-
- All Implemented Interfaces:
LogbookOperations
public class LogbookOperationsImpl extends java.lang.Object implements LogbookOperations
Logbook Operations implementation base class
-
-
Constructor Summary
Constructors Constructor Description LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, ElasticsearchLogbookIndexManager indexManager)LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory, IndexationHelper indexationHelper, ElasticsearchLogbookIndexManager indexManager)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheckNewEligibleLogbookOperationsSinceLastTraceabilityOperation(java.time.LocalDateTime traceabilityStartDate, java.time.LocalDateTime traceabilityEndDate)voidcreate(java.lang.String operationId, LogbookOperationParameters... parameters)Create and insert logbook operation entriesLogbookOperationfindFirstTraceabilityOperationOKAfterDate(java.time.LocalDateTime date)Find One logbook TraceabilityOperation after a given dateLogbookOperationfindLastLifecycleTraceabilityOperation(java.lang.String eventType, boolean traceabilityWithZipOnly)Find last OK or WARNING LFC traceability operation (even if no traceability zip has been generated)java.util.Optional<LogbookOperation>findLastOperationByType(java.lang.String operationType)FInd last event of last operation by typeLogbookOperationfindLastTraceabilityOperationOK()Find last successful traceability operationLogbookOperationgetById(java.lang.String idProcess)LogbookOperationgetById(java.lang.String idProcess, com.fasterxml.jackson.databind.JsonNode query, boolean sliced, boolean crossTenant)Select logbook operation by the operation's IDReindexationResultreindex(IndexParameters indexParameters)Reindex one or more collectionsjava.util.List<LogbookOperation>selectOperations(com.fasterxml.jackson.databind.JsonNode select)Select logbook operation entriesjava.util.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(java.time.LocalDateTime startDate, java.time.LocalDateTime endDate)Select all logbook operations entries persisted within provided intervalSwitchIndexResultswitchIndex(java.lang.String alias, java.lang.String newIndexName)Switch indexes for one or more collectionsvoidupdate(java.lang.String operationId, LogbookOperationParameters... parameters)Update and insert logbook operation entries
-
-
-
Constructor Detail
-
LogbookOperationsImpl
public LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, ElasticsearchLogbookIndexManager indexManager)
-
LogbookOperationsImpl
public LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory, IndexationHelper indexationHelper, ElasticsearchLogbookIndexManager indexManager)
-
-
Method Detail
-
create
public void create(java.lang.String operationId, LogbookOperationParameters... parameters) throws LogbookAlreadyExistsException, LogbookDatabaseExceptionDescription copied from interface:LogbookOperationsCreate and insert logbook operation entries- Specified by:
createin interfaceLogbookOperationsparameters- the entry parameters- Throws:
LogbookAlreadyExistsException- if an operation with the same eventIdentifierProcess and outcome="Started" already existsLogbookDatabaseException- if errors occur while connecting or writing to the database
-
update
public void update(java.lang.String operationId, LogbookOperationParameters... parameters) throws LogbookNotFoundException, LogbookDatabaseExceptionDescription copied from interface:LogbookOperationsUpdate and insert logbook operation entries- Specified by:
updatein interfaceLogbookOperationsparameters- the entry parameters- Throws:
LogbookNotFoundException- if no operation with the same eventIdentifierProcess existsLogbookDatabaseException- if errors occur while connecting or writing to the database
-
selectOperations
public java.util.List<LogbookOperation> selectOperations(com.fasterxml.jackson.databind.JsonNode select) throws VitamDBException, LogbookDatabaseException
Description copied from interface:LogbookOperationsSelect logbook operation entries- Specified by:
selectOperationsin interfaceLogbookOperations- Parameters:
select- the select request in format of JsonNode- Returns:
- List of the logbook operation
- Throws:
VitamDBException- in case a desynchro is recorded between Mongo and ESLogbookDatabaseException- if errors occur while connecting or writing to the database
-
selectOperations
public java.util.List<LogbookOperation> selectOperations(com.fasterxml.jackson.databind.JsonNode select, boolean sliced, boolean crossTenant) throws VitamDBException, LogbookDatabaseException
- Specified by:
selectOperationsin interfaceLogbookOperations- Throws:
VitamDBExceptionLogbookDatabaseException
-
selectOperationsAsRequestResponse
public RequestResponseOK<LogbookOperation> selectOperationsAsRequestResponse(com.fasterxml.jackson.databind.JsonNode select, boolean sliced, boolean crossTenant) throws VitamDBException, LogbookDatabaseException
- Specified by:
selectOperationsAsRequestResponsein interfaceLogbookOperations- Throws:
VitamDBExceptionLogbookDatabaseException
-
getById
public LogbookOperation getById(java.lang.String idProcess) throws LogbookDatabaseException, LogbookNotFoundException
- Specified by:
getByIdin interfaceLogbookOperations- Throws:
LogbookDatabaseExceptionLogbookNotFoundException
-
getById
public LogbookOperation getById(java.lang.String idProcess, com.fasterxml.jackson.databind.JsonNode query, boolean sliced, boolean crossTenant) throws LogbookDatabaseException, LogbookNotFoundException
Description copied from interface:LogbookOperationsSelect logbook operation by the operation's ID- Specified by:
getByIdin interfaceLogbookOperations- Parameters:
idProcess- the operation identifier- Returns:
- the logbook operation found by the ID
- Throws:
LogbookDatabaseException- if errors occur while connecting or writing to the databaseLogbookNotFoundException- if no operation selected cannot be found
-
selectOperationsByLastPersistenceDateInterval
public com.mongodb.client.MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(java.time.LocalDateTime startDate, java.time.LocalDateTime endDate) throws LogbookDatabaseException, InvalidCreateOperationException, InvalidParseOperationException
Description copied from interface:LogbookOperationsSelect all logbook operations entries persisted within provided interval- Specified by:
selectOperationsByLastPersistenceDateIntervalin interfaceLogbookOperations- Parameters:
startDate- the start dateendDate- the end date- Returns:
- the Closeable MongoCursor of LogbookOperation
- Throws:
LogbookDatabaseException- if errors occur while connecting or writing to the databaseInvalidCreateOperationException- if the query could not be createdInvalidParseOperationException- if invalid parse for selecting the operation
-
findFirstTraceabilityOperationOKAfterDate
public LogbookOperation findFirstTraceabilityOperationOKAfterDate(java.time.LocalDateTime date) throws InvalidCreateOperationException, LogbookDatabaseException
Description copied from interface:LogbookOperationsFind One logbook TraceabilityOperation after a given date- Specified by:
findFirstTraceabilityOperationOKAfterDatein interfaceLogbookOperations- Parameters:
date- the select request in format of JsonNode- Returns:
- the LogbookOperation
- Throws:
InvalidCreateOperationException- if the query could not be createdLogbookDatabaseException- if errors occur while connecting or writing to the database
-
findLastTraceabilityOperationOK
public LogbookOperation findLastTraceabilityOperationOK() throws InvalidCreateOperationException, LogbookDatabaseException, InvalidParseOperationException
Description copied from interface:LogbookOperationsFind last successful traceability operation- Specified by:
findLastTraceabilityOperationOKin interfaceLogbookOperations- Returns:
- the last valid traceability operation
- Throws:
InvalidCreateOperationException- if the query could not be createdLogbookDatabaseException- if errors occur while connecting or writing to the databaseInvalidParseOperationException- if the query could not be created
-
findLastLifecycleTraceabilityOperation
public LogbookOperation findLastLifecycleTraceabilityOperation(java.lang.String eventType, boolean traceabilityWithZipOnly) throws VitamException
Description copied from interface:LogbookOperationsFind last OK or WARNING LFC traceability operation (even if no traceability zip has been generated)- Specified by:
findLastLifecycleTraceabilityOperationin interfaceLogbookOperations- Parameters:
eventType- Logbook event typetraceabilityWithZipOnly- if true, skip operation without Zip (empty operations)- Returns:
- the last valid traceability operation
- Throws:
VitamException- if errors occur while retrieving data
-
findLastOperationByType
public java.util.Optional<LogbookOperation> findLastOperationByType(java.lang.String operationType) throws InvalidCreateOperationException, LogbookDatabaseException, InvalidParseOperationException
Description copied from interface:LogbookOperationsFInd last event of last operation by type- Specified by:
findLastOperationByTypein interfaceLogbookOperations- Returns:
- Throws:
InvalidCreateOperationExceptionLogbookDatabaseExceptionInvalidParseOperationException
-
reindex
public ReindexationResult reindex(IndexParameters indexParameters)
Description copied from interface:LogbookOperationsReindex one or more collections- Specified by:
reindexin interfaceLogbookOperations- Parameters:
indexParameters- the parameters specifying what to reindex- Returns:
- the reindexation result as a IndexationResult Object
-
switchIndex
public SwitchIndexResult switchIndex(java.lang.String alias, java.lang.String newIndexName) throws DatabaseException
Description copied from interface:LogbookOperationsSwitch indexes for one or more collections- Specified by:
switchIndexin interfaceLogbookOperations- Parameters:
alias- the alias namenewIndexName- the new index to be pointed on- Returns:
- Throws:
DatabaseException- in case error with database occurs
-
checkNewEligibleLogbookOperationsSinceLastTraceabilityOperation
public boolean checkNewEligibleLogbookOperationsSinceLastTraceabilityOperation(java.time.LocalDateTime traceabilityStartDate, java.time.LocalDateTime traceabilityEndDate) throws LogbookDatabaseException- Specified by:
checkNewEligibleLogbookOperationsSinceLastTraceabilityOperationin interfaceLogbookOperations- Throws:
LogbookDatabaseException
-
-