Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/GaugeOverviewInfoService.java @ 4191:df959841eefc
Add messages for the gauge location
Add messages for the gauge location used in GaugeDischargeCurveArtifact.
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 19 Oct 2012 13:33:26 +0200 |
parents | 5fce1908317f |
children | 5da024c2af62 |
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); |
3912
5fce1908317f
Remove info-url and add official number
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3896
diff
changeset
|
70 ec.addAttr(r, "official", Long.toString(river.getOfficialNumber()), |
5fce1908317f
Remove info-url and add official number
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3896
diff
changeset
|
71 true); |
3739
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 Element egs = ec.create("gauges"); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 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
|
76 |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
77 if (logger.isDebugEnabled()) { |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
78 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
|
79 } |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
80 |
3739
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
81 for (Gauge gauge: river.getGauges()) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
82 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
|
83 |
3739
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
84 String name = gauge.getName(); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
85 if (name != null) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
86 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
|
87 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
88 |
3748
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
89 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
|
90 if (aeo != null) { |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
91 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
|
92 } |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
93 |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
94 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
|
95 if (datum != null) { |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
96 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
|
97 } |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
98 |
3739
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
99 Range range = gauge.getRange(); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
100 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
|
101 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
|
102 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
|
103 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
|
104 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
|
105 } |
3739
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
106 |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
107 BigDecimal b = range.getB(); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
108 if (b != null) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
109 double max = range.getB().doubleValue(); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
110 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
|
111 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
112 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
113 MinMaxWQ minmaxwq = gauge.fetchMaxMinWQ(); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
114 String minw = getGaugeValue(minmaxwq.getMinW()); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
115 String maxw = getGaugeValue(minmaxwq.getMaxW()); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
116 String minq = getGaugeValue(minmaxwq.getMinQ()); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
117 String maxq = getGaugeValue(minmaxwq.getMaxQ()); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
118 |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
119 if (minw != null) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
120 ec.addAttr(eg, "minw", minw, true); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
121 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
122 if (maxw != null) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
123 ec.addAttr(eg, "maxw", maxw, true); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
124 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
125 if (minq != null) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
126 ec.addAttr(eg, "minq", minq, true); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
127 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
128 if (maxq != null) { |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
129 ec.addAttr(eg, "maxq", maxq, true); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
130 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
131 |
3879
ac49675f9335
Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3753
diff
changeset
|
132 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
|
133 if (station != null) { |
ac49675f9335
Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3753
diff
changeset
|
134 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
|
135 } |
ac49675f9335
Add the gauge station to the GaugeOverviewInfoService xml response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3753
diff
changeset
|
136 |
3896
82109cea32d2
Return also the official gauge number in a service response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3895
diff
changeset
|
137 Long official = gauge.getOfficialNumber(); |
82109cea32d2
Return also the official gauge number in a service response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3895
diff
changeset
|
138 if (official != null) { |
82109cea32d2
Return also the official gauge number in a service response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3895
diff
changeset
|
139 ec.addAttr(eg, "official", official.toString(), true); |
82109cea32d2
Return also the official gauge number in a service response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3895
diff
changeset
|
140 } |
82109cea32d2
Return also the official gauge number in a service response
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3895
diff
changeset
|
141 |
3739
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
142 egs.appendChild(eg); |
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 |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
145 go.appendChild(r); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
146 go.appendChild(egs); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
147 result.appendChild(go); |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
148 |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
149 return result; |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
150 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
151 |
3747
a33df17ac9bb
Use getGaugeValue method also for aeo and datum
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3739
diff
changeset
|
152 /** |
a33df17ac9bb
Use getGaugeValue method also for aeo and datum
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3739
diff
changeset
|
153 * 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
|
154 */ |
3748
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
155 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
|
156 return value != null |
99f80469ba2b
Pegelinfo: Made generation of datum and aeo NPE proof.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3747
diff
changeset
|
157 ? 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
|
158 : ""; |
3739
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
159 } |
0edc05642fa4
Add new artifact service for the gauge overview
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
160 } |