Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/RiverInfoServiceImpl.java @ 9497:d6d5ca6d4af0
Enabled logging of saml-group-name in log-ing logfile.
Some cleanup/refaktoring.
author | gernotbelger |
---|---|
date | Thu, 27 Sep 2018 17:40:39 +0200 |
parents | 5e38e2924c07 |
children | 0a5239a1e46e |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.server; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
11 import java.text.DateFormat; |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
12 import java.text.ParseException; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import java.util.ArrayList; |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
14 import java.util.Date; |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
15 import java.util.List; |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
16 import java.util.Locale; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 import javax.xml.xpath.XPathConstants; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 import org.apache.log4j.Logger; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 import org.w3c.dom.Document; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 import org.w3c.dom.Element; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
23 import org.w3c.dom.NodeList; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
25 import org.dive4elements.artifacts.common.ArtifactNamespaceContext; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
26 import org.dive4elements.artifacts.common.utils.XMLUtils; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
27 import org.dive4elements.artifacts.httpclient.exceptions.ConnectionException; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.artifacts.httpclient.http.HttpClient; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
29 import org.dive4elements.artifacts.httpclient.http.HttpClientImpl; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
31 import org.dive4elements.river.client.client.services.RiverInfoService; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
32 import org.dive4elements.river.client.shared.exceptions.ServerException; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
33 import org.dive4elements.river.client.shared.model.DefaultGaugeInfo; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
34 import org.dive4elements.river.client.shared.model.DefaultMeasurementStation; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
35 import org.dive4elements.river.client.shared.model.DefaultRiverInfo; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
36 import org.dive4elements.river.client.shared.model.GaugeInfo; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
37 import org.dive4elements.river.client.shared.model.MeasurementStation; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
38 import org.dive4elements.river.client.shared.model.RiverInfo; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
40 |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 /** |
4436
9fca4d60fb7c
Reintroduce wrongly outbacked changes (rev 4418-4425).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4433
diff
changeset
|
42 * GWT Service to serve the gauge and measurement station info |
9fca4d60fb7c
Reintroduce wrongly outbacked changes (rev 4418-4425).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4433
diff
changeset
|
43 * |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 * @author <a href="mailto:bjoern.ricks@intevation.de">Björn Ricks</a> |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
45 */ |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
46 public class RiverInfoServiceImpl |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 extends RemoteServiceServlet |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
48 implements RiverInfoService |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
49 { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
50 private static final Logger log = |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
51 Logger.getLogger(RiverInfoServiceImpl.class); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
52 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
53 public static final String ERROR_NO_RIVER_INFO_FOUND = |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
54 "error_no_riverinfo_found"; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
55 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
56 private static final String XPATH_RIVER = |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
57 "/art:river-info/art:river"; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
58 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
59 private static final String XPATH_STATIONS = |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
60 "/art:river-info/art:measurement-stations/art:measurement-station"; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
61 |
8856 | 62 private static final String XPATH_GAUGES = |
63 "/art:river-info/art:gauges/art:gauge"; | |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
64 |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
65 public static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
66 DateFormat.SHORT, Locale.GERMANY); |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
67 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
68 public RiverInfo getGauges(String river) throws ServerException { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
69 log.info("RiverInfoServiceImpl.getRiverInfo"); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
70 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
71 String url = getServletContext().getInitParameter("server-url"); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 Document doc = XMLUtils.newDocument(); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 doc, |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 ArtifactNamespaceContext.NAMESPACE_URI, |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
79 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
80 Element riverele = ec.create("river"); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
81 riverele.setTextContent(river); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
82 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
83 doc.appendChild(riverele); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
84 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
85 HttpClient client = new HttpClientImpl(url); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
86 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
87 try { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
88 Document result = client.callService(url, "gaugeoverviewinfo", doc); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
89 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
90 DefaultRiverInfo riverinfo = getRiverInfo(result); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
91 List<GaugeInfo>gauges = createGauges(result, riverinfo.getName(), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
92 riverinfo.isKmUp(), riverinfo.getWstUnit()); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
93 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
94 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
95 riverinfo.setGauges(gauges); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
96 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
97 log.debug("Finished RiverInfoService.getGauges."); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
98 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
99 return riverinfo; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
100 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
101 catch (ConnectionException ce) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
102 log.error(ce, ce); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
103 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
104 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
105 log.warn("No gauge found"); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
106 throw new ServerException(ERROR_NO_RIVER_INFO_FOUND); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
107 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
108 |
8856 | 109 public RiverInfo getMeasurementStations(String river) |
110 throws ServerException { | |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
111 log.info("RiverInfoServiceImpl.getMeasurementStations"); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
112 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
113 String url = getServletContext().getInitParameter("server-url"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
114 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
115 Document doc = XMLUtils.newDocument(); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
116 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
117 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
118 doc, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
119 ArtifactNamespaceContext.NAMESPACE_URI, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
120 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
121 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
122 Element riverele = ec.create("river"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
123 riverele.setTextContent(river); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
124 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
125 doc.appendChild(riverele); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
126 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
127 HttpClient client = new HttpClientImpl(url); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
128 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
129 try { |
8856 | 130 Document result = client.callService( |
131 url, "measurementstationinfo", doc); | |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
132 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
133 DefaultRiverInfo riverinfo = getRiverInfo(result); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
134 List<MeasurementStation> mstations = createMeasurementStations( |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8203
diff
changeset
|
135 result, riverinfo.getName()); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
136 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
137 riverinfo.setMeasurementStations(mstations); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
138 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
139 log.debug("Finished MeasurementStationInfoService."); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
140 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
141 return riverinfo; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
142 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
143 catch (ConnectionException ce) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
144 log.error(ce, ce); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
145 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
146 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
147 log.warn("No measurement station found"); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
148 throw new ServerException(ERROR_NO_RIVER_INFO_FOUND); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
149 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
150 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
151 /** |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
152 * Avoids NullPointerException when parsing double value |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
153 */ |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
154 private Double parseDouble(String value) { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
155 if (value == null || value.isEmpty()) { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
156 return null; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
157 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
158 try { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
159 return Double.valueOf(value); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
160 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
161 catch(NumberFormatException e) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
162 log.error(e, e); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
163 return null; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
164 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
165 } |
3843
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
166 |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
167 private Long parseLong(String value) { |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
168 if (value == null || value.isEmpty()) { |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
169 return null; |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
170 } |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
171 try { |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
172 return Long.valueOf(value); |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
173 } |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
174 catch(NumberFormatException e) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
175 log.error(e, e); |
3843
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
176 return null; |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
177 } |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
178 } |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
179 |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
180 private Integer parseInteger(String value) { |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
181 if (value == null || value.isEmpty()) { |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
182 return null; |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
183 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
184 try { |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
185 return Integer.valueOf(value); |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
186 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
187 catch(NumberFormatException e) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
188 log.error(e, e); |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
189 return null; |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
190 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
191 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
192 |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
193 private Date parseDate(String value) { |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
194 if (value == null || value.isEmpty()) { |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
195 return null; |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
196 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
197 try { |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
198 return DATE_FORMAT.parse(value); |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
199 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
200 catch(ParseException e) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
201 log.error(e, e); |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
202 return null; |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
203 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
204 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
205 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
206 private List<MeasurementStation> createMeasurementStations( |
8412
17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
Tom Gottfried <tom@intevation.de>
parents:
8203
diff
changeset
|
207 Document result, String rivername) { |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
208 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
209 NodeList stationnodes = (NodeList) XMLUtils.xpath( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
210 result, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
211 XPATH_STATIONS, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
212 XPathConstants.NODESET, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
213 ArtifactNamespaceContext.INSTANCE); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
214 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
215 int num = stationnodes == null ? 0 : stationnodes.getLength(); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
216 |
8856 | 217 ArrayList<MeasurementStation> mstations = |
218 new ArrayList<MeasurementStation>(num); | |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
219 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
220 if (num == 0) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
221 log.warn("No measurement station found."); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
222 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
223 else { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
224 log.debug("Found " + num + " measurement stations."); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
225 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
226 for (int i = 0; i < num; i++) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
227 Element stationele = (Element)stationnodes.item(i); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
228 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
229 String mname = stationele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
230 ArtifactNamespaceContext.NAMESPACE_URI, "name"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
231 String mstart = stationele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
232 ArtifactNamespaceContext.NAMESPACE_URI, "start"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
233 String mend = stationele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
234 ArtifactNamespaceContext.NAMESPACE_URI, "end"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
235 String mtype = stationele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
236 ArtifactNamespaceContext.NAMESPACE_URI, "type"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
237 String riverside = stationele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
238 ArtifactNamespaceContext.NAMESPACE_URI, "riverside"); |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
239 String mid = stationele.getAttributeNS( |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
240 ArtifactNamespaceContext.NAMESPACE_URI, "id"); |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
241 String moperator = stationele.getAttributeNS( |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
242 ArtifactNamespaceContext.NAMESPACE_URI, "operator"); |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
243 String mstarttime = stationele.getAttributeNS( |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
244 ArtifactNamespaceContext.NAMESPACE_URI, "starttime"); |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
245 String mstoptime = stationele.getAttributeNS( |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
246 ArtifactNamespaceContext.NAMESPACE_URI, "stoptime"); |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
8412
diff
changeset
|
247 String mcomment = stationele.getAttributeNS( |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
8412
diff
changeset
|
248 ArtifactNamespaceContext.NAMESPACE_URI, "comment"); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
249 |
4326
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
250 String gaugename = null; |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
251 |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
252 Element gaugeele = (Element)stationele.getFirstChild(); |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
253 if (gaugeele != null) { |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
254 gaugename = gaugeele.getAttributeNS( |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
255 ArtifactNamespaceContext.NAMESPACE_URI, "name"); |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
256 } |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
257 |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
258 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
259 log.debug("Found measurement station with name " + mname); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
260 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
261 MeasurementStation station = new DefaultMeasurementStation( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
262 rivername, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
263 mname, |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
264 parseInteger(mid), |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
265 parseDouble(mstart), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
266 parseDouble(mend), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
267 riverside, |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
268 mtype, |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
269 moperator, |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
270 parseDate(mstarttime), |
4326
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
271 parseDate(mstoptime), |
8417
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
8412
diff
changeset
|
272 gaugename, |
71144e25a6c9
Add comment to measurement stations info.
Tom Gottfried <tom@intevation.de>
parents:
8412
diff
changeset
|
273 mcomment |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
274 ); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
275 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
276 mstations.add(station); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
277 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
278 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
279 return mstations; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
280 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
281 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
282 private List<GaugeInfo> createGauges( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
283 Document result, String rivername, Boolean kmup, String rwstunit) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
284 NodeList gaugenodes = (NodeList) XMLUtils.xpath( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
285 result, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
286 XPATH_GAUGES, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
287 XPathConstants.NODESET, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
288 ArtifactNamespaceContext.INSTANCE); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
289 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
290 int num = gaugenodes == null ? 0 : gaugenodes.getLength(); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
291 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
292 ArrayList<GaugeInfo> gauges = new ArrayList<GaugeInfo>(num); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
293 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
294 if (num == 0) { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
295 log.warn("No gauge info found."); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
296 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
297 else { |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
298 log.debug("Found " + num + " gauges."); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
299 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
300 for (int i = 0; i < num; i++) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
301 Element gaugeele = (Element)gaugenodes.item(i); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
302 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
303 String gname = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
304 ArtifactNamespaceContext.NAMESPACE_URI, "name"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
305 String gstart = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
306 ArtifactNamespaceContext.NAMESPACE_URI, "start"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
307 String gend = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
308 ArtifactNamespaceContext.NAMESPACE_URI, "end"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
309 String gdatum = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
310 ArtifactNamespaceContext.NAMESPACE_URI, "datum"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
311 String gaeo = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
312 ArtifactNamespaceContext.NAMESPACE_URI, "aeo"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
313 String gminq = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
314 ArtifactNamespaceContext.NAMESPACE_URI, "minq"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
315 String gminw = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
316 ArtifactNamespaceContext.NAMESPACE_URI, "minw"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
317 String gmaxq = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
318 ArtifactNamespaceContext.NAMESPACE_URI, "maxq"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
319 String gmaxw = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
320 ArtifactNamespaceContext.NAMESPACE_URI, "maxw"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
321 String gstation = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
322 ArtifactNamespaceContext.NAMESPACE_URI, "station"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
323 String gofficial = gaugeele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
324 ArtifactNamespaceContext.NAMESPACE_URI, "official"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
325 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
326 log.debug("Found gauge with name " + gname); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
327 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
328 GaugeInfo gaugeinfo = new DefaultGaugeInfo( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
329 rivername, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
330 gname, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
331 kmup, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
332 parseDouble(gstation), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
333 parseDouble(gstart), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
334 parseDouble(gend), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
335 parseDouble(gdatum), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
336 parseDouble(gaeo), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
337 parseDouble(gminq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
338 parseDouble(gmaxq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
339 parseDouble(gminw), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
340 parseDouble(gmaxw), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
341 rwstunit, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
342 parseLong(gofficial) |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
343 ); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
344 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
345 gauges.add(gaugeinfo); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
346 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
347 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
348 return gauges; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
349 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
350 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
351 private DefaultRiverInfo getRiverInfo(Document result) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
352 Element riverresp = (Element) XMLUtils.xpath( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
353 result, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
354 XPATH_RIVER, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
355 XPathConstants.NODE, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
356 ArtifactNamespaceContext.INSTANCE); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
357 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
358 String rname = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
359 ArtifactNamespaceContext.NAMESPACE_URI, "name"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
360 String rkmup = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
361 ArtifactNamespaceContext.NAMESPACE_URI, "kmup"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
362 String rstart = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
363 ArtifactNamespaceContext.NAMESPACE_URI, "start"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
364 String rend = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
365 ArtifactNamespaceContext.NAMESPACE_URI, "end"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
366 String rwstunit = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
367 ArtifactNamespaceContext.NAMESPACE_URI, "wstunit"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
368 String rminq = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
369 ArtifactNamespaceContext.NAMESPACE_URI, "minq"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
370 String rmaxq = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
371 ArtifactNamespaceContext.NAMESPACE_URI, "maxq"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
372 String rofficial = riverresp.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
373 ArtifactNamespaceContext.NAMESPACE_URI, "official"); |
7761
350a7cf09fbc
Load modules with supported rivers and rivers with model_uuid.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
374 String rmuuid = riverresp.getAttributeNS( |
350a7cf09fbc
Load modules with supported rivers and rivers with model_uuid.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
375 ArtifactNamespaceContext.NAMESPACE_URI, "model-uuid"); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
376 |
8203
238fc722f87a
sed 's/logger/log/g' src/**/*.java
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7761
diff
changeset
|
377 log.debug("River is " + rname); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
378 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
379 boolean kmup = rkmup.equalsIgnoreCase("true"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
380 DefaultRiverInfo riverinfo = new DefaultRiverInfo( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
381 rname, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
382 kmup, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
383 parseDouble(rstart), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
384 parseDouble(rend), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
385 rwstunit, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
386 parseDouble(rminq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
387 parseDouble(rmaxq), |
7761
350a7cf09fbc
Load modules with supported rivers and rivers with model_uuid.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
388 parseLong(rofficial), |
350a7cf09fbc
Load modules with supported rivers and rivers with model_uuid.
Raimund Renkert <rrenkert@intevation.de>
parents:
5993
diff
changeset
|
389 rmuuid |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
390 ); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
391 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
392 return riverinfo; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
393 } |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
394 } |