@Test public void findFirstTraceabilityOperationOKAfterDateTest() throws Exception { reset(mongoDbAccess); doReturn(createFakeMongoCursor()).when(mongoDbAccess).getLogbookOperations(any(), anyBoolean()); LogbookOperation lo = logbookOperationsImpl.findFirstTraceabilityOperationOKAfterDate(LocalDateUtil.now()); assertNotNull(lo); }
@Override public LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException { final Select select = new Select(); final Query query = QueryHelper.gt("evDateTime", date.toString()); final Query type = QueryHelper.eq("evTypeProc", LogbookTypeProcess.TRACEABILITY.name()); final Query status = QueryHelper.eq(LogbookDocument.EVENTS + "." + outcomeDetail.getDbname(), "STP_OP_SECURISATION.OK"); select.setQuery(QueryHelper.and().add(query, type, status)); select.setLimitFilter(0, 1); LogbookOperation logbookOperation = null; try { logbookOperation = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false).next(); } catch (VitamDBException e) { LOGGER.error(e); } return logbookOperation; }
LogbookOperationsImpl implements LogbookOperations { @Override public LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException { final Select select = new Select(); final Query query = QueryHelper.gt("evDateTime", date.toString()); final Query type = QueryHelper.eq("evTypeProc", LogbookTypeProcess.TRACEABILITY.name()); final Query status = QueryHelper.eq(LogbookDocument.EVENTS + "." + outcomeDetail.getDbname(), "STP_OP_SECURISATION.OK"); select.setQuery(QueryHelper.and().add(query, type, status)); select.setLimitFilter(0, 1); LogbookOperation logbookOperation = null; try { logbookOperation = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false).next(); } catch (VitamDBException e) { LOGGER.error(e); } return logbookOperation; } }
LogbookOperationsImpl implements LogbookOperations { @Override public LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException { final Select select = new Select(); final Query query = QueryHelper.gt("evDateTime", date.toString()); final Query type = QueryHelper.eq("evTypeProc", LogbookTypeProcess.TRACEABILITY.name()); final Query status = QueryHelper.eq(LogbookDocument.EVENTS + "." + outcomeDetail.getDbname(), "STP_OP_SECURISATION.OK"); select.setQuery(QueryHelper.and().add(query, type, status)); select.setLimitFilter(0, 1); LogbookOperation logbookOperation = null; try { logbookOperation = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false).next(); } catch (VitamDBException e) { LOGGER.error(e); } return logbookOperation; } LogbookOperationsImpl(LogbookDbAccess mongoDbAccess); @VisibleForTesting  LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory, IndexationHelper indexationHelper); }
LogbookOperationsImpl implements LogbookOperations { @Override public LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException { final Select select = new Select(); final Query query = QueryHelper.gt("evDateTime", date.toString()); final Query type = QueryHelper.eq("evTypeProc", LogbookTypeProcess.TRACEABILITY.name()); final Query status = QueryHelper.eq(LogbookDocument.EVENTS + "." + outcomeDetail.getDbname(), "STP_OP_SECURISATION.OK"); select.setQuery(QueryHelper.and().add(query, type, status)); select.setLimitFilter(0, 1); LogbookOperation logbookOperation = null; try { logbookOperation = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false).next(); } catch (VitamDBException e) { LOGGER.error(e); } return logbookOperation; } LogbookOperationsImpl(LogbookDbAccess mongoDbAccess); @VisibleForTesting  LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory, IndexationHelper indexationHelper); @Override void create(LogbookOperationParameters parameters); @Override void update(LogbookOperationParameters parameters); @Override List<LogbookOperation> select(JsonNode select); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select, boolean sliced); @Override List<LogbookOperation> select(JsonNode select, boolean sliced); @Override LogbookOperation getById(String idProcess); @Override final void createBulkLogbookOperation(final LogbookOperationParameters[] operationArray); @Override final void updateBulkLogbookOperation(final LogbookOperationParameters[] operationArray); @Override MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate,
        LocalDateTime endDate); @Override LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date); @Override LogbookOperation findLastTraceabilityOperationOK(); @Override IndexationResult reindex(IndexParameters indexParameters); @Override void switchIndex(String alias, String newIndexName); }
LogbookOperationsImpl implements LogbookOperations { @Override public LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date) throws InvalidCreateOperationException, LogbookNotFoundException, LogbookDatabaseException { final Select select = new Select(); final Query query = QueryHelper.gt("evDateTime", date.toString()); final Query type = QueryHelper.eq("evTypeProc", LogbookTypeProcess.TRACEABILITY.name()); final Query status = QueryHelper.eq(LogbookDocument.EVENTS + "." + outcomeDetail.getDbname(), "STP_OP_SECURISATION.OK"); select.setQuery(QueryHelper.and().add(query, type, status)); select.setLimitFilter(0, 1); LogbookOperation logbookOperation = null; try { logbookOperation = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false).next(); } catch (VitamDBException e) { LOGGER.error(e); } return logbookOperation; } LogbookOperationsImpl(LogbookDbAccess mongoDbAccess); @VisibleForTesting  LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory, IndexationHelper indexationHelper); @Override void create(LogbookOperationParameters parameters); @Override void update(LogbookOperationParameters parameters); @Override List<LogbookOperation> select(JsonNode select); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select); @Override RequestResponse<LogbookOperation> selectOperations(JsonNode select, boolean sliced); @Override List<LogbookOperation> select(JsonNode select, boolean sliced); @Override LogbookOperation getById(String idProcess); @Override final void createBulkLogbookOperation(final LogbookOperationParameters[] operationArray); @Override final void updateBulkLogbookOperation(final LogbookOperationParameters[] operationArray); @Override MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate,
        LocalDateTime endDate); @Override LogbookOperation findFirstTraceabilityOperationOKAfterDate(final LocalDateTime date); @Override LogbookOperation findLastTraceabilityOperationOK(); @Override IndexationResult reindex(IndexParameters indexParameters); @Override void switchIndex(String alias, String newIndexName);  }