# HG changeset patch # User Sascha L. Teichmann # Date 1308579260 0 # Node ID 69c8541edcc71ed8168fd6f941805e6db071879b # Parent cded0924193d48e8c2e4c547cf4a94411d86a23f Generate report facets if there are problems with the calculations. flys-artifacts/trunk@2167 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r cded0924193d -r 69c8541edcc7 flys-artifacts/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/exports/ReportGenerator.java: diff -r cded0924193d -r 69c8541edcc7 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/ReportFacet.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 : diff -r cded0924193d -r 69c8541edcc7 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/ComputedDischargeCurveState.java --- 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; diff -r cded0924193d -r 69c8541edcc7 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DischargeLongitudinalSection.java --- 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 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; } } diff -r cded0924193d -r 69c8541edcc7 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/DurationCurveState.java --- 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; diff -r cded0924193d -r 69c8541edcc7 flys-artifacts/src/main/java/de/intevation/flys/artifacts/states/WaterlevelState.java --- 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; } }