Mercurial > dive4elements > river
changeset 6851:4937dab5ff7a
(issue1391): Build the current discarge curve name as requested
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 16 Aug 2013 11:30:07 +0200 |
parents | 089b48c3131e |
children | 9e81ed565095 |
files | artifacts/doc/conf/meta-data.xml artifacts/src/main/java/org/dive4elements/river/artifacts/states/GaugeDischargeState.java |
diffstat | 2 files changed, 19 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- 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>
--- 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(