comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/FunctionResolver.java @ 6448:00aa1bc72a65

Set tokm and fromkm to location if we are at a location to apply km-filtering correctly
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 26 Jun 2013 20:50:58 +0200
parents f49749526af4
children 468d9ebda4ce
comparison
equal deleted inserted replaced
6447:dad4f0424783 6448:00aa1bc72a65
232 public Object fromValue(List args) throws XPathFunctionException { 232 public Object fromValue(List args) throws XPathFunctionException {
233 Object mode = args.get(0); 233 Object mode = args.get(0);
234 Object locations = args.get(1); 234 Object locations = args.get(1);
235 Object from = args.get(2); 235 Object from = args.get(2);
236 236
237 if (mode instanceof String && mode.equals("location")) { 237 if ((mode instanceof String && mode.equals("location")) ||
238 (locations instanceof String && !((String)locations).isEmpty())) {
238 if (!(locations instanceof String)) { 239 if (!(locations instanceof String)) {
239 return -FAR_AWAY; 240 return -FAR_AWAY;
240 } 241 }
241 String loc = ((String)locations).replace(" ", ""); 242 String loc = ((String)locations).replace(" ", "");
242 String[] split = loc.split(","); 243 String[] split = loc.split(",");
277 public Object toValue(List args) throws XPathFunctionException { 278 public Object toValue(List args) throws XPathFunctionException {
278 Object mode = args.get(0); 279 Object mode = args.get(0);
279 Object locations = args.get(1); 280 Object locations = args.get(1);
280 Object to = args.get(2); 281 Object to = args.get(2);
281 282
282 if (mode instanceof String && mode.equals("location")) { 283 if ((mode instanceof String && mode.equals("location")) ||
284 (locations instanceof String && !((String)locations).isEmpty())) {
283 if (!(locations instanceof String)) { 285 if (!(locations instanceof String)) {
284 return FAR_AWAY; 286 return FAR_AWAY;
285 } 287 }
286 try { 288 try {
287 String loc = ((String)locations).replace(" ", ""); 289 String loc = ((String)locations).replace(" ", "");

http://dive4elements.wald.intevation.org