Mercurial > dive4elements > river
diff 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 |
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java Fri Sep 21 13:44:56 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java Fri Sep 21 14:12:41 2012 +0000 @@ -129,6 +129,8 @@ ArtifactNamespaceContext.NAMESPACE_URI, "station"); String ginfourl = riverresp.getAttributeNS( ArtifactNamespaceContext.NAMESPACE_URI, "info-url"); + String gofficial = riverresp.getAttributeNS( + ArtifactNamespaceContext.NAMESPACE_URI, "official"); logger.debug("Found gauge with name " + gname); @@ -145,7 +147,8 @@ parseDouble(gminw), parseDouble(gmaxw), rwstunit, - ginfourl + ginfourl, + parseLong(gofficial) ); gauges.add(gaugeinfo); @@ -190,4 +193,17 @@ return null; } } + + private Long parseLong(String value) { + if (value == null || value.isEmpty()) { + return null; + } + try { + return Long.valueOf(value); + } + catch(NumberFormatException e) { + logger.error(e, e); + return null; + } + } }