[Dive4elements-commits] [PATCH 3 of 4] Add observation TimeInteval to the artifact MeasurementStationInfoService

Wald Commits scm-commit at wald.intevation.org
Mon Oct 29 10:05:12 CET 2012


# HG changeset patch
# User Björn Ricks <bjoern.ricks at intevation.de>
# Date 1351501217 -3600
# Node ID 3fffd7d5d67d9a14b44e20baac264f075b08e896
# Parent  b6f2ecaa67044d326f1d70315ca2a923414995ec
Add observation TimeInteval to the artifact MeasurementStationInfoService

diff -r b6f2ecaa6704 -r 3fffd7d5d67d flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java
--- 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 at 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);
         }
 


More information about the Dive4elements-commits mailing list