comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java @ 83:5c8e54726a58

Added Support for Vertical Profiles Mesh gnv-artifacts/trunk@113 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Wed, 23 Sep 2009 11:57:08 +0000
parents 5eb62df21f9a
children c8d1f7b9e5a8
comparison
equal deleted inserted replaced
82:5eb62df21f9a 83:5c8e54726a58
293 Iterator<String> it = this.inputValueNames.iterator(); 293 Iterator<String> it = this.inputValueNames.iterator();
294 int i = 0; 294 int i = 0;
295 while (it.hasNext()){ 295 while (it.hasNext()){
296 String value = it.next(); 296 String value = it.next();
297 InputData data = this.inputData.get(value); 297 InputData data = this.inputData.get(value);
298 int size = this.inputValues.get(data.getName()).usedInQueries(); 298 if (data != null && this.inputValues.containsKey(data.getName())){
299 for (int j = 0; j < size; j++){ 299 int size = this.inputValues.get(data.getName()).usedInQueries();
300 list.add(data.getValue()); 300 String type = this.inputValues.get(data.getName()).getType();
301 String requestValue = data.getValue();
302 if (type.equalsIgnoreCase("string")){
303 requestValue = this.prepareInputData4DBQuery(requestValue);
304 }else if (type.equalsIgnoreCase("date")){
305 requestValue = this.prepareInputData4DateDBQuery(requestValue);
306 }
307 for (int j = 0; j < size; j++){
308 list.add(requestValue);
309 }
301 } 310 }
302 } 311 }
303 String[] filterValues = list.toArray(new String[0]); 312 String[] filterValues = list.toArray(new String[0]);
304 Collection<Result> result = null; 313 Collection<Result> result = null;
305 try { 314 try {
313 } 322 }
314 } catch (QueryException e) { 323 } catch (QueryException e) {
315 log.error(e,e); 324 log.error(e,e);
316 throw new TransitionException(e); 325 throw new TransitionException(e);
317 } 326 }
327 }
328
329 private String prepareInputData4DateDBQuery(String value){
330 if (value != null){
331 String[] values = value.split(",");
332 String newValue = "";
333 for (int i = 0; i < values.length; i++){
334 if (newValue.length() > 0){
335 newValue= newValue + " , ";
336 }
337 newValue = "to_date('"+values[0].trim()+"', 'YYYY.MM.DD HH24:MI:SS')"; // TODO JUST HACK FIND A BETTER RESOLUTION
338 }
339 return newValue;
340 }
341
342 return value;
343 }
344 private String prepareInputData4DBQuery(String value){
345 if (value != null){
346 String[] values = value.split(",");
347 String newValue = "";
348 for (int i = 0; i < values.length; i++){
349 if (newValue.length() > 0){
350 newValue= newValue + " , ";
351 }
352 newValue = "'"+values[0].trim()+"'";
353 }
354 return newValue;
355 }
356
357 return value;
358
318 } 359 }
319 360
320 /** 361 /**
321 * @param result 362 * @param result
322 */ 363 */

http://dive4elements.wald.intevation.org