comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/datacage/templating/FunctionResolver.java @ 1716:3ca999f507b7

flys/issue314: Variables in datacage are now case insensitive. flys-artifacts/trunk@2994 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 17 Oct 2011 15:53:03 +0000
parents b81626b10cb7
children de0c2bbb27f9
comparison
equal deleted inserted replaced
1715:a70e0cbc5e02 1716:3ca999f507b7
42 FUNCTIONS.addFunction("contains", 2, new XPathFunction() { 42 FUNCTIONS.addFunction("contains", 2, new XPathFunction() {
43 @Override 43 @Override
44 public Object evaluate(List args) throws XPathFunctionException { 44 public Object evaluate(List args) throws XPathFunctionException {
45 Object haystack = args.get(0); 45 Object haystack = args.get(0);
46 Object needle = args.get(1); 46 Object needle = args.get(1);
47
48 if (needle instanceof String) {
49 needle = ((String)needle).toUpperCase();
50 }
51
47 try { 52 try {
48 if (haystack instanceof Collection) { 53 if (haystack instanceof Collection) {
49 return Boolean.valueOf( 54 return Boolean.valueOf(
50 ((Collection)haystack).contains(needle)); 55 ((Collection)haystack).contains(needle));
51 } 56 }

http://dive4elements.wald.intevation.org