diff flys-aft/src/main/java/de/intevation/aft/DischargeTable.java @ 4101:b6a18d706cbe

Added debugging for AFT time intervals. flys-aft/trunk@3630 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 09 Jan 2012 15:34:19 +0000
parents 006e99437fb9
children e8967ee1cb05
line wrap: on
line diff
--- a/flys-aft/src/main/java/de/intevation/aft/DischargeTable.java	Sun Jan 08 11:33:44 2012 +0000
+++ b/flys-aft/src/main/java/de/intevation/aft/DischargeTable.java	Mon Jan 09 15:34:19 2012 +0000
@@ -10,8 +10,12 @@
 import de.intevation.db.SymbolicStatement;
 import de.intevation.db.ConnectedStatements;
 
+import org.apache.log4j.Logger;
+
 public class DischargeTable
 {
+    private static Logger log = Logger.getLogger(DischargeTable.class);
+
     protected int          id;
     protected int          gaugeId;
     protected TimeInterval timeInterval;
@@ -209,9 +213,18 @@
             .executeQuery();
 
         while (rs.next()) {
-            int    dtId        = rs.getInt("ABFLUSSTAFEL_NR");
-            Date   from        = rs.getDate("GUELTIG_VON");
-            Date   to          = rs.getDate("GUELTIG_BIS");
+            int  dtId = rs.getInt("ABFLUSSTAFEL_NR");
+            Date from = rs.getDate("GUELTIG_VON");
+            Date to   = rs.getDate("GUELTIG_BIS");
+
+            if (from != null && to != null && from.compareTo(to) > 0) {
+                log.warn("AFT: ABFLUSSTAFEL_NR = " 
+                    + dtId + ": " + from + " > " + to + ". -> swap");
+                Date temp = from;
+                from = to;
+                to = temp;
+            }
+
             String description = rs.getString("ABFLUSSTAFEL_BEZ");
             if (description == null) {
                 description = String.valueOf(officialNumber);

http://dive4elements.wald.intevation.org