diff gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 610:6484464d2059

Changed the mechanism for searching for specific parameter collections. gnv-artifacts/trunk@676 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 11 Feb 2010 11:58:39 +0000
parents f1dc3c2f9be7
children 4b818f13e20a
line wrap: on
line diff
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Thu Feb 11 08:54:58 2010 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java	Thu Feb 11 11:58:39 2010 +0000
@@ -38,7 +38,9 @@
 import de.intevation.gnv.state.InputData;
 import de.intevation.gnv.state.OutputStateBase;
 
+import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
+import de.intevation.gnv.state.describedata.NamedArrayList;
 import de.intevation.gnv.state.describedata.NamedCollection;
 
 import de.intevation.gnv.state.exception.StateException;
@@ -530,13 +532,12 @@
 
             while (it.hasNext()) {
                 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
+                return data.getValue();
+            }
 
-                if (data.isSelected()) {
-                    return data.getValue();
-                }
-            }
+            return "";
         }
-        return null;
+        return "";
     }
 
 
@@ -870,32 +871,31 @@
                                                                       value));
                         }
                     }
-                    
                 }
             }
         }
     }
-    
+
     /**
      * @param collectionName
      * @return
      */
     protected Collection<KeyValueDescibeData> getCollection(
-                                                            String collectionName, 
-                                                            String uuid) {
-        Iterator<Object> it = this.getDescibeData(uuid).iterator();
-        while (it.hasNext()) {
-
-            Object o = it.next();
+        String collectionName,
+        String uuid)
+    {
+        NamedCollection<KeyValueDescibeData> c = new NamedArrayList<KeyValueDescibeData>(collectionName);
 
-            if (o instanceof NamedCollection<?>) {
-                NamedCollection<KeyValueDescibeData> nc = (NamedCollection<KeyValueDescibeData>) o;
-                if (nc.getName().equals(collectionName)) {
-                    return nc;
-                }
-            }
+        InputData data = inputData.get(collectionName);
+        if (data == null) {
+            log.warn("No collection found with name: " + collectionName);
+            return c;
         }
-        return null;
+
+        c.add(new DefaultKeyValueDescribeData(
+            data.getValue(), data.getDescription(), getID()));
+
+        return c;
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org