/** * Take two Api filters which differ only by value sets and union their value sets. * * @param one The first ApiFilter * @param two The second ApiFilter * * @return an ApiFilter with the union of values */ public ApiFilter union(ApiFilter one, ApiFilter two) { if (Objects.equals(one.getDimension(), two.getDimension()) && Objects.equals(one.getDimensionField(), two.getDimensionField()) && Objects.equals(one.getOperation(), two.getOperation()) ) { Set<String> values = Stream.concat( one.getValues().stream(), two.getValues().stream() ) .collect(Collectors.toSet()); return one.withValues(values); } throw new IllegalArgumentException(String.format("Unmergable ApiFilters '%s' and '%s'", one, two)); } }
inProgressApiFilter = inProgressApiFilter.withValues(values); } catch (IllegalArgumentException e) { LOG.debug(FILTER_ERROR.logFormat(filterQuery, e.getMessage()), e);