public class LogbookOperationsImpl extends Object implements LogbookOperations
Modifier and Type | Field and Description |
---|---|
static String |
STRATEGY_ID |
Constructor and Description |
---|
LogbookOperationsImpl(LogbookDbAccess mongoDbAccess)
Constructor
|
LogbookOperationsImpl(LogbookDbAccess mongoDbAccess,
WorkspaceClientFactory workspaceClientFactory) |
Modifier and Type | Method and Description |
---|---|
void |
create(LogbookOperationParameters parameters)
Create and insert logbook operation entries
|
void |
createBulkLogbookOperation(LogbookOperationParameters[] operationArray)
Create one Logbook Operation with already multiple sub-events
|
LogbookOperation |
findFirstTraceabilityOperationOKAfterDate(LocalDateTime date)
Find One logbook TraceabilityOperation after a given date
|
LogbookOperation |
findLastTraceabilityOperationOK()
Find last successful traceability operation
|
LogbookOperation |
getById(String idProcess)
Select logbook operation by the operation's ID
|
IndexationResult |
reindex(IndexParameters indexParameters)
Reindex one or more collections
|
List<LogbookOperation> |
select(com.fasterxml.jackson.databind.JsonNode select)
Select logbook operation entries
|
List<LogbookOperation> |
select(com.fasterxml.jackson.databind.JsonNode select,
boolean sliced)
Select logbook operation entries
|
com.mongodb.client.MongoCursor<LogbookOperation> |
selectOperationsPersistedAfterDate(LocalDateTime date)
Select all logbook operations entries after a given date
|
void |
switchIndex(String alias,
String newIndexName)
Switch indexes for one or more collections
|
void |
update(LogbookOperationParameters parameters)
Update and insert logbook operation entries
|
void |
updateBulkLogbookOperation(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. |
public static final String STRATEGY_ID
public LogbookOperationsImpl(LogbookDbAccess mongoDbAccess)
mongoDbAccess
- of logbookpublic LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory)
public void create(LogbookOperationParameters parameters) throws LogbookAlreadyExistsException, LogbookDatabaseException
LogbookOperations
create
in interface LogbookOperations
parameters
- the entry parametersLogbookAlreadyExistsException
- if an operation with the same
eventIdentifierProcess and outcome="Started" already existsLogbookDatabaseException
- if errors occur while connecting
or writing to the databasepublic void update(LogbookOperationParameters parameters) throws LogbookNotFoundException, LogbookDatabaseException
LogbookOperations
update
in interface LogbookOperations
parameters
- the entry parametersLogbookNotFoundException
- if no operation with the same
eventIdentifierProcess existsLogbookDatabaseException
- if errors occur while connecting
or writing to the databasepublic List<LogbookOperation> select(com.fasterxml.jackson.databind.JsonNode select) throws LogbookDatabaseException, LogbookNotFoundException, InvalidParseOperationException, VitamDBException
LogbookOperations
select
in interface LogbookOperations
select
- the select request in format of JsonNodeLogbookDatabaseException
- 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 ESpublic List<LogbookOperation> select(com.fasterxml.jackson.databind.JsonNode select, boolean sliced) throws LogbookNotFoundException, LogbookDatabaseException, VitamDBException
LogbookOperations
select
in interface LogbookOperations
select
- the select request in format of JsonNodesliced
- the boolean sliced to filter events or notLogbookNotFoundException
- 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 ESpublic LogbookOperation getById(String idProcess) throws LogbookDatabaseException, LogbookNotFoundException
LogbookOperations
getById
in interface LogbookOperations
idProcess
- the operation identifierLogbookDatabaseException
- if errors occur while connecting or writing to the databaseLogbookNotFoundException
- if no operation selected cannot be foundpublic final void createBulkLogbookOperation(LogbookOperationParameters[] operationArray) throws LogbookDatabaseException, LogbookAlreadyExistsException
LogbookOperations
createBulkLogbookOperation
in interface LogbookOperations
operationArray
- with first and next events to add/updateLogbookDatabaseException
- if errors occur while connecting or writing to the databaseLogbookAlreadyExistsException
- if logbook already existspublic final void updateBulkLogbookOperation(LogbookOperationParameters[] operationArray) throws LogbookDatabaseException, LogbookNotFoundException
LogbookOperations
updateBulkLogbookOperation
in interface LogbookOperations
operationArray
- containing all operations Logbook in orderLogbookDatabaseException
- if errors occur while connecting or writing to the databaseLogbookNotFoundException
- if no operation selected cannot be foundpublic com.mongodb.client.MongoCursor<LogbookOperation> selectOperationsPersistedAfterDate(LocalDateTime date) throws LogbookDatabaseException, LogbookNotFoundException, InvalidCreateOperationException, InvalidParseOperationException
LogbookOperations
selectOperationsPersistedAfterDate
in interface LogbookOperations
date
- the select request in format of JsonNodeLogbookDatabaseException
- 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 operationpublic LogbookOperation findFirstTraceabilityOperationOKAfterDate(LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException
LogbookOperations
findFirstTraceabilityOperationOKAfterDate
in interface LogbookOperations
date
- the select request in format of JsonNodeInvalidCreateOperationException
- if the query could not be createdLogbookNotFoundException
- if no operation selected cannot be foundLogbookDatabaseException
- if errors occur while connecting or writing to the databasepublic LogbookOperation findLastTraceabilityOperationOK() throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException, InvalidParseOperationException
LogbookOperations
findLastTraceabilityOperationOK
in interface LogbookOperations
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 createdpublic IndexationResult reindex(IndexParameters indexParameters)
LogbookOperations
reindex
in interface LogbookOperations
indexParameters
- the parameters specifying what to reindexpublic void switchIndex(String alias, String newIndexName) throws DatabaseException
LogbookOperations
switchIndex
in interface LogbookOperations
alias
- the alias namenewIndexName
- the new index to be pointed onDatabaseException
- in case error with database occursCopyright © 2018 Vitam. All rights reserved.