diff flys-aft/src/main/java/de/intevation/aft/River.java @ 4100:981de0b77c6b

If gauges exist in FLYS and AFT store the discharge tables in FLYS that are only in AFT. flys-aft/trunk@3622 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sun, 08 Jan 2012 11:33:44 +0000
parents 006e99437fb9
children e8967ee1cb05
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/River.java	Sun Jan 08 09:25:36 2012 +0000
+++ b/flys-aft/src/main/java/de/intevation/aft/River.java	Sun Jan 08 11:33:44 2012 +0000
@@ -189,7 +189,11 @@
                 + "' found in FLYS but not in AFT. -> ignore");
         }
 
-        // TODO: Create the new discharge tables.
+        // Create the new discharge tables.
+        for (DischargeTable aftDT: createDTs) {
+            createDischargeTables(context, gauge);
+            modified = true;
+        }
 
         return modified;
     }
@@ -254,7 +258,7 @@
                     .setInt("river_id", id1)
                     .setDouble("station", gauge.getStation())
                     .setDouble("aeo", gauge.getAeo())
-                    .setDouble("official_number", officialNumber)
+                    .setLong("official_number", officialNumber)
                     .setDouble("datum", gauge.getLatestDatum().getValue());
 
                 insertStmnt.execute();
@@ -263,7 +267,7 @@
                     "' with id " + gaugeId + ".");
 
                 gauge.setFlysId(gaugeId);
-                createDischargeTables(context, officialNumber, gauge);
+                createDischargeTables(context, gauge);
                 flysStatements.commitTransaction();
                 modified = true;
             }
@@ -283,7 +287,6 @@
 
     protected void createDischargeTables(
         SyncContext context,
-        Long        officialNumber,
         DIPSGauge   gauge
     )
     throws SQLException
@@ -292,7 +295,7 @@
 
         // Load the discharge tables from AFT.
         List<DischargeTable> dts = loadAftDischargeTables(
-            context, officialNumber, gauge);
+            context, gauge);
 
         // Persist the time intervals.
         persistFlysTimeIntervals(context, dts);
@@ -306,13 +309,12 @@
 
     protected List<DischargeTable> loadAftDischargeTables(
         SyncContext context,
-        Long        officialNumber,
         DIPSGauge   gauge
     )
     throws SQLException
     {
         return DischargeTable.loadAftDischargeTables(
-            context, officialNumber, gauge.getFlysId());
+            context, gauge.getOfficialNumber(), gauge.getFlysId());
     }
 
     protected void persistFlysTimeIntervals(

http://dive4elements.wald.intevation.org