@Test public void buildPredicate_WithNoneDelimiter() { final Map<String, String> expectedParams = new HashMap<>(); expectedParams.put(JcrPropertyPredicateEvaluator.OPERATION, JcrPropertyPredicateEvaluator.OP_EQUALS); expectedParams.put(JcrPropertyPredicateEvaluator.PROPERTY, "jcr:content/metadata/property"); expectedParams.put("0_" + JcrPropertyPredicateEvaluator.VALUE, "foo bar"); expectedParams.put("1_" + JcrPropertyPredicateEvaluator.VALUE, "zip zap"); expectedParams.put("__asset-share-commons--predicate-built", "true"); expectedParams.put("values", null); expectedParams.put("1_values", null); expectedParams.put("delimiter", null); predicate.set("operation", "equals"); predicate.set("property", "jcr:content/metadata/property"); predicate.set("values", "foo bar"); predicate.set("1_values", "zip zap"); predicate.set("delimiter", "_NONE"); final Predicate actual = propertyValuesPredicateEvaluator.buildPredicate(predicate); assertEquals("propertyvalues", actual.getType()); assertEquals(expectedParams, actual.getParameters()); assertEquals("test", actual.getName()); }
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; }