@Test public void selectOperationsByLastPersistenceDateIntervalTest() throws Exception { reset(mongoDbAccess); doReturn(createFakeMongoCursor()).when(mongoDbAccess).getLogbookOperations(any(), anyBoolean()); MongoCursor cursor = logbookOperationsImpl.selectOperationsByLastPersistenceDateInterval(LocalDateUtil.now(), LocalDateUtil.now()); assertNotNull(cursor); assertTrue(cursor.hasNext()); }
@Override public MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate) throws LogbookDatabaseException, LogbookNotFoundException, InvalidCreateOperationException, InvalidParseOperationException { Select select = new Select(); select.setQuery(QueryHelper.and() .add(QueryHelper .gte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(startDate))) .add(QueryHelper .lte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(endDate)))); select.addOrderByAscFilter(VitamFieldsHelper.lastPersistedDate()); MongoCursor<LogbookOperation> cursor = null; try { cursor = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false); } catch (VitamDBException e) { LOGGER.error(e); } return cursor; }
LogbookOperationsImpl implements LogbookOperations { @Override public MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate) throws LogbookDatabaseException, LogbookNotFoundException, InvalidCreateOperationException, InvalidParseOperationException { Select select = new Select(); select.setQuery(QueryHelper.and() .add(QueryHelper .gte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(startDate))) .add(QueryHelper .lte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(endDate)))); select.addOrderByAscFilter(VitamFieldsHelper.lastPersistedDate()); MongoCursor<LogbookOperation> cursor = null; try { cursor = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false); } catch (VitamDBException e) { LOGGER.error(e); } return cursor; } }
LogbookOperationsImpl implements LogbookOperations { @Override public MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate) throws LogbookDatabaseException, LogbookNotFoundException, InvalidCreateOperationException, InvalidParseOperationException { Select select = new Select(); select.setQuery(QueryHelper.and() .add(QueryHelper .gte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(startDate))) .add(QueryHelper .lte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(endDate)))); select.addOrderByAscFilter(VitamFieldsHelper.lastPersistedDate()); MongoCursor<LogbookOperation> cursor = null; try { cursor = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false); } catch (VitamDBException e) { LOGGER.error(e); } return cursor; } LogbookOperationsImpl(LogbookDbAccess mongoDbAccess); @VisibleForTesting  LogbookOperationsImpl(LogbookDbAccess mongoDbAccess, WorkspaceClientFactory workspaceClientFactory,
        StorageClientFactory storageClientFactory, IndexationHelper indexationHelper); }
LogbookOperationsImpl implements LogbookOperations { @Override public MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate) throws LogbookDatabaseException, LogbookNotFoundException, InvalidCreateOperationException, InvalidParseOperationException { Select select = new Select(); select.setQuery(QueryHelper.and() .add(QueryHelper .gte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(startDate))) .add(QueryHelper .lte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(endDate)))); select.addOrderByAscFilter(VitamFieldsHelper.lastPersistedDate()); MongoCursor<LogbookOperation> cursor = null; try { cursor = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false); } catch (VitamDBException e) { LOGGER.error(e); } return cursor; } 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 MongoCursor<LogbookOperation> selectOperationsByLastPersistenceDateInterval(LocalDateTime startDate, LocalDateTime endDate) throws LogbookDatabaseException, LogbookNotFoundException, InvalidCreateOperationException, InvalidParseOperationException { Select select = new Select(); select.setQuery(QueryHelper.and() .add(QueryHelper .gte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(startDate))) .add(QueryHelper .lte(VitamFieldsHelper.lastPersistedDate(), LocalDateUtil.getFormattedDateForMongo(endDate)))); select.addOrderByAscFilter(VitamFieldsHelper.lastPersistedDate()); MongoCursor<LogbookOperation> cursor = null; try { cursor = mongoDbAccess.getLogbookOperations(select.getFinalSelect(), false); } catch (VitamDBException e) { LOGGER.error(e); } return cursor; } 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);  }