comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java @ 232:3d6d89bcbf42

Added special Data-Selection to the ODV-Exports of TimeSeries on TimeSeriesPoints. issue68 gnv-artifacts/trunk@300 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Mon, 09 Nov 2009 08:55:01 +0000
parents 3e82b4f1c455
children 4e8f0fd8ed79
comparison
equal deleted inserted replaced
231:74255064a4c5 232:3d6d89bcbf42
366 this.inputData.values() : 366 this.inputData.values() :
367 null,uuid); 367 null,uuid);
368 this.alternativeTransition.advance(uuid, callMeta); 368 this.alternativeTransition.advance(uuid, callMeta);
369 }else{ 369 }else{
370 try { 370 try {
371 List<String> list = new ArrayList<String>(); 371 String[] filterValues = this.generateFilterValuesFromInputData();
372 Iterator<String> it = this.inputValueNames.iterator();
373 int i = 0;
374 while (it.hasNext()) {
375 String value = it.next();
376 InputData data = this.inputData.get(value);
377 if (data != null
378 && this.inputValues.containsKey(data.getName())) {
379 int size = this.inputValues.get(data.getName())
380 .usedInQueries();
381 String type = this.inputValues.get(data.getName())
382 .getType();
383 String requestValue = data.getValue();
384 if (type.equalsIgnoreCase("string")) {
385 requestValue = this
386 .prepareInputData4DBQuery(requestValue);
387 } else if (type.equalsIgnoreCase("date")) {
388 requestValue = this
389 .prepareInputData4DateDBQuery(requestValue);
390 } else if (type.equalsIgnoreCase("coordinate")){
391 requestValue = this
392 .prepareInputData4RegionDBQuery(requestValue);
393 }
394 for (int j = 0; j < size; j++) {
395 list.add(requestValue);
396 }
397 }
398 }
399 String[] filterValues = list.toArray(new String[0]);
400 Collection<Result> result = null; 372 Collection<Result> result = null;
401 try { 373 try {
402 if (this.queryID != null) { 374 if (this.queryID != null) {
403 QueryExecutor queryExecutor = QueryExecutorFactory 375 QueryExecutor queryExecutor = QueryExecutorFactory
404 .getInstance().getQueryExecutor(); 376 .getInstance().getQueryExecutor();
412 } catch (QueryException e) { 384 } catch (QueryException e) {
413 log.error(e, e); 385 log.error(e, e);
414 throw new TransitionException(e); 386 throw new TransitionException(e);
415 } 387 }
416 } 388 }
389 }
390
391 /**
392 * @return
393 */
394 protected String[] generateFilterValuesFromInputData() {
395 List<String> list = new ArrayList<String>();
396 Iterator<String> it = this.inputValueNames.iterator();
397 while (it.hasNext()) {
398 String value = it.next();
399 InputData data = this.inputData.get(value);
400 if (data != null
401 && this.inputValues.containsKey(data.getName())) {
402 int size = this.inputValues.get(data.getName())
403 .usedInQueries();
404 String type = this.inputValues.get(data.getName())
405 .getType();
406 String requestValue = data.getValue();
407 if (type.equalsIgnoreCase("string")) {
408 requestValue = this
409 .prepareInputData4DBQuery(requestValue);
410 } else if (type.equalsIgnoreCase("date")) {
411 requestValue = this
412 .prepareInputData4DateDBQuery(requestValue);
413 } else if (type.equalsIgnoreCase("coordinate")){
414 requestValue = this
415 .prepareInputData4RegionDBQuery(requestValue);
416 }
417 for (int j = 0; j < size; j++) {
418 list.add(requestValue);
419 }
420 }
421 }
422 String[] filterValues = list.toArray(new String[0]);
423 return filterValues;
417 } 424 }
418 425
419 protected String prepareInputData4RegionDBQuery(String value){ 426 protected String prepareInputData4RegionDBQuery(String value){
420 return value; 427 return value;
421 } 428 }

http://dive4elements.wald.intevation.org