Mercurial > dive4elements > river
changeset 5433:df32d7518f55
Expose function dc:has-result to Function Resolver.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 16:29:12 +0100 |
parents | d0f5bc8064f1 |
children | fd07bcaff880 |
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, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Tue Mar 26 16:24:07 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/Builder.java Tue Mar 26 16:29:12 2013 +0100 @@ -236,6 +236,10 @@ } } + public boolean hasResult() { + return !connectionsStack.isEmpty() + && !connectionsStack.peek().getB().isEmpty(); + } protected ResultData createFilteredResultData(ResultData rd, String filter) { if (filter == null) return rd;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Tue Mar 26 16:24:07 2013 +0100 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java Tue Mar 26 16:29:12 2013 +0100 @@ -74,6 +74,13 @@ return toValue(args); } }); + + addFunction("has-result", 0, new XPathFunction() { + @Override + public Object evaluate(List args) throws XPathFunctionException { + return FunctionResolver.this.buildHelper.hasResult(); + } + }); } /**