annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java @ 3879:ac49675f9335

Add the gauge station to the GaugeOverviewInfoService xml response flys-artifacts/trunk@5516 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Bjoern Ricks <bjoern.ricks@intevation.de>
date Wed, 19 Sep 2012 08:45:51 +0000
parents b3fdb5a12613
children cfed96c53e9a
rev   line source
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.services;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
2
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
3 import java.math.BigDecimal;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
4 import java.util.List;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
5
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
7
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
8 import org.w3c.dom.Document;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
9 import org.w3c.dom.Element;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
10
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
11 import de.intevation.artifacts.CallMeta;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
12 import de.intevation.artifacts.GlobalContext;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
13 import de.intevation.artifacts.common.ArtifactNamespaceContext;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
14 import de.intevation.artifacts.common.utils.XMLUtils;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
15
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
16 import de.intevation.flys.artifacts.model.RiverFactory;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
17 import de.intevation.flys.model.Gauge;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
18 import de.intevation.flys.model.MinMaxWQ;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
19 import de.intevation.flys.model.Range;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
20 import de.intevation.flys.model.River;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
21
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
22 /**
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
23 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a>
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
24 */
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
25 public class GaugeOverviewInfoService extends FLYSService {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
26
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
27 private static final Logger logger = Logger.getLogger(
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
28 GaugeOverviewInfoService.class);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
29
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
30 public static final String RIVER_XPATH = "/art:river/text()";
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
31
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
32 @Override
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
33 public Document doProcess(
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
34 Document data,
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
35 GlobalContext globalContext,
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
36 CallMeta callMeta
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
37 ) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
38 logger.debug("GaugeOverviewInfoService.process");
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
39
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
40 String riverstr = XMLUtils.xpathString(
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
41 data, RIVER_XPATH, ArtifactNamespaceContext.INSTANCE);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
42
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
43 River river = RiverFactory.getRiver(riverstr);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
44
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
45 Document result = XMLUtils.newDocument();
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
46
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
47 if (river == null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
48 logger.warn("No river with name " + riverstr + " found.");
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
49 return result;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
50 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
51
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
52 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator(
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
53 result,
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
54 ArtifactNamespaceContext.NAMESPACE_URI,
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
55 ArtifactNamespaceContext.NAMESPACE_PREFIX);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
56
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
57 Element go = ec.create("gauge-info");
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
58
3753
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
59 double[] minmax = river.determineMinMaxDistance();
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
60 double[] minmaxq = river.determineMinMaxQ();
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
61
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
62 Element r = ec.create("river");
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
63 ec.addAttr(r, "name", river.getName(), true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
64 ec.addAttr(r, "start", Double.toString(minmax[0]), true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
65 ec.addAttr(r, "end", Double.toString(minmax[1]), true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
66 ec.addAttr(r, "wstunit", river.getWstUnit().getName(), true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
67 ec.addAttr(r, "kmup", Boolean.toString(river.getKmUp()), true);
3753
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
68 ec.addAttr(r, "minq", Double.toString(minmaxq[0]), true);
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
69 ec.addAttr(r, "maxq", Double.toString(minmaxq[1]), true);
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
70
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
71 Element egs = ec.create("gauges");
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
72
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
73 List<Gauge> gauges = river.getGauges();
3748
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
74
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
75 if (logger.isDebugEnabled()) {
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
76 logger.debug("Loaded gauges: " + gauges);
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
77 }
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
78
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
79 for (Gauge gauge: river.getGauges()) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
80 Element eg = ec.create("gauge");
3748
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
81
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
82 String name = gauge.getName();
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
83 if (name != null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
84 ec.addAttr(eg, "name", gauge.getName(), true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
85 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
86
3748
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
87 String aeo = getGaugeValue(gauge.getAeo());
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
88 if (aeo != null) {
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
89 ec.addAttr(eg, "aeo", aeo, true);
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
90 }
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
91
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
92 String datum = getGaugeValue(gauge.getDatum());
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
93 if (datum != null) {
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
94 ec.addAttr(eg, "datum", datum, true);
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
95 }
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
96
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
97 Range range = gauge.getRange();
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
98 if (range != null) {
3753
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
99 BigDecimal a = range.getA();
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
100 if (a != null) {
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
101 double min = a.doubleValue();
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
102 ec.addAttr(eg, "start", Double.toString(min), true);
b3fdb5a12613 Add also min and max q values to the river info.
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3748
diff changeset
103 }
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
104
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
105 BigDecimal b = range.getB();
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
106 if (b != null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
107 double max = range.getB().doubleValue();
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
108 ec.addAttr(eg, "end", Double.toString(max), true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
109 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
110 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
111 MinMaxWQ minmaxwq = gauge.fetchMaxMinWQ();
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
112 String minw = getGaugeValue(minmaxwq.getMinW());
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
113 String maxw = getGaugeValue(minmaxwq.getMaxW());
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
114 String minq = getGaugeValue(minmaxwq.getMinQ());
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
115 String maxq = getGaugeValue(minmaxwq.getMaxQ());
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
116
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
117 if (minw != null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
118 ec.addAttr(eg, "minw", minw, true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
119 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
120 if (maxw != null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
121 ec.addAttr(eg, "maxw", maxw, true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
122 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
123 if (minq != null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
124 ec.addAttr(eg, "minq", minq, true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
125 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
126 if (maxq != null) {
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
127 ec.addAttr(eg, "maxq", maxq, true);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
128 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
129
3879
ac49675f9335 Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3753
diff changeset
130 String station = getGaugeValue(gauge.getStation());
ac49675f9335 Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3753
diff changeset
131 if (station != null) {
ac49675f9335 Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3753
diff changeset
132 ec.addAttr(eg, "station", station, true);
ac49675f9335 Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3753
diff changeset
133 }
ac49675f9335 Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3753
diff changeset
134
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
135 egs.appendChild(eg);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
136 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
137
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
138 go.appendChild(r);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
139 go.appendChild(egs);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
140 result.appendChild(go);
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
141
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
142 return result;
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
143 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
144
3747
a33df17ac9bb Use getGaugeValue method also for aeo and datum
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3739
diff changeset
145 /**
a33df17ac9bb Use getGaugeValue method also for aeo and datum
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3739
diff changeset
146 * Returns a Double from a BigDecimal value or null if value is null
a33df17ac9bb Use getGaugeValue method also for aeo and datum
Bjoern Ricks <bjoern.ricks@intevation.de>
parents: 3739
diff changeset
147 */
3748
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
148 private static String getGaugeValue(BigDecimal value) {
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
149 return value != null
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
150 ? Double.toString(value.doubleValue())
99f80469ba2b Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3747
diff changeset
151 : "";
3739
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
152 }
0edc05642fa4 Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff changeset
153 }

http://dive4elements.wald.intevation.org