Mercurial > dive4elements > river
changeset 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 (2012-01-09) |
parents | 981de0b77c6b |
children | e8967ee1cb05 |
files | flys-aft/ChangeLog flys-aft/src/main/java/de/intevation/aft/DischargeTable.java flys-aft/src/main/java/de/intevation/aft/SyncContext.java flys-aft/src/main/java/de/intevation/aft/TimeInterval.java |
diffstat | 4 files changed, 37 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-aft/ChangeLog Sun Jan 08 11:33:44 2012 +0000 +++ b/flys-aft/ChangeLog Mon Jan 09 15:34:19 2012 +0000 @@ -1,3 +1,15 @@ +2012-01-09 Sascha L. Teichmann <sascha.teichmann@inteavtion.de> + + * src/main/java/de/intevation/aft/TimeInterval.java(toString): Added + toString() method. + + * src/main/java/de/intevation/aft/SyncContext.java: Added debug + logging when creating a new time inteval. + + * src/main/java/de/intevation/aft/DischargeTable.java: Added + warning when start and end of a time interval from AFT + are ordered start > end. + 2012-01-07 Sascha L. Teichmann <sascha.teichmann@inteavtion.de> * src/main/java/de/intevation/db/SymbolicStatement.java:
--- 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);
--- a/flys-aft/src/main/java/de/intevation/aft/SyncContext.java Sun Jan 08 11:33:44 2012 +0000 +++ b/flys-aft/src/main/java/de/intevation/aft/SyncContext.java Mon Jan 09 15:34:19 2012 +0000 @@ -171,16 +171,17 @@ key.setId(rs.getInt("time_interval_id")); rs.close(); rs = null; + if (log.isDebugEnabled()) { + log.debug("FLYS: Created time interval id: " + key.getId()); + log.debug("FLYS: " + key); + } + flysStatements.getStatement("insert.timeinterval") .clearParameters() .setInt("id", key.getId()) .setObject("start_time", key.getStart()) .setObject("stop_time", key.getStop()) .execute(); - - if (log.isDebugEnabled()) { - log.debug("FLYS: Created time interval id: " + key.getId()); - } } finally { if (rs != null) {
--- a/flys-aft/src/main/java/de/intevation/aft/TimeInterval.java Sun Jan 08 11:33:44 2012 +0000 +++ b/flys-aft/src/main/java/de/intevation/aft/TimeInterval.java Mon Jan 09 15:34:19 2012 +0000 @@ -62,5 +62,9 @@ public void setStop(Date stop) { this.stop = stop; } + + public String toString() { + return "[TimeInterval: start=" + start + ", stop=" + stop + "]"; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :