Search in sources :

Example 1 with FilterParams

use of io.crnk.legacy.queryParams.params.FilterParams in project crnk-framework by crnk-project.

the class DefaultQueryParamsConverter method applyFiltering.

protected void applyFiltering(QuerySpec spec, QueryParams queryParams) {
    List<FilterSpec> filters = spec.getFilters();
    Map<String, FilterParams> decodedFiltersMap = new LinkedHashMap<>();
    if (filters != null && !filters.isEmpty()) {
        String resourceType = getResourceType(spec.getResourceClass());
        Map<String, Set<String>> map = new LinkedHashMap<>();
        for (FilterSpec filter : filters) {
            applyFilterSpec(map, filter);
        }
        decodedFiltersMap.put(resourceType, new FilterParams(map));
    }
    queryParams.setFilters(new TypedParams<>(Collections.unmodifiableMap(decodedFiltersMap)));
}
Also used : LinkedHashSet(java.util.LinkedHashSet) Set(java.util.Set) FilterParams(io.crnk.legacy.queryParams.params.FilterParams) FilterSpec(io.crnk.core.queryspec.FilterSpec) LinkedHashMap(java.util.LinkedHashMap)

Aggregations

FilterSpec (io.crnk.core.queryspec.FilterSpec)1 FilterParams (io.crnk.legacy.queryParams.params.FilterParams)1 LinkedHashMap (java.util.LinkedHashMap)1 LinkedHashSet (java.util.LinkedHashSet)1 Set (java.util.Set)1