use of org.apache.commons.jxpath.ri.compiler.Expression in project collect by openforis.
the class ReferencedPathEvaluator method determineReferencedPaths.
private Set<String> determineReferencedPaths(Operation operation) {
Set<String> paths = new HashSet<String>();
if (operation instanceof ModelExtensionFunction) {
ModelExtensionFunction modelExtensionFunction = (ModelExtensionFunction) operation;
Set<String> pathsReferencedByFunction = determineReferencedPaths(modelExtensionFunction);
paths.addAll(pathsReferencedByFunction);
}
Expression[] arguments = operation.getArguments();
boolean hasArguments = arguments != null && arguments.length > 0;
if (hasArguments) {
for (Expression arg : arguments) {
paths.addAll(determineReferencedPaths(arg));
}
}
return paths;
}
use of org.apache.commons.jxpath.ri.compiler.Expression in project collect by openforis.
the class ModelJXPathCompiledExpression method validateOperations.
private ExpressionValidationResult validateOperations(OperationVaildator operationValidator) {
Deque<Expression> stack = new LinkedList<Expression>();
stack.push(getExpression());
while (!stack.isEmpty()) {
Expression expression = stack.pop();
if (expression instanceof Operation) {
Operation op = (Operation) expression;
ExpressionValidationResult result = operationValidator.validate(op);
if (result.isError()) {
return result;
} else {
Expression[] args = op.getArguments();
if (args != null) {
stack.addAll(Arrays.asList(args));
}
}
}
}
return new ExpressionValidationResult();
}
Aggregations