Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/DischargeTablesServiceImpl.java @ 4581:f0424ca0f8a5
Allow manual points in flow_velocity diagrams.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Tue, 27 Nov 2012 17:41:44 +0100 |
parents | 6ae99d996f79 |
children |
rev | line source |
---|---|
4218
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.IOException; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 import java.io.InputStream; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.io.OutputStream; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import java.text.DateFormat; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import java.util.Date; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import java.util.Locale; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.servlet.http.HttpServlet; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import javax.servlet.http.HttpServletRequest; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import javax.servlet.http.HttpServletResponse; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import org.apache.log4j.Logger; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.w3c.dom.Document; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import org.w3c.dom.Element; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import de.intevation.artifacts.common.utils.XMLUtils; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 import de.intevation.artifacts.httpclient.http.HttpClient; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 import de.intevation.artifacts.httpclient.http.response.StreamResponseHandler; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 public class DischargeTablesServiceImpl extends HttpServlet { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 private static final Logger logger = Logger |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 .getLogger(DischargeInfoServiceImpl.class); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 private static final DateFormat DATE_FORMAT = DateFormat.getDateInstance( |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 DateFormat.MEDIUM, Locale.GERMANY); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 public void doGet(HttpServletRequest req, HttpServletResponse resp) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 logger.info("ChartOutputServiceImpl.doGet"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 String url = getServletContext().getInitParameter("server-url"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 String locale = req.getParameter("locale"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 prepareHeader(req, resp); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 Document requestDoc = createRequestDoc(req); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 HttpClient client = new HttpClientImpl(url, locale); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 try { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 OutputStream out = resp.getOutputStream(); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 InputStream stream = (InputStream) client.callService(url, |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 "dischargetablesoverview", requestDoc, |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 new StreamResponseHandler()); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 byte[] b = new byte[4096]; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 try { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 int i; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 while ((i = stream.read(b)) >= 0) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 out.write(b, 0, i); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 finally { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 stream.close(); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 catch (IOException ioe) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 logger.error("Error while fetching discharge tables chart!", ioe); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 protected void prepareHeader(HttpServletRequest req, |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 HttpServletResponse resp) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 resp.setHeader("Content-Type", "image/png"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 protected Document createRequestDoc(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 Document request = XMLUtils.newDocument(); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 XMLUtils.ElementCreator creator = new XMLUtils.ElementCreator(request, |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 null, null); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 Element service = creator.create("service"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 Element gauge = creator.create("gauge"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 Element extent = creator.create("extent"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 Element format = creator.create("format"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 Element timerange = creator.create("timerange"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 creator.addAttr(gauge, "name", extractRequestGauge(req)); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 creator.addAttr(extent, "width", extractRequestWidth(req)); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 creator.addAttr(extent, "height", extractRequestHeight(req)); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 creator.addAttr(format, "type", extractRequestFormat(req)); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 creator.addAttr(timerange, "lower", extractRequestLowerTime(req)); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 creator.addAttr(timerange, "upper", extractRequestUpperTime(req)); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 request.appendChild(service); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 service.appendChild(gauge); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 service.appendChild(extent); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 service.appendChild(format); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 service.appendChild(timerange); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 return request; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
98 protected String extractRequestGauge(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
99 return req.getParameter("gauge"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
101 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
102 protected String extractRequestWidth(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
103 return req.getParameter("width"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
104 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
105 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
106 protected String extractRequestHeight(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
107 return req.getParameter("height"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
108 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
109 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
110 protected String extractRequestFormat(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
111 return req.getParameter("format"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
112 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
113 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
114 protected String extractRequestLowerTime(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 String lowerStr = req.getParameter("lower"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
116 try { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
117 long lowerMillis = Long.parseLong(lowerStr); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
118 Date lower = new Date(lowerMillis); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
119 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
120 return DATE_FORMAT.format(lower); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 catch (NumberFormatException nfe) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 logger.warn("Cannot parse time millies.", nfe); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 return null; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 protected String extractRequestUpperTime(HttpServletRequest req) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 String upperStr = req.getParameter("upper"); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 try { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 long upperMillis = Long.parseLong(upperStr); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 Date upper = new Date(upperMillis); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 return DATE_FORMAT.format(upper); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 catch (NumberFormatException nfe) { |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 logger.warn("Cannot parse time millies.", nfe); |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 return null; |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 } |
6ae99d996f79
flys/issue903: Display the discharge tables of the selected gauge as chart in historical discharge calculation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 } |