[Dive4elements-commits] [PATCH] Datacage: Added function dc:get('var-name'). Returns content of variable var-name or NULL if not
Wald Commits
scm-commit at wald.intevation.org
Tue Jun 4 15:17:22 CEST 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1370351839 -7200
# Node ID e30d396defa5a383a231335d2b21f3a699ec0c65
# Parent 5297e173c272fb9d740303ead98c24a40ae82708
Datacage: Added function dc:get('var-name'). Returns content of variable var-name or NULL if not
defined. This works around resolving unknown variables.
diff -r 5297e173c272 -r e30d396defa5 artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java Tue Jun 04 13:28:31 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java Tue Jun 04 15:17:19 2013 +0200
@@ -139,6 +139,18 @@
return FunctionResolver.this.buildHelper.frames.dump();
}
});
+
+ addFunction("get", 1, new XPathFunction() {
+ @Override
+ public Object evaluate(List args) throws XPathFunctionException {
+ Object o = args.get(0);
+ if (o instanceof String) {
+ FunctionResolver.this.buildHelper.frames.getNull(
+ (String)o, StackFrames.NULL);
+ }
+ return StackFrames.NULL;
+ }
+ });
}
/**
More information about the Dive4elements-commits
mailing list