Mercurial > dive4elements > river
changeset 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 | 44c1beb78ad1 |
children | 7a096ec98596 |
files | flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java |
diffstat | 4 files changed, 52 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-client/ChangeLog Fri Sep 21 13:44:56 2012 +0000 +++ b/flys-client/ChangeLog Fri Sep 21 14:12:41 2012 +0000 @@ -1,3 +1,10 @@ +2012-09-21 Björn Ricks <bjoern.ricks@intevation.de> + + * src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.java, + src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java, + src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java: + Add the official gauge number to the GaugeInfo class. + 2012-09-21 Björn Ricks <bjoern.ricks@intevation.de> * src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java,
--- 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; + } + } }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java Fri Sep 21 13:44:56 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java Fri Sep 21 14:12:41 2012 +0000 @@ -18,6 +18,7 @@ private Double station; private String wstunit; private String infourl; + private Long officialnumber; public DefaultGaugeInfo() { } @@ -35,20 +36,22 @@ Double minw, Double maxw, String wstunit, - String infourl) + String infourl, + Long official) { - this.name = name; - this.station = station; - this.start = start; - this.end = end; - this.datum = datum; - this.aeo = aeo; - this.minq = minq; - this.maxq = maxq; - this.minw = minw; - this.maxw = maxw; - this.wstunit = wstunit; - this.infourl = infourl; + this.name = name; + this.station = station; + this.start = start; + this.end = end; + this.datum = datum; + this.aeo = aeo; + this.minq = minq; + this.maxq = maxq; + this.minw = minw; + this.maxw = maxw; + this.wstunit = wstunit; + this.infourl = infourl; + this.officialnumber = official; } /** * Returns the name of the gauge @@ -137,4 +140,11 @@ public String getInfoURL() { return this.infourl; } + + /** + * Returns the official number of this gauge + */ + public Long getOfficialNumber() { + return this.officialnumber; + } }
--- a/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java Fri Sep 21 13:44:56 2012 +0000 +++ b/flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java Fri Sep 21 14:12:41 2012 +0000 @@ -68,4 +68,9 @@ * Returns the URL where to find additional information about this gauge */ String getInfoURL(); + + /** + * Returns the official number of this gauge + */ + Long getOfficialNumber(); }