changeset 2598:e96bf6c47c12

Improved selecting discharge tables for historical discharge calculation. flys-artifacts/trunk@4169 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 20 Mar 2012 11:34:44 +0000
parents b61357384a7a
children fb7975828ffa
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/Calculation6.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeInfoService.java
diffstat 3 files changed, 20 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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 <ingo@intevation.de>
+
+	* 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 <ingo@intevation.de>
 
 	flys/issue146 (In WINFO Diagramm Abflusskurve raus, wenn nicht gewünscht)
--- 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;
         }
 
--- 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();
 

http://dive4elements.wald.intevation.org