diff gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java @ 173:1b2fc94766c9

Added real Coordinate-Query to TimeSeries-Mesh gnv-artifacts/trunk@212 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Tue, 13 Oct 2009 09:11:23 +0000
parents 7fb9441dd8af
children baaa1618fa27
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Mon Oct 12 09:19:16 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/TransitionBase.java	Tue Oct 13 09:11:23 2009 +0000
@@ -335,6 +335,9 @@
                     } else if (type.equalsIgnoreCase("date")) {
                         requestValue = this
                                 .prepareInputData4DateDBQuery(requestValue);
+                    } else if (type.equalsIgnoreCase("coordinate")){
+                        requestValue = this
+                        .prepareInputData4RegionDBQuery(requestValue);
                     }
                     for (int j = 0; j < size; j++) {
                         list.add(requestValue);
@@ -359,6 +362,10 @@
             throw new TransitionException(e);
         }
     }
+    
+    protected String prepareInputData4RegionDBQuery(String value){
+        return value;
+    }
 
     private String prepareInputData4DateDBQuery(String value) {
         log.debug("TransitionBase.prepareInputData4DateDBQuery");
@@ -405,6 +412,18 @@
         if (this.descibeData == null) {
             this.descibeData = new ArrayList<Object>();
         }
+        NamedCollection<KeyValueDescibeData> keyValueDescibeData = extractKVP(result, "KEY", "VALUE");
+        this.descibeData.add(keyValueDescibeData);
+    }
+
+    /**
+     * @param result
+     * @return
+     */
+    protected NamedCollection<KeyValueDescibeData> extractKVP(
+                                                              Collection<Result> result,
+                                                              String keyid,
+                                                              String valueid) {
         Iterator<Result> rit = result.iterator();
         NamedCollection<KeyValueDescibeData> keyValueDescibeData = new NamedArrayList<KeyValueDescibeData>(
                 this.dataName, result.size());
@@ -412,9 +431,9 @@
         while (rit.hasNext()) {
             Result resultValue = rit.next();
             keyValueDescibeData.add(new DefaultKeyValueDescribeData(resultValue
-                    .getString("KEY"), resultValue.getString("VALUE")));
+                    .getString(keyid), resultValue.getString(valueid)));
         }
-        this.descibeData.add(keyValueDescibeData);
+        return keyValueDescibeData;
     }
 
     /**

http://dive4elements.wald.intevation.org