changeset 4217:08b6458909a9

The service 'DischargeTablesOverview' now accepts the official number of a gauge, too. The service first tries to parse the official number (long value). If it fails, it it assumed that the the name of the gauge is specified.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 23 Oct 2012 11:58:47 +0200
parents a04862abce42
children 6ae99d996f79
files flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java	Tue Oct 23 10:50:48 2012 +0200
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java	Tue Oct 23 11:58:47 2012 +0200
@@ -173,6 +173,16 @@
 
         if (gauges.getLength() > 0) {
             String name = ((Element) gauges.item(0)).getAttribute("name");
+
+            try {
+                long officialNumber = Long.valueOf(name);
+                return Gauge.getGaugeByOfficialNumber(officialNumber);
+            }
+            catch (NumberFormatException nfe) {
+                // it seems, that the client uses the name of the gauge instead
+                // of its official number
+            }
+
             if (name != null && name.length() > 0) {
                 return GaugesFactory.getGauge(name);
             }

http://dive4elements.wald.intevation.org