diff flys-aft/src/main/java/de/intevation/aft/River.java @ 4081:7a7b0f0cb653

Check if AFT gauges are in DIPS, too. flys-aft/trunk@3456 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 16 Dec 2011 19:25:31 +0000
parents 42094f01afa6
children d13011e53022
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/River.java	Fri Dec 16 18:51:26 2011 +0000
+++ b/flys-aft/src/main/java/de/intevation/aft/River.java	Fri Dec 16 19:25:31 2011 +0000
@@ -61,6 +61,8 @@
     public void sync(SyncContext context) throws SQLException {
         log.info("sync river: " + this);
 
+        Map<Long, DIPSGauge> dipsGauges = indexByNumber(context.getDips());
+
         ConnectedStatements flysStatements = context.getFlysStatements();
         ConnectedStatements aftStatements  = context.getAftStatements();
 
@@ -72,7 +74,16 @@
         while (messstellenRs.next()) {
             String name = messstellenRs.getString("NAME");
             String num  = messstellenRs.getString("MESSSTELLE_NR");
-            System.err.println(name + ": " + num);
+            Long number = numberToLong(num);
+            if (number == null) {
+                log.warn("Invalid MESSSTELLE_NR for MESSSTELLE '"+name+"'");
+                continue;
+            }
+            DIPSGauge dipsGauge = dipsGauges.get(number);
+            if (dipsGauges == null) {
+                log.warn("MESSSTELLE '" + name + "' not found in DIPS.");
+                continue;
+            }
         }
 
         messstellenRs.close();
@@ -90,7 +101,6 @@
 
         gaugesRs.close();
 
-        Map<Long, DIPSGauge> map = indexByNumber(context.getDips());
     }
 
     public String toString() {

http://dive4elements.wald.intevation.org