changeset 711:69c8541edcc7

Generate report facets if there are problems with the calculations. flys-artifacts/trunk@2167 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 20 Jun 2011 14:14:20 +0000
parents cded0924193d
children 08dd826439ef
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java
diffstat 6 files changed, 38 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Mon Jun 20 13:47:59 2011 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jun 20 14:14:20 2011 +0000
@@ -1,3 +1,15 @@
+2011-06-20  Sascha L. Teichmann <sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java:
+	  Return the report.
+
+	* src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java,
+	  src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java,
+	  src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java,
+	  src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java:
+	  Generate report facets if there are problems with the calculations.
+	  TODO: Adjust winfo.xml to configure the facets.
+
 2011-06-20  Sascha L. Teichmann <sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/exports/ReportGenerator.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java	Mon Jun 20 13:47:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.java	Mon Jun 20 14:14:20 2011 +0000
@@ -37,7 +37,7 @@
         CalculationResult cr = (CalculationResult)winfo.compute(
             context, type, false);
 
-        return cr;
+        return cr.getReport();
     }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java	Mon Jun 20 13:47:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java	Mon Jun 20 14:14:20 2011 +0000
@@ -14,6 +14,7 @@
 import de.intevation.flys.artifacts.model.FacetTypes;
 import de.intevation.flys.artifacts.model.WaterlevelFacet;
 import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.ReportFacet;
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.model.CalculationResult;
 
@@ -70,7 +71,12 @@
 
                 facets.add(new WaterlevelFacet(i, COMPUTED_DISCHARGE_Q, name));
             }
+
             facets.add(new DataFacet(CSV, "CSV data"));
+
+            if (res.getReport().hasProblems()) {
+                facets.add(new ReportFacet());
+            }
         }
 
         return res;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java	Mon Jun 20 13:47:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java	Mon Jun 20 14:14:20 2011 +0000
@@ -10,7 +10,9 @@
 
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
+
 import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.ReportFacet;
 import de.intevation.flys.artifacts.model.WaterlevelFacet;
 import de.intevation.flys.artifacts.model.WQKms;
 import de.intevation.flys.artifacts.model.WQCKms;
@@ -34,16 +36,11 @@
         List<Facet>  facets, 
         Object       old
     ) {
-        CalculationResult res;
-
         WINFOArtifact winfo = (WINFOArtifact)artifact;
 
-        if (old instanceof CalculationResult) {
-            res = (CalculationResult)old;
-        }
-        else {
-            res = winfo.getDischargeLongitudinalSectionData();
-        }
+        CalculationResult res = old instanceof CalculationResult
+            ? (CalculationResult)old
+            : winfo.getDischargeLongitudinalSectionData();
 
         if (facets == null) {
             return res;
@@ -92,6 +89,10 @@
             facets.add(new DataFacet(WST, "WST data"));
         }
 
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet());
+        }
+
         return res;
     }
 }
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java	Mon Jun 20 13:47:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java	Mon Jun 20 14:14:20 2011 +0000
@@ -16,6 +16,7 @@
 import de.intevation.flys.artifacts.model.WQDay;
 
 import de.intevation.flys.artifacts.model.DataFacet;
+import de.intevation.flys.artifacts.model.ReportFacet;
 import de.intevation.flys.artifacts.model.CalculationResult;
 
 import de.intevation.flys.artifacts.resources.Resources;
@@ -83,6 +84,10 @@
             facets.add(q);
 
             facets.add(new DataFacet(CSV, "CSV data"));
+
+            if (res.getReport().hasProblems()) {
+                facets.add(new ReportFacet());
+            }
         }
 
         return res;
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Mon Jun 20 13:47:59 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java	Mon Jun 20 14:14:20 2011 +0000
@@ -11,6 +11,7 @@
 import de.intevation.flys.artifacts.FLYSArtifact;
 import de.intevation.flys.artifacts.WINFOArtifact;
 import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.ReportFacet;
 import de.intevation.flys.artifacts.model.WaterlevelFacet;
 import de.intevation.flys.artifacts.model.WQKms;
 
@@ -77,6 +78,10 @@
             facets.add(csv);
         }
 
+        if (res.getReport().hasProblems()) {
+            facets.add(new ReportFacet());
+        }
+
         return res;
     }
 }

http://dive4elements.wald.intevation.org