@Override public String getName() { return name(); }
/** * Extracts the operation to be performed by the ApiJobStore filter query. * * @param tokenizedQuery The tokenized filter expression. * * @return The operation to be performed by the ApiJobStore filter query. * @throws BadFilterException if the operation does not exist */ private FilterOperation extractOperation(Matcher tokenizedQuery) throws BadFilterException { String operationName = tokenizedQuery.group(2); try { return DefaultFilterOperation.fromString(operationName); } catch (IllegalArgumentException ignored) { LOG.debug(FILTER_OPERATOR_INVALID.logFormat(operationName)); throw new BadFilterException(FILTER_OPERATOR_INVALID.format(operationName)); } }
/** * Negates a collection of negative filters, i.e. {@link DefaultFilterOperation#notin} {@code =>} * {@link DefaultFilterOperation#in}, and returns a stream of the negated filters. * <p> * This method throws {@link IllegalArgumentException} if any one of the filter collection passed in is not a * negative filter, i.e. {@link DefaultFilterOperation#notin}. * * @param negativeFilters The collection of filters to be negated * * @return a stream of the negated filters */ protected Set<ApiFilter> negateNegativeFilters(Collection<ApiFilter> negativeFilters) { return negativeFilters.stream() // TODO - refactor this and next map when more than 1 not* FilterOperations are supported. .peek(filter -> { if (!DefaultFilterOperation.notin.equals(filter.getOperation())) { String message = String.format(NON_NEGATIVE_FILTER_ERROR_FORMAT, filter); LOG.error(message); throw new IllegalArgumentException(message); } }) .map(filter -> filter.withOperation(DefaultFilterOperation.in)) .collect(Collectors.toSet()); }
FilterOperation operation = DefaultFilterOperation.fromString(operationName); inProgressApiFilter = inProgressApiFilter.withOperation(operation); } catch (IllegalArgumentException ignored) {
if (DefaultFilterOperation.notin.equals(filter.getOperation())) {