# HG changeset patch # User Bjoern Ricks # Date 1348236761 0 # Node ID 8e169e4e1b570f1f3e24a15125c9494caed8597e # Parent 44c1beb78ad1e19b488ee9aaae271e311a9f6321 Add the official gauge number to the GaugeInfo class flys-client/trunk@5559 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 44c1beb78ad1 -r 8e169e4e1b57 flys-client/ChangeLog --- 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 + + * 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 * src/main/java/de/intevation/flys/client/client/ui/GaugeTree.java, diff -r 44c1beb78ad1 -r 8e169e4e1b57 flys-client/src/main/java/de/intevation/flys/client/server/GaugeOverviewInfoServiceImpl.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; + } + } } diff -r 44c1beb78ad1 -r 8e169e4e1b57 flys-client/src/main/java/de/intevation/flys/client/shared/model/DefaultGaugeInfo.java --- 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; + } } diff -r 44c1beb78ad1 -r 8e169e4e1b57 flys-client/src/main/java/de/intevation/flys/client/shared/model/GaugeInfo.java --- 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(); }