changeset 4289:3fffd7d5d67d

Add observation TimeInteval to the artifact MeasurementStationInfoService
author Björn Ricks <bjoern.ricks@intevation.de>
date Mon, 29 Oct 2012 10:00:17 +0100 (2012-10-29)
parents b6f2ecaa6704
children 6aa8cd8da224
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java
diffstat 1 files changed, 21 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java	Mon Oct 29 09:56:55 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java	Mon Oct 29 10:00:17 2012 +0100
@@ -1,7 +1,10 @@
 package de.intevation.flys.artifacts.services;
 
 import java.math.BigDecimal;
+import java.text.DateFormat;
+import java.util.Date;
 import java.util.List;
+import java.util.Locale;
 
 import org.apache.log4j.Logger;
 
@@ -17,6 +20,7 @@
 import de.intevation.flys.model.MeasurementStation;
 import de.intevation.flys.model.Range;
 import de.intevation.flys.model.River;
+import de.intevation.flys.model.TimeInterval;
 
 /**
  * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
@@ -26,6 +30,9 @@
     private static final Logger logger = Logger.getLogger(
             MeasurementStationInfoService.class);
 
+    public static final DateFormat DATE_FORMAT = DateFormat.getDateInstance(
+        DateFormat.SHORT, Locale.GERMANY);
+
     @Override
     public Document doProcess(
         Document      data,
@@ -88,6 +95,20 @@
                 ec.addAttr(eg, "operator", moperator, true);
             }
 
+            TimeInterval tinterval = mstation.getObservationTimerange();
+            if (tinterval != null) {
+                Date tstart = tinterval.getStartTime();
+                if (tstart != null) {
+                    ec.addAttr(eg, "starttime", DATE_FORMAT.format(tstart),
+                            true);
+                }
+                Date tstop = tinterval.getStopTime();
+                if (tstop != null) {
+                    ec.addAttr(eg, "stoptime", DATE_FORMAT.format(tstop),
+                            true);
+                }
+            }
+
             egs.appendChild(eg);
         }
 

http://dive4elements.wald.intevation.org