comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/services/DischargeTablesOverview.java @ 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 0674d89210f5
children 8138a90a674a
comparison
equal deleted inserted replaced
4216:a04862abce42 4217:08b6458909a9
171 protected Gauge extractGauge(Document data) { 171 protected Gauge extractGauge(Document data) {
172 NodeList gauges = data.getElementsByTagName("gauge"); 172 NodeList gauges = data.getElementsByTagName("gauge");
173 173
174 if (gauges.getLength() > 0) { 174 if (gauges.getLength() > 0) {
175 String name = ((Element) gauges.item(0)).getAttribute("name"); 175 String name = ((Element) gauges.item(0)).getAttribute("name");
176
177 try {
178 long officialNumber = Long.valueOf(name);
179 return Gauge.getGaugeByOfficialNumber(officialNumber);
180 }
181 catch (NumberFormatException nfe) {
182 // it seems, that the client uses the name of the gauge instead
183 // of its official number
184 }
185
176 if (name != null && name.length() > 0) { 186 if (name != null && name.length() > 0) {
177 return GaugesFactory.getGauge(name); 187 return GaugesFactory.getGauge(name);
178 } 188 }
179 } 189 }
180 190

http://dive4elements.wald.intevation.org