use of io.vertigo.dynamo.collections.ListFilter in project vertigo by KleeGroup.
the class UiSelectedFacets method toListFilters.
/**
* Convert this Selected Facets to a list of ListFilter.
* @return ListFilter for these Facets
*/
public List<ListFilter> toListFilters() {
final List<ListFilter> listFilters = new ArrayList<>(size());
// facet selection list.
for (final Map.Entry<String, String> entry : entrySet()) {
final FacetDefinition facetDefinition = Home.getApp().getDefinitionSpace().resolve(entry.getKey(), FacetDefinition.class);
if (facetDefinition.isRangeFacet()) {
for (final FacetValue facet : facetDefinition.getFacetRanges()) {
if (facet.getCode().equals(entry.getValue())) {
listFilters.add(facet.getListFilter());
break;
}
}
} else {
final ListFilter filter = ListFilter.of(facetDefinition.getDtField().getName() + ":\"" + entry.getValue() + "\"");
listFilters.add(filter);
}
}
return listFilters;
}
Aggregations