@Test public void testFindByIdentifierFoundEmpty() throws DatabaseException { Optional<Document> response = repository.findByIdentifier("FakeIdentifier"); assertThat(response).isEmpty(); }
@Override public Optional<Document> findByIdentifier(String identifier) throws DatabaseException { ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED); String index = indexName; try { return handleSearch(index, termQuery(IDENTIFIER, identifier)); } catch (IOException e) { throw new DatabaseException("Search by identifier exception", e); } }
VitamElasticsearchRepository implements VitamRepository { @Override public Optional<Document> findByIdentifier(String identifier) throws DatabaseException { ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED); String index = indexName; try { return handleSearch(index, termQuery(IDENTIFIER, identifier)); } catch (IOException e) { throw new DatabaseException("Search by identifier exception", e); } } }
VitamElasticsearchRepository implements VitamRepository { @Override public Optional<Document> findByIdentifier(String identifier) throws DatabaseException { ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED); String index = indexName; try { return handleSearch(index, termQuery(IDENTIFIER, identifier)); } catch (IOException e) { throw new DatabaseException("Search by identifier exception", e); } } VitamElasticsearchRepository(RestHighLevelClient client, String indexName, boolean indexByTenant); }
VitamElasticsearchRepository implements VitamRepository { @Override public Optional<Document> findByIdentifier(String identifier) throws DatabaseException { ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED); String index = indexName; try { return handleSearch(index, termQuery(IDENTIFIER, identifier)); } catch (IOException e) { throw new DatabaseException("Search by identifier exception", e); } } VitamElasticsearchRepository(RestHighLevelClient client, String indexName, boolean indexByTenant); @Override void save(Document document); @Override VitamRepositoryStatus saveOrUpdate(Document document); @Override void save(List<Document> documents); void save(ElasticsearchCollections elasticsearchCollections, List<Document> documents); @Override void saveOrUpdate(List<Document> documents); @Override void update(List<WriteModel<Document>> updates); @Override FindIterable<Document> findDocuments(Collection<String> ids, Bson projection); @Override void remove(String id, Integer tenant); @Override long remove(Bson query); @Override void removeByNameAndTenant(String name, Integer tenant); @Override long purge(Integer tenant); static long handlePurge(RestHighLevelClient client, String index, QueryBuilder qb); @Override long purge(); @Override Optional<Document> getByID(String id, Integer tenant); @Override Optional<Document> findByIdentifierAndTenant(String identifier, Integer tenant); SearchResponse search(String index, QueryBuilder qb); @Override Optional<Document> findByIdentifier(String identifier); @Override FindIterable<Document> findByFieldsDocuments(Map<String, String> fields, int mongoBatchSize,
        Integer tenant); @Override FindIterable<Document> findDocuments(int mongoBatchSize, Integer tenant); @Override FindIterable<Document> findDocuments(int mongoBatchSize); @Override FindIterable<Document> findDocuments(Bson query, int mongoBatchSize); @Override void delete(List<String> ids, int tenant); }
VitamElasticsearchRepository implements VitamRepository { @Override public Optional<Document> findByIdentifier(String identifier) throws DatabaseException { ParametersChecker.checkParameter(ALL_PARAMS_REQUIRED); String index = indexName; try { return handleSearch(index, termQuery(IDENTIFIER, identifier)); } catch (IOException e) { throw new DatabaseException("Search by identifier exception", e); } } VitamElasticsearchRepository(RestHighLevelClient client, String indexName, boolean indexByTenant); @Override void save(Document document); @Override VitamRepositoryStatus saveOrUpdate(Document document); @Override void save(List<Document> documents); void save(ElasticsearchCollections elasticsearchCollections, List<Document> documents); @Override void saveOrUpdate(List<Document> documents); @Override void update(List<WriteModel<Document>> updates); @Override FindIterable<Document> findDocuments(Collection<String> ids, Bson projection); @Override void remove(String id, Integer tenant); @Override long remove(Bson query); @Override void removeByNameAndTenant(String name, Integer tenant); @Override long purge(Integer tenant); static long handlePurge(RestHighLevelClient client, String index, QueryBuilder qb); @Override long purge(); @Override Optional<Document> getByID(String id, Integer tenant); @Override Optional<Document> findByIdentifierAndTenant(String identifier, Integer tenant); SearchResponse search(String index, QueryBuilder qb); @Override Optional<Document> findByIdentifier(String identifier); @Override FindIterable<Document> findByFieldsDocuments(Map<String, String> fields, int mongoBatchSize,
        Integer tenant); @Override FindIterable<Document> findDocuments(int mongoBatchSize, Integer tenant); @Override FindIterable<Document> findDocuments(int mongoBatchSize); @Override FindIterable<Document> findDocuments(Bson query, int mongoBatchSize); @Override void delete(List<String> ids, int tenant); static final String IDENTIFIER; }