Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/RiverInfoServiceImpl.java @ 4910:a707ef048188
Insert CR and LF at the end of each line in CSV exports.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 30 Jan 2013 14:42:17 +0100 |
parents | 9fca4d60fb7c |
children |
rev | line source |
---|---|
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
2 |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
3 import java.text.DateFormat; |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
4 import java.text.ParseException; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
5 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
|
6 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
|
7 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
|
8 import java.util.Locale; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
9 import javax.xml.xpath.XPathConstants; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
10 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
11 import org.apache.log4j.Logger; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
12 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
13 import org.w3c.dom.Document; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
14 import org.w3c.dom.Element; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.NodeList; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
16 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
17 import de.intevation.artifacts.common.ArtifactNamespaceContext; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifacts.httpclient.http.HttpClient; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
22 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
23 import de.intevation.flys.client.client.services.RiverInfoService; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
24 import de.intevation.flys.client.shared.exceptions.ServerException; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
25 import de.intevation.flys.client.shared.model.DefaultGaugeInfo; |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
26 import de.intevation.flys.client.shared.model.DefaultMeasurementStation; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
27 import de.intevation.flys.client.shared.model.DefaultRiverInfo; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
28 import de.intevation.flys.client.shared.model.GaugeInfo; |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
29 import de.intevation.flys.client.shared.model.MeasurementStation; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
30 import de.intevation.flys.client.shared.model.RiverInfo; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
31 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
32 |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
33 /** |
4436
9fca4d60fb7c
Reintroduce wrongly outbacked changes (rev 4418-4425).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
4433
diff
changeset
|
34 * 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
|
35 * |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
36 * @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
|
37 */ |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
38 public class RiverInfoServiceImpl |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
39 extends RemoteServiceServlet |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
40 implements RiverInfoService |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
41 { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
42 private static final Logger logger = |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
43 Logger.getLogger(RiverInfoServiceImpl.class); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
44 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
45 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
|
46 "error_no_riverinfo_found"; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
47 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
48 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
|
49 "/art:river-info/art:river"; |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
50 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
51 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
|
52 "/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
|
53 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
54 private static final String XPATH_GAUGES = "/art:river-info/art:gauges/art:gauge"; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
55 |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
56 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
|
57 DateFormat.SHORT, Locale.GERMANY); |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
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 public RiverInfo getGauges(String river) throws ServerException { |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
60 logger.info("RiverInfoServiceImpl.getRiverInfo"); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
61 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
62 String url = getServletContext().getInitParameter("server-url"); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
63 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
64 Document doc = XMLUtils.newDocument(); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
65 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
66 XMLUtils.ElementCreator ec = new XMLUtils.ElementCreator( |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
67 doc, |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
68 ArtifactNamespaceContext.NAMESPACE_URI, |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
69 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
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 Element riverele = ec.create("river"); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
72 riverele.setTextContent(river); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
73 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
74 doc.appendChild(riverele); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
75 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
76 HttpClient client = new HttpClientImpl(url); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
77 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
78 try { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
79 Document result = client.callService(url, "gaugeoverviewinfo", doc); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
80 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
81 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
|
82 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
|
83 riverinfo.isKmUp(), riverinfo.getWstUnit()); |
3713
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 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
86 riverinfo.setGauges(gauges); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
87 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
88 logger.debug("Finished RiverInfoService.getGauges."); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
89 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
90 return riverinfo; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
91 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
92 catch (ConnectionException ce) { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
93 logger.error(ce, ce); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
94 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
95 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
96 logger.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
|
97 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
|
98 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
99 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
100 public RiverInfo getMeasurementStations(String river) throws ServerException { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
101 logger.info("RiverInfoServiceImpl.getMeasurementStations"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
102 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
103 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
|
104 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
105 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
|
106 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
107 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
|
108 doc, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
109 ArtifactNamespaceContext.NAMESPACE_URI, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
110 ArtifactNamespaceContext.NAMESPACE_PREFIX); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
111 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
112 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
|
113 riverele.setTextContent(river); |
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 doc.appendChild(riverele); |
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 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
|
118 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
119 try { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
120 Document result = client.callService(url, "measurementstationinfo", doc); |
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 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
|
123 List<MeasurementStation> mstations = createMeasurementStations( |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
124 result, riverinfo.getName(), riverinfo.isKmUp()); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
125 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
126 riverinfo.setMeasurementStations(mstations); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
127 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
128 logger.debug("Finished MeasurementStationInfoService."); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
129 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
130 return riverinfo; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
131 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
132 catch (ConnectionException ce) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
133 logger.error(ce, ce); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
134 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
135 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
136 logger.warn("No measurement station found"); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
137 throw new ServerException(ERROR_NO_RIVER_INFO_FOUND); |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
138 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
139 |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
140 /** |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
141 * Avoids NullPointerException when parsing double value |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
142 */ |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
143 private Double parseDouble(String value) { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
144 if (value == null || value.isEmpty()) { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
145 return null; |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
146 } |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
147 try { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
148 return Double.valueOf(value); |
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 catch(NumberFormatException e) { |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
151 logger.error(e, e); |
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
152 return null; |
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 } |
3843
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
155 |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
156 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
|
157 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
|
158 return null; |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
159 } |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
160 try { |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
161 return Long.valueOf(value); |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
162 } |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
163 catch(NumberFormatException e) { |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
164 logger.error(e, e); |
8e169e4e1b57
Add the official gauge number to the GaugeInfo class
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
3838
diff
changeset
|
165 return null; |
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 } |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
168 |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
169 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
|
170 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
|
171 return null; |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
172 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
173 try { |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
174 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
|
175 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
176 catch(NumberFormatException e) { |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
177 logger.error(e, e); |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
178 return null; |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
179 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
180 } |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
181 |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
182 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
|
183 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
|
184 return null; |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
185 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
186 try { |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
187 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
|
188 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
189 catch(ParseException e) { |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
190 logger.error(e, e); |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
191 return null; |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
192 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
193 } |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
194 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
195 private List<MeasurementStation> createMeasurementStations( |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
196 Document result, String rivername, boolean kmup) { |
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
197 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
198 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
|
199 result, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
200 XPATH_STATIONS, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
201 XPathConstants.NODESET, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
202 ArtifactNamespaceContext.INSTANCE); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
203 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
204 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
|
205 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
206 ArrayList<MeasurementStation> mstations = new ArrayList<MeasurementStation>(num); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
207 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
208 if (num == 0) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
209 logger.warn("No measurement station found."); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
210 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
211 else { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
212 logger.debug("Found " + num + " measurement stations."); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
213 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
214 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
|
215 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
|
216 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
217 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
|
218 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
|
219 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
|
220 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
|
221 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
|
222 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
|
223 String mstation = stationele.getAttributeNS( |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
224 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
|
225 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
|
226 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
|
227 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 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
|
233 String mstarttime = stationele.getAttributeNS( |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
234 ArtifactNamespaceContext.NAMESPACE_URI, "starttime"); |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
235 String mstoptime = stationele.getAttributeNS( |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
236 ArtifactNamespaceContext.NAMESPACE_URI, "stoptime"); |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
237 |
4326
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
238 String gaugename = null; |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
239 |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
240 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
|
241 if (gaugeele != null) { |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
242 gaugename = gaugeele.getAttributeNS( |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
243 ArtifactNamespaceContext.NAMESPACE_URI, "name"); |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
244 } |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
245 |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
246 |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
247 logger.debug("Found measurement station with name " + mname); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
248 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
249 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
|
250 rivername, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
251 mname, |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
252 parseInteger(mid), |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
253 parseDouble(mstation), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
254 parseDouble(mstart), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
255 parseDouble(mend), |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
256 kmup, |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
257 riverside, |
4266
06d9098a609a
Add id, kmup and operator to MeasurementStation in RiverInfoServiceImpl
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4250
diff
changeset
|
258 mtype, |
4288
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
259 moperator, |
b6f2ecaa6704
Parse start and end time of an observation
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4266
diff
changeset
|
260 parseDate(mstarttime), |
4326
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
261 parseDate(mstoptime), |
87362ba26c72
Extract the gauge name from the riverservice response
Björn Ricks <bjoern.ricks@intevation.de>
parents:
4288
diff
changeset
|
262 gaugename |
4250
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
263 ); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
264 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
265 mstations.add(station); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
266 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
267 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
268 return mstations; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
269 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
270 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
271 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
|
272 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
|
273 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
|
274 result, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
275 XPATH_GAUGES, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
276 XPathConstants.NODESET, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
277 ArtifactNamespaceContext.INSTANCE); |
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 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
|
280 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
281 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
|
282 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
283 if (num == 0) { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
284 logger.warn("No gauge info found."); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
285 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
286 else { |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
287 logger.debug("Found " + num + " gauges."); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
288 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
289 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
|
290 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
|
291 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
292 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
|
293 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
|
294 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
|
295 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
|
296 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
|
297 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
|
298 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
|
299 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
|
300 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
|
301 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
|
302 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
|
303 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
|
304 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
|
305 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
|
306 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
|
307 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
|
308 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
|
309 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
|
310 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
|
311 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
|
312 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
|
313 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
|
314 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
315 logger.debug("Found gauge with name " + gname); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
316 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
317 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
|
318 rivername, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
319 gname, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
320 kmup, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
321 parseDouble(gstation), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
322 parseDouble(gstart), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
323 parseDouble(gend), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
324 parseDouble(gdatum), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
325 parseDouble(gaeo), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
326 parseDouble(gminq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
327 parseDouble(gmaxq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
328 parseDouble(gminw), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
329 parseDouble(gmaxw), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
330 rwstunit, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
331 parseLong(gofficial) |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
332 ); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
333 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
334 gauges.add(gaugeinfo); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
335 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
336 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
337 return gauges; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
338 } |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
339 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
340 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
|
341 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
|
342 result, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
343 XPATH_RIVER, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
344 XPathConstants.NODE, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
345 ArtifactNamespaceContext.INSTANCE); |
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 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
|
348 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
|
349 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
|
350 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
|
351 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
|
352 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
|
353 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
|
354 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
|
355 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
|
356 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
|
357 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
|
358 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
|
359 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
|
360 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
|
361 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
|
362 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
|
363 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
364 logger.debug("River is " + rname); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
365 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
366 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
|
367 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
|
368 rname, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
369 kmup, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
370 parseDouble(rstart), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
371 parseDouble(rend), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
372 rwstunit, |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
373 parseDouble(rminq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
374 parseDouble(rmaxq), |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
375 parseLong(rofficial) |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
376 ); |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
377 |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
378 return riverinfo; |
ef154fbf58f1
Add method to get the MeasurementStations from the RiverInfoService
Björn Ricks <bjoern.ricks@intevation.de>
parents:
3974
diff
changeset
|
379 } |
3713
79ad33f41977
Implement a gauge service
Bjoern Ricks <bjoern.ricks@intevation.de>
parents:
diff
changeset
|
380 } |