@Test public void buildQueryRemoveSelectedParametersIncludingDefault() { ResteasyUriInfo uriInfo = new ResteasyUriInfo(URI, QUERY_STRING, CONTEXT_PATH); String query = underTest.buildQuery(uriInfo, singletonList("wait")).toString(); assertQueryParameters(query, not(containsString("wait"))); }
public QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters) { BoolQueryBuilder query = QueryBuilders.boolQuery(); searchFilters.stream() .filter(searchFilter -> !isBlank(searchFilter.getValue())) .sorted(comparing(SearchFilter::getProperty).thenComparing(SearchFilter::getValue)) .forEach(searchFilter -> { SearchContribution searchContribution = searchContributions .getOrDefault(searchFilter.getProperty(), defaultSearchContribution); searchContribution.contribute(query, searchFilter.getProperty(), searchFilter.getValue()); }); log.debug("Query: {}", query); return query; }
SearchUtils extends ComponentSupport { public QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters) { BoolQueryBuilder query = QueryBuilders.boolQuery(); searchFilters.stream() .filter(searchFilter -> !isBlank(searchFilter.getValue())) .sorted(comparing(SearchFilter::getProperty).thenComparing(SearchFilter::getValue)) .forEach(searchFilter -> { SearchContribution searchContribution = searchContributions .getOrDefault(searchFilter.getProperty(), defaultSearchContribution); searchContribution.contribute(query, searchFilter.getProperty(), searchFilter.getValue()); }); log.debug("Query: {}", query); return query; } }
SearchUtils extends ComponentSupport { public QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters) { BoolQueryBuilder query = QueryBuilders.boolQuery(); searchFilters.stream() .filter(searchFilter -> !isBlank(searchFilter.getValue())) .sorted(comparing(SearchFilter::getProperty).thenComparing(SearchFilter::getValue)) .forEach(searchFilter -> { SearchContribution searchContribution = searchContributions .getOrDefault(searchFilter.getProperty(), defaultSearchContribution); searchContribution.contribute(query, searchFilter.getProperty(), searchFilter.getValue()); }); log.debug("Query: {}", query); return query; } @Inject  SearchUtils(final RepositoryManagerRESTAdapter repoAdapter,
                     final Map<String, SearchMappings> searchMappings,
                     final Map<String, SearchContribution> searchContributions); }
SearchUtils extends ComponentSupport { public QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters) { BoolQueryBuilder query = QueryBuilders.boolQuery(); searchFilters.stream() .filter(searchFilter -> !isBlank(searchFilter.getValue())) .sorted(comparing(SearchFilter::getProperty).thenComparing(SearchFilter::getValue)) .forEach(searchFilter -> { SearchContribution searchContribution = searchContributions .getOrDefault(searchFilter.getProperty(), defaultSearchContribution); searchContribution.contribute(query, searchFilter.getProperty(), searchFilter.getValue()); }); log.debug("Query: {}", query); return query; } @Inject  SearchUtils(final RepositoryManagerRESTAdapter repoAdapter,
                     final Map<String, SearchMappings> searchMappings,
                     final Map<String, SearchContribution> searchContributions); Map<String, String> getSearchParameters(); Map<String, String> getAssetSearchParameters(); Repository getRepository(final String repository); QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters); QueryBuilder buildQuery(final UriInfo uriInfo); QueryBuilder buildQuery(final UriInfo uriInfo, final List<String> parameters); boolean isAssetSearchParam(final String assetSearchParam); boolean isFullAssetAttributeName(final String assetSearchParam); String getFullAssetAttributeName(final String key); List<SortBuilder> getSortBuilders(final String sort, final String direction); List<SortBuilder> getSortBuilders(final String sort, final String direction, boolean allowAnySort); }
SearchUtils extends ComponentSupport { public QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters) { BoolQueryBuilder query = QueryBuilders.boolQuery(); searchFilters.stream() .filter(searchFilter -> !isBlank(searchFilter.getValue())) .sorted(comparing(SearchFilter::getProperty).thenComparing(SearchFilter::getValue)) .forEach(searchFilter -> { SearchContribution searchContribution = searchContributions .getOrDefault(searchFilter.getProperty(), defaultSearchContribution); searchContribution.contribute(query, searchFilter.getProperty(), searchFilter.getValue()); }); log.debug("Query: {}", query); return query; } @Inject  SearchUtils(final RepositoryManagerRESTAdapter repoAdapter,
                     final Map<String, SearchMappings> searchMappings,
                     final Map<String, SearchContribution> searchContributions); Map<String, String> getSearchParameters(); Map<String, String> getAssetSearchParameters(); Repository getRepository(final String repository); QueryBuilder buildQuery(final Collection<SearchFilter> searchFilters); QueryBuilder buildQuery(final UriInfo uriInfo); QueryBuilder buildQuery(final UriInfo uriInfo, final List<String> parameters); boolean isAssetSearchParam(final String assetSearchParam); boolean isFullAssetAttributeName(final String assetSearchParam); String getFullAssetAttributeName(final String key); List<SortBuilder> getSortBuilders(final String sort, final String direction); List<SortBuilder> getSortBuilders(final String sort, final String direction, boolean allowAnySort); static final String CONTINUATION_TOKEN; static final String SORT_FIELD; static final String SORT_DIRECTION; }