changeset 6317:294742a49c1c

Add gauge validity information to dischargecurve exporter
author Andre Heinecke <aheinecke@intevation.de>
date Wed, 12 Jun 2013 18:09:18 +0200
parents a52a038a6a09
children bc09f8fff694
files artifacts/doc/conf/jasper/computed-discharge.jasper artifacts/doc/conf/jasper/computed-discharge_en.jasper artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsJRDataSource.java artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java
diffstat 4 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
Binary file artifacts/doc/conf/jasper/computed-discharge.jasper has changed
Binary file artifacts/doc/conf/jasper/computed-discharge_en.jasper has changed
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsJRDataSource.java	Wed Jun 12 18:13:47 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsJRDataSource.java	Wed Jun 12 18:09:18 2013 +0200
@@ -102,6 +102,9 @@
         else if ("wUnit".equals(fieldName)) {
             value = metaData.get("wUnit");
         }
+        else if ("valid_since".equals(fieldName)) {
+            value = metaData.get("valid_since");
+        }
         else if ("km".equals(fieldName)) {
             value = data.get(index)[0];
         }
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Wed Jun 12 18:13:47 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Wed Jun 12 18:09:18 2013 +0200
@@ -80,7 +80,7 @@
     protected String gaugeName;
     protected double gaugeDatum;
     protected boolean isCalculated;
-
+    protected Date validSince;
 
     public void init(Document request, OutputStream out, CallContext context) {
         logger.debug("ComputedDischargeCurveExporter.init");
@@ -138,8 +138,11 @@
                 }
                 data = newData; // All hail the garbage collector
                 wUnit = "cm";
+
+                validSince = gauge.fetchMasterDischargeTable().getTimeInterval().getStartTime();
             } else {
                 gaugeName = "";
+                validSince = null;
                 gaugeDatum = Double.NaN;
             }
         }
@@ -275,11 +278,13 @@
         // When w is in meter we are not at a gauge so our values
         // must be calculated
         if (isCalculated || wUnit.equals("m")) {
+            source.addMetaData("valid_since", "");
             source.addMetaData("calculation", Resources.getMsg(
                                                 locale,
                                                 PDF_HEADER_CALC_MODE,
                                                 "Computed Discharge"));
         } else {
+            source.addMetaData("valid_since", validSince == null ? "" : df.format(validSince));
             source.addMetaData("calculation", Resources.getMsg(
                                                 locale,
                                                 PDF_HEADER_MODE,

http://dive4elements.wald.intevation.org