Mercurial > dive4elements > river
comparison flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java @ 3843:8e169e4e1b57
Add the official gauge number to the GaugeInfo class
flys-client/trunk@5559 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Bjoern Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Fri, 21 Sep 2012 14:12:41 +0000 |
parents | 70976b711b7e |
children | f3b821735e39 |
comparison
equal
deleted
inserted
replaced
3842:44c1beb78ad1 | 3843:8e169e4e1b57 |
---|---|
127 ArtifactNamespaceContext.NAMESPACE_URI, "maxw"); | 127 ArtifactNamespaceContext.NAMESPACE_URI, "maxw"); |
128 String gstation = gaugeele.getAttributeNS( | 128 String gstation = gaugeele.getAttributeNS( |
129 ArtifactNamespaceContext.NAMESPACE_URI, "station"); | 129 ArtifactNamespaceContext.NAMESPACE_URI, "station"); |
130 String ginfourl = riverresp.getAttributeNS( | 130 String ginfourl = riverresp.getAttributeNS( |
131 ArtifactNamespaceContext.NAMESPACE_URI, "info-url"); | 131 ArtifactNamespaceContext.NAMESPACE_URI, "info-url"); |
132 String gofficial = riverresp.getAttributeNS( | |
133 ArtifactNamespaceContext.NAMESPACE_URI, "official"); | |
132 | 134 |
133 logger.debug("Found gauge with name " + gname); | 135 logger.debug("Found gauge with name " + gname); |
134 | 136 |
135 GaugeInfo gaugeinfo = new DefaultGaugeInfo( | 137 GaugeInfo gaugeinfo = new DefaultGaugeInfo( |
136 gname, | 138 gname, |
143 parseDouble(gminq), | 145 parseDouble(gminq), |
144 parseDouble(gmaxq), | 146 parseDouble(gmaxq), |
145 parseDouble(gminw), | 147 parseDouble(gminw), |
146 parseDouble(gmaxw), | 148 parseDouble(gmaxw), |
147 rwstunit, | 149 rwstunit, |
148 ginfourl | 150 ginfourl, |
151 parseLong(gofficial) | |
149 ); | 152 ); |
150 | 153 |
151 gauges.add(gaugeinfo); | 154 gauges.add(gaugeinfo); |
152 } | 155 } |
153 } | 156 } |
188 catch(NumberFormatException e) { | 191 catch(NumberFormatException e) { |
189 logger.error(e, e); | 192 logger.error(e, e); |
190 return null; | 193 return null; |
191 } | 194 } |
192 } | 195 } |
196 | |
197 private Long parseLong(String value) { | |
198 if (value == null || value.isEmpty()) { | |
199 return null; | |
200 } | |
201 try { | |
202 return Long.valueOf(value); | |
203 } | |
204 catch(NumberFormatException e) { | |
205 logger.error(e, e); | |
206 return null; | |
207 } | |
208 } | |
193 } | 209 } |