static String evaluateExpression(final Tree tree, final String queryText, final Map<String, String> valueMap, final AttributeValueDecorator decorator, final Map<String, String> stateVariables) throws ProcessException { final Object evaluated = Query.fromTree(tree, queryText).evaluate(valueMap, stateVariables).getValue(); if (evaluated == null) { return null; } final String value = evaluated.toString(); return decorator == null ? value : decorator.decorate(value); }
@Override public String evaluate(final FlowFile flowFile, final AttributeValueDecorator decorator) throws ProcessException { final ValueLookup lookup = new ValueLookup(variableRegistry, flowFile); final Object evaluationResult = query.evaluate(lookup).getValue(); if (evaluationResult == null) { return ""; } String result = evaluationResult.toString(); if (decorator != null) { result = decorator.decorate(result); } return Query.unescape(result); } }