# HG changeset patch # User Andre Heinecke # Date 1371053358 -7200 # Node ID 294742a49c1cb4271616b9b2b013a34dc38af44d # Parent a52a038a6a09faabb5b4726ccf2f6c4452f9cc73 Add gauge validity information to dischargecurve exporter diff -r a52a038a6a09 -r 294742a49c1c artifacts/doc/conf/jasper/computed-discharge.jasper Binary file artifacts/doc/conf/jasper/computed-discharge.jasper has changed diff -r a52a038a6a09 -r 294742a49c1c artifacts/doc/conf/jasper/computed-discharge_en.jasper Binary file artifacts/doc/conf/jasper/computed-discharge_en.jasper has changed diff -r a52a038a6a09 -r 294742a49c1c artifacts/src/main/java/org/dive4elements/river/artifacts/model/WKmsJRDataSource.java --- 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]; } diff -r a52a038a6a09 -r 294742a49c1c artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java --- 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,