# HG changeset patch # User Ingo Weinzierl # Date 1332243284 0 # Node ID e96bf6c47c12bee3b621049e3cc436709dc08b92 # Parent b61357384a7a5239f9ce7aff6d0581acaf8cc8c4 Improved selecting discharge tables for historical discharge calculation. flys-artifacts/trunk@4169 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r b61357384a7a -r e96bf6c47c12 flys-artifacts/ChangeLog --- a/flys-artifacts/ChangeLog Tue Mar 20 07:38:48 2012 +0000 +++ b/flys-artifacts/ChangeLog Tue Mar 20 11:34:44 2012 +0000 @@ -1,3 +1,12 @@ +2012-03-20 Ingo Weinzierl + + * src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java: + Skip DischargeTables that have no time interval set or that are marked + as master DischargeTable. + + * src/main/java/de/intevation/flys/artifacts/model/Calculation6.java: Skip + DischargeTables that have no time interval set. + 2012-03-20 Ingo Weinzierl flys/issue146 (In WINFO Diagramm Abflusskurve raus, wenn nicht gewünscht) diff -r b61357384a7a -r e96bf6c47c12 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java Tue Mar 20 07:38:48 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java Tue Mar 20 11:34:44 2012 +0000 @@ -108,7 +108,7 @@ protected boolean isDischargeTableRelevant(DischargeTable dt) { TimeInterval ti = dt.getTimeInterval(); - if (dt.getKind() == Gauge.MASTER_DISCHARGE_TABLE) { + if (dt.getKind() == Gauge.MASTER_DISCHARGE_TABLE || ti == null) { return false; } diff -r b61357384a7a -r e96bf6c47c12 flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java --- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java Tue Mar 20 07:38:48 2012 +0000 +++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java Tue Mar 20 11:34:44 2012 +0000 @@ -79,11 +79,21 @@ Element all = result.createElement("discharges"); for (DischargeTable dt: tables) { + if (dt.getKind() == Gauge.MASTER_DISCHARGE_TABLE) { + continue; + } + Element discharge = result.createElement("discharge"); discharge.setAttribute("description", dt.getDescription()); // Get time interval. TimeInterval ti = dt.getTimeInterval(); + + if (ti == null) { + logger.warn("DischargeTable has no TimeInterval set!"); + continue; + } + Date startTime = ti.getStartTime(); Date stopTime = ti.getStopTime();