/** * Construct an JobRowFilter object using the same FilterOperation and values as the object on * which this method is called and using the supplied JobField. * * @param jobField The JobField to perform the filtering on * * @return An instance of JobRowFilter created using the supplied JobField */ public JobRowFilter withJobField(JobField jobField) { return new JobRowFilter(jobField, operation, values); }
/** * Construct an JobRowFilter object using the same JobField and FilterOperation as the object on * which this method is called and using the supplied values. * * @param values A Set of Strings to compare the JobField's value to * * @return An instance of JobRowFilter created using the supplied values */ public JobRowFilter withValues(Set<String> values) { return new JobRowFilter(jobField, operation, values); }
/** * Construct an JobRowFilter object using the same JobField and values as the object on * which this method is called and using the supplied FilterOperation. * * @param operation The operation to perform (eg: eq) * * @return An instance of JobRowFilter created using the supplied FilterOperation */ public JobRowFilter withOperation(FilterOperation operation) { return new JobRowFilter(jobField, operation, values); }
/** * Given a filter String, generates a Set of ApiJobStoreFilters. This method will throw a BadApiRequestException if * the filter String cannot be parsed into ApiJobStoreFilters successfully. * * @param filterQuery Expects a URL filterQuery String that may contain multiple filters separated by * comma. The format of a filter String is : * (JobField name)-(operation)[(value or comma separated values)]? * * @return A Set of ApiJobStoreFilters */ public LinkedHashSet<JobRowFilter> buildJobStoreFilter(@NotNull String filterQuery) { // split on '],' to get list of filters return Arrays.stream(filterQuery.split(COMMA_AFTER_BRACKET_PATTERN)) .map( filter -> { try { return new JobRowFilter(filter); } catch (BadFilterException e) { throw new BadApiRequestException(e.getMessage(), e); } } ) .collect(Collectors.toCollection(LinkedHashSet<JobRowFilter>::new)); }