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)ConstructorLogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory, IndexationHelper indexationHelper)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcreate(LogbookOperationParameters parameters)Create and insert logbook operation entriesvoidcreateBulkLogbookOperation(LogbookOperationParameters[] operationArray)Create one Logbook Operation with already multiple sub-eventsLogbookOperationfindFirstTraceabilityOperationOKAfterDate(java.time.LocalDateTime date)Find One logbook TraceabilityOperation after a given dateLogbookOperationfindLastTraceabilityOperationOK()Find last successful traceability operationLogbookOperationgetById(java.lang.String idProcess)Select logbook operation by the operation's IDIndexationResultreindex(IndexParameters indexParameters)Reindex one or more collectionsjava.util.List<LogbookOperation>select(com.fasterxml.jackson.databind.JsonNode select)Select logbook operation entriesjava.util.List<LogbookOperation>select(com.fasterxml.jackson.databind.JsonNode select, boolean sliced)Select logbook operation entriesRequestResponse<LogbookOperation>selectOperations(com.fasterxml.jackson.databind.JsonNode select)com.mongodb.client.MongoCursor<LogbookOperation>selectOperationsByLastPersistenceDateInterval(java.time.LocalDateTime startDate, java.time.LocalDateTime endDate)Select all logbook operations entries persisted within provided intervalvoidswitchIndex(java.lang.String alias, java.lang.String newIndexName)Switch indexes for one or more collectionsvoidupdate(LogbookOperationParameters parameters)Update and insert logbook operation entriesvoidupdateBulkLogbookOperation(LogbookOperationParameters[] operationArray)Update one Logbook Operation with multiple sub-events
It adds this new entry within the very same Logbook Operaton entry in "events" array.
-
-
-
Constructor Detail
-
LogbookOperationsImpl
public LogbookOperationsImpl(LogbookDbAccess mongoDbAccess)
Constructor- Parameters:
mongoDbAccess- of logbook
-
LogbookOperationsImpl
public LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory, StorageClientFactory storageClientFactory, IndexationHelper indexationHelper)
-
-
Method Detail
-
create
public void create(LogbookOperationParameters parameters) throws LogbookAlreadyExistsException, LogbookDatabaseException
Description copied from interface:LogbookOperationsCreate and insert logbook operation entries- Specified by:
createin interfaceLogbookOperations- Parameters:
parameters- 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(LogbookOperationParameters parameters) throws LogbookNotFoundException, LogbookDatabaseException
Description copied from interface:LogbookOperationsUpdate and insert logbook operation entries- Specified by:
updatein interfaceLogbookOperations- Parameters:
parameters- the entry parameters- Throws:
LogbookNotFoundException- if no operation with the same eventIdentifierProcess existsLogbookDatabaseException- if errors occur while connecting or writing to the database
-
select
public java.util.List<LogbookOperation> select(com.fasterxml.jackson.databind.JsonNode select) throws LogbookDatabaseException, LogbookNotFoundException, InvalidParseOperationException, VitamDBException
Description copied from interface:LogbookOperationsSelect logbook operation entries- Specified by:
selectin interfaceLogbookOperations- 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 databaseLogbookNotFoundException- if no operation selected cannot be foundInvalidParseOperationException- if invalid parse for selecting the operationVitamDBException- in case a desynchro is recorded between Mongo and ES
-
selectOperations
public RequestResponse<LogbookOperation> selectOperations(com.fasterxml.jackson.databind.JsonNode select) throws LogbookDatabaseException, LogbookNotFoundException, VitamDBException
- Specified by:
selectOperationsin interfaceLogbookOperations- Throws:
LogbookDatabaseExceptionLogbookNotFoundExceptionVitamDBException
-
select
public java.util.List<LogbookOperation> select(com.fasterxml.jackson.databind.JsonNode select, boolean sliced) throws LogbookNotFoundException, LogbookDatabaseException, VitamDBException
Description copied from interface:LogbookOperationsSelect logbook operation entries- Specified by:
selectin interfaceLogbookOperations- Parameters:
select- the select request in format of JsonNodesliced- the boolean sliced to filter events or not- Returns:
- List of the logbook operation
- Throws:
LogbookNotFoundException- if no operation selected cannot be foundLogbookDatabaseException- if errors occur while connecting or writing to the databaseVitamDBException- in case a desynchro is recorded between Mongo and ES
-
getById
public LogbookOperation getById(java.lang.String idProcess) 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
-
createBulkLogbookOperation
public final void createBulkLogbookOperation(LogbookOperationParameters[] operationArray) throws LogbookDatabaseException, LogbookAlreadyExistsException
Description copied from interface:LogbookOperationsCreate one Logbook Operation with already multiple sub-events- Specified by:
createBulkLogbookOperationin interfaceLogbookOperations- Parameters:
operationArray- with first and next events to add/update- Throws:
LogbookDatabaseException- if errors occur while connecting or writing to the databaseLogbookAlreadyExistsException- if logbook already exists
-
updateBulkLogbookOperation
public final void updateBulkLogbookOperation(LogbookOperationParameters[] operationArray) throws LogbookDatabaseException, LogbookNotFoundException
Description copied from interface:LogbookOperationsUpdate one Logbook Operation with multiple sub-events
It adds this new entry within the very same Logbook Operaton entry in "events" array.- Specified by:
updateBulkLogbookOperationin interfaceLogbookOperations- Parameters:
operationArray- containing all operations Logbook in order- 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, LogbookNotFoundException, 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 databaseLogbookNotFoundException- if no operation selected cannot be foundInvalidCreateOperationException- if the query could not be createdInvalidParseOperationException- if invalid parse for selecting the operation
-
findFirstTraceabilityOperationOKAfterDate
public LogbookOperation findFirstTraceabilityOperationOKAfterDate(java.time.LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, 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 createdLogbookNotFoundException- if no operation selected cannot be foundLogbookDatabaseException- if errors occur while connecting or writing to the database
-
findLastTraceabilityOperationOK
public LogbookOperation findLastTraceabilityOperationOK() throws InvalidCreateOperationException, LogbookNotFoundException, 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 createdLogbookNotFoundException- if no operation selected cannot be foundLogbookDatabaseException- if errors occur while connecting or writing to the databaseInvalidParseOperationException- if the query could not be created
-
reindex
public IndexationResult 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 void switchIndex(java.lang.String alias, java.lang.String newIndexName) throws DatabaseExceptionDescription 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- Throws:
DatabaseException- in case error with database occurs
-
-