use of org.apache.commons.jxpath.ri.compiler.Step in project collect by openforis.
the class ReferencedPathEvaluator method determineReferencedPaths.
private Set<String> determineReferencedPaths(org.apache.commons.jxpath.ri.compiler.Path modelLocationPath) {
Set<String> paths = new HashSet<String>();
if (modelLocationPath.getSteps().length > 0) {
paths.add(Path.getAbsolutePath(modelLocationPath.toString()));
StringBuilder predicateBasePathSB = new StringBuilder();
for (Step step : modelLocationPath.getSteps()) {
String stepVal = step.toString();
predicateBasePathSB.append(Path.getAbsolutePath(stepVal)).append(Path.SEPARATOR);
for (Expression predicate : step.getPredicates()) {
Set<String> predicatePaths = determineReferencedPaths(predicate);
for (String predicateReferencePath : predicatePaths) {
if (predicateReferencePath.startsWith(Path.THIS_VARIABLE) || predicateReferencePath.startsWith(Path.CONTEXT_VARIABLE)) {
paths.add(predicateReferencePath);
} else {
paths.add(predicateBasePathSB.toString() + predicateReferencePath);
}
}
}
}
}
return paths;
}
Aggregations