Mercurial > dive4elements > river
comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/MeasurementStationInfoService.java @ 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 |
parents | 31c017420502 |
children | 4980659b2f22 |
comparison
equal
deleted
inserted
replaced
4288:b6f2ecaa6704 | 4289:3fffd7d5d67d |
---|---|
1 package de.intevation.flys.artifacts.services; | 1 package de.intevation.flys.artifacts.services; |
2 | 2 |
3 import java.math.BigDecimal; | 3 import java.math.BigDecimal; |
4 import java.text.DateFormat; | |
5 import java.util.Date; | |
4 import java.util.List; | 6 import java.util.List; |
7 import java.util.Locale; | |
5 | 8 |
6 import org.apache.log4j.Logger; | 9 import org.apache.log4j.Logger; |
7 | 10 |
8 import org.w3c.dom.Document; | 11 import org.w3c.dom.Document; |
9 import org.w3c.dom.Element; | 12 import org.w3c.dom.Element; |
15 | 18 |
16 import de.intevation.flys.artifacts.model.RiverFactory; | 19 import de.intevation.flys.artifacts.model.RiverFactory; |
17 import de.intevation.flys.model.MeasurementStation; | 20 import de.intevation.flys.model.MeasurementStation; |
18 import de.intevation.flys.model.Range; | 21 import de.intevation.flys.model.Range; |
19 import de.intevation.flys.model.River; | 22 import de.intevation.flys.model.River; |
23 import de.intevation.flys.model.TimeInterval; | |
20 | 24 |
21 /** | 25 /** |
22 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> | 26 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> |
23 */ | 27 */ |
24 public class MeasurementStationInfoService extends RiverInfoService { | 28 public class MeasurementStationInfoService extends RiverInfoService { |
25 | 29 |
26 private static final Logger logger = Logger.getLogger( | 30 private static final Logger logger = Logger.getLogger( |
27 MeasurementStationInfoService.class); | 31 MeasurementStationInfoService.class); |
32 | |
33 public static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( | |
34 DateFormat.SHORT, Locale.GERMANY); | |
28 | 35 |
29 @Override | 36 @Override |
30 public Document doProcess( | 37 public Document doProcess( |
31 Document data, | 38 Document data, |
32 GlobalContext globalContext, | 39 GlobalContext globalContext, |
86 String moperator = mstation.getOperator(); | 93 String moperator = mstation.getOperator(); |
87 if (moperator != null) { | 94 if (moperator != null) { |
88 ec.addAttr(eg, "operator", moperator, true); | 95 ec.addAttr(eg, "operator", moperator, true); |
89 } | 96 } |
90 | 97 |
98 TimeInterval tinterval = mstation.getObservationTimerange(); | |
99 if (tinterval != null) { | |
100 Date tstart = tinterval.getStartTime(); | |
101 if (tstart != null) { | |
102 ec.addAttr(eg, "starttime", DATE_FORMAT.format(tstart), | |
103 true); | |
104 } | |
105 Date tstop = tinterval.getStopTime(); | |
106 if (tstop != null) { | |
107 ec.addAttr(eg, "stoptime", DATE_FORMAT.format(tstop), | |
108 true); | |
109 } | |
110 } | |
111 | |
91 egs.appendChild(eg); | 112 egs.appendChild(eg); |
92 } | 113 } |
93 | 114 |
94 this.riverele.appendChild(egs); | 115 this.riverele.appendChild(egs); |
95 | 116 |