diff flys-aft/src/main/java/de/intevation/aft/River.java @ 5188:2b7f44c80857

Stations are now filtered by DiPS not AFT.
author Sascha L. Teichmann <teichmann@intevation.de>
date Thu, 07 Mar 2013 12:46:37 +0100
parents d9f1202cef78
children da1e897c7224
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/River.java	Thu Mar 07 12:02:02 2013 +0100
+++ b/flys-aft/src/main/java/de/intevation/aft/River.java	Thu Mar 07 12:46:37 2013 +0100
@@ -65,7 +65,8 @@
     public boolean sync(SyncContext context) throws SQLException {
         log.info("sync river: " + this);
 
-        Map<Long, DIPSGauge> dipsGauges = context.getDIPSGauges();
+        // Only take relevant gauges into account.
+        Map<Long, DIPSGauge> dipsGauges = context.getDIPSGauges(name, from, to);
 
         ConnectedStatements flysStatements = context.getFlysStatements();
         ConnectedStatements aftStatements  = context.getAftStatements();
@@ -78,14 +79,18 @@
             .getStatement("select.messstelle")
             .clearParameters()
             .setInt("GEWAESSER_NR", id2)
-            .setDouble("START_KM", from)
-            .setDouble("END_KM", to)
             .executeQuery();
 
         try {
             while (messstellenRs.next()) {
                 String name = messstellenRs.getString("NAME");
                 String num  = messstellenRs.getString("MESSSTELLE_NR");
+                double station = messstellenRs.getDouble("STATIONIERUNG");
+
+                if (!messstellenRs.wasNull() && station < from && station > to) {
+                    log.warn("Station found in AFT but in range: " + station);
+                    continue;
+                }
 
                 Long number = SyncContext.numberToLong(num);
                 if (number == null) {

http://dive4elements.wald.intevation.org