[PATCH 4 of 4] (issue1391): Build the current discarge curve name as requested

Wald Commits scm-commit at wald.intevation.org
Mon Aug 19 10:06:31 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1376645407 -7200
# Node ID 4937dab5ff7a1b3d4e8c709b21a855c0c2dc74b3
# Parent  089b48c3131e0c72afe7bbf457f87758f5aed315
(issue1391): Build the current discarge curve name as requested

diff -r 089b48c3131e -r 4937dab5ff7a artifacts/doc/conf/meta-data.xml
--- a/artifacts/doc/conf/meta-data.xml	Fri Aug 16 10:43:44 2013 +0200
+++ b/artifacts/doc/conf/meta-data.xml	Fri Aug 16 11:30:07 2013 +0200
@@ -1341,13 +1341,10 @@
           OR g.official_number = ${refgauge})
         </dc:statement>
         <dc:if test="dc:has-result()">
-          <current_gauge>
-            <dc:for-each>
-              <gauge name="{$gauge_name} ({dc:date-format('dd.MM.yyyy', $start_time)})"
-                factory="gaugedischarge" target_out="{$out}"
-                ids="{$gauge_name}"/>
-            </dc:for-each>
-          </current_gauge>
+          <dc:for-each>
+            <current_gauge factory="gaugedischarge" target_out="{$out}"
+              ids="{$gauge_name}"/>
+          </dc:for-each>
         </dc:if>
       </dc:context>
     </dc:macro>
diff -r 089b48c3131e -r 4937dab5ff7a artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java	Fri Aug 16 10:43:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java	Fri Aug 16 11:30:07 2013 +0200
@@ -10,6 +10,8 @@
 
 import java.util.List;
 
+import java.text.DateFormat;
+
 import org.apache.log4j.Logger;
 
 import org.dive4elements.artifacts.CallMeta;
@@ -31,7 +33,10 @@
 import org.dive4elements.river.artifacts.resources.Resources;
 
 import org.dive4elements.river.model.Gauge;
+import org.dive4elements.river.model.DischargeTable;
+import org.dive4elements.river.model.TimeInterval;
 
+import org.dive4elements.river.utils.Formatter;
 
 /**
  * The only state for an GaugeDischargeState (River and km known).
@@ -64,9 +69,18 @@
         }
 
         Gauge gauge = artifact.getGauge();
+        DischargeTable mdt = gauge.fetchMasterDischargeTable();
+        TimeInterval validity = mdt.getTimeInterval();
+        DateFormat df = Formatter.getDateFormatter(meta, "dd.MM.yyyy");
+        String start = validity.getStartTime() != null ?
+                         df.format(validity.getStartTime()) : "Unknown";
+        String stop = validity.getStopTime() != null ?
+                          df.format(validity.getStopTime()) : "";
+
         Object[] args = new Object[] {
             gauge.getName(),
-            gauge.getStation()
+            start,
+            stop
         };
 
         String name = Resources.getMsg(


More information about the Dive4elements-commits mailing list