changeset 5432:d0f5bc8064f1

pass BuildHelper to Function Resolver.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 26 Mar 2013 16:24:07 +0100
parents 2fe120e1e4df
children df32d7518f55
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java
diffstat 2 files changed, 8 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java	Tue Mar 26 16:19:10 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java	Tue Mar 26 16:24:07 2013 +0100
@@ -543,7 +543,7 @@
             try {
                 XPath xpath = XPATH_FACTORY.newXPath();
                 xpath.setXPathVariableResolver(frames);
-                xpath.setXPathFunctionResolver(FunctionResolver.FUNCTIONS);
+                xpath.setXPathFunctionResolver(new FunctionResolver(this));
                 return xpath.evaluate(expr, EVAL_DOCUMENT, returnType);
             }
             catch (XPathExpressionException xpee) {
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java	Tue Mar 26 16:19:10 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java	Tue Mar 26 16:24:07 2013 +0100
@@ -42,10 +42,16 @@
     /** List of functions. */
     protected List<Entry> functions;
 
-    public static final FunctionResolver FUNCTIONS = new FunctionResolver();
+    protected Builder.BuildHelper buildHelper;
 
 
     public FunctionResolver() {
+        this(null);
+    }
+
+    public FunctionResolver(Builder.BuildHelper buildHelper) {
+        this.buildHelper = buildHelper;
+
         functions = new ArrayList<Entry>();
 
         addFunction("contains", 2, new XPathFunction() {

http://dive4elements.wald.intevation.org