@Override public Predicate apply(RequestScope dictionary) { return operator.contextualize(getFieldPath(), values, dictionary); }
@Override public Predicate apply(RequestScope dictionary) { return operator.contextualize(getFieldPath(), values, dictionary); }
/** * Compute the parameter value/name pairings. * @return the filter parameters for this predicate */ public List<FilterParameter> getParameters() { String baseName = String.format("%s_%s_", getFieldPath().replace(PERIOD, UNDERSCORE), Integer.toHexString(hashCode())); return IntStream.range(0, values.size()) .mapToObj(idx -> new FilterParameter(String.format("%s%d", baseName, idx), values.get(idx))) .collect(Collectors.toList()); }
/** * Compute the parameter value/name pairings. * @return the filter parameters for this predicate */ public List<FilterParameter> getParameters() { String baseName = String.format("%s_%s_", getFieldPath().replace(PERIOD, UNDERSCORE), Integer.toHexString(hashCode())); return IntStream.range(0, values.size()) .mapToObj(idx -> new FilterParameter(String.format("%s%d", baseName, idx), values.get(idx))) .collect(Collectors.toList()); }
/** * Applies a filter predicate to the object in question. * * @param object object returned from datastore * @param filterPredicate A predicate from filterExpressionCheck * @param requestScope Request scope object * @return true if the object pass evaluation against Predicate. */ public boolean applyPredicateToObject(T object, FilterPredicate filterPredicate, RequestScope requestScope) { try { String fieldPath = filterPredicate.getFieldPath(); com.yahoo.elide.core.RequestScope scope = coreScope(requestScope); Predicate fn = filterPredicate.getOperator().contextualize(fieldPath, filterPredicate.getValues(), scope); return fn.test(object); } catch (Exception e) { log.error("Failed to apply predicate {}", filterPredicate, e); return false; } }
/** * Applies a filter predicate to the object in question. * * @param object object returned from datastore * @param filterPredicate A predicate from filterExpressionCheck * @param requestScope Request scope object * @return true if the object pass evaluation against Predicate. */ public boolean applyPredicateToObject(T object, FilterPredicate filterPredicate, RequestScope requestScope) { try { String fieldPath = filterPredicate.getFieldPath(); com.yahoo.elide.core.RequestScope scope = coreScope(requestScope); Predicate fn = filterPredicate.getOperator().contextualize(fieldPath, filterPredicate.getValues(), scope); return fn.test(object); } catch (Exception e) { log.error("Failed to apply predicate {}", filterPredicate, e); return false; } }
String fieldPath = filterPredicate.getFieldPath();