@Test public void buildPredicate_WhitespaceDelimiters() { predicate.set("values", "foo" + System.lineSeparator() + "bar zip zap"); predicate.set("delimiter", "__WS"); Predicate actual = propertyValuesPredicateEvaluator.buildPredicate(predicate); assertEquals("foo", actual.get("0_value")); assertEquals("bar", actual.get("1_value")); assertEquals("zip", actual.get("2_value")); assertEquals("zap", actual.get("3_value")); }
protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .forEach(value -> values.addAll(getValues(value, delimiters))); if (isFulltextOperation(predicate)) { buildFulltextPredicate(predicate, values, predicate.get(JcrPropertyPredicateEvaluator.PROPERTY)); } else { buildPropertyPredicate(predicate, values); } predicate.set(PREDICATE_BUILT_KEY, PREDICATE_BUILT_VALUE); return predicate; }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .forEach(value -> values.addAll(getValues(value, delimiters))); if (isFulltextOperation(predicate)) { buildFulltextPredicate(predicate, values, predicate.get(JcrPropertyPredicateEvaluator.PROPERTY)); } else { buildPropertyPredicate(predicate, values); } predicate.set(PREDICATE_BUILT_KEY, PREDICATE_BUILT_VALUE); return predicate; } }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .forEach(value -> values.addAll(getValues(value, delimiters))); if (isFulltextOperation(predicate)) { buildFulltextPredicate(predicate, values, predicate.get(JcrPropertyPredicateEvaluator.PROPERTY)); } else { buildPropertyPredicate(predicate, values); } predicate.set(PREDICATE_BUILT_KEY, PREDICATE_BUILT_VALUE); return predicate; }  }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .forEach(value -> values.addAll(getValues(value, delimiters))); if (isFulltextOperation(predicate)) { buildFulltextPredicate(predicate, values, predicate.get(JcrPropertyPredicateEvaluator.PROPERTY)); } else { buildPropertyPredicate(predicate, values); } predicate.set(PREDICATE_BUILT_KEY, PREDICATE_BUILT_VALUE); return predicate; }  @Override String getXPathExpression(Predicate predicate, EvaluationContext evaluationContext); @Override boolean includes(final Predicate predicate, final Row row, final EvaluationContext evaluationContext); @Override boolean canXpath(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean canFilter(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean isFiltering(final Predicate predicate, final EvaluationContext evaluationContext); @Override String[] getOrderByProperties(Predicate predicate, EvaluationContext evaluationContext); @Override Comparator<Row> getOrderByComparator(Predicate predicate, EvaluationContext evaluationContext); @Override FacetExtractor getFacetExtractor(Predicate predicate, EvaluationContext evaluationContext); }
PropertyValuesPredicateEvaluator implements PredicateEvaluator { protected Predicate buildPredicate(final Predicate predicate) { if (PREDICATE_BUILT_VALUE.equals(predicate.get(PREDICATE_BUILT_KEY))) { return predicate; } final List<String> delimiters = getDelimiters(predicate); final List<String> values = new ArrayList<>(); PredicateEvaluatorUtil.getValues(predicate, VALUES, true) .forEach(value -> values.addAll(getValues(value, delimiters))); if (isFulltextOperation(predicate)) { buildFulltextPredicate(predicate, values, predicate.get(JcrPropertyPredicateEvaluator.PROPERTY)); } else { buildPropertyPredicate(predicate, values); } predicate.set(PREDICATE_BUILT_KEY, PREDICATE_BUILT_VALUE); return predicate; }  @Override String getXPathExpression(Predicate predicate, EvaluationContext evaluationContext); @Override boolean includes(final Predicate predicate, final Row row, final EvaluationContext evaluationContext); @Override boolean canXpath(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean canFilter(final Predicate predicate, final EvaluationContext evaluationContext); @Override boolean isFiltering(final Predicate predicate, final EvaluationContext evaluationContext); @Override String[] getOrderByProperties(Predicate predicate, EvaluationContext evaluationContext); @Override Comparator<Row> getOrderByComparator(Predicate predicate, EvaluationContext evaluationContext); @Override FacetExtractor getFacetExtractor(Predicate predicate, EvaluationContext evaluationContext); static final String PREDICATE_NAME; static final String VALUES; }