Mercurial > dive4elements > river
annotate gwt-client/src/main/java/org/dive4elements/river/client/server/DischargeTablesServiceImpl.java @ 6199:734ba3732bb6
CapabilitiesParse parses the "queryable" attribute of a WMSLayer now (#1253).
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Wed, 05 Jun 2013 13:13:20 +0200 |
parents | ea9eef426962 |
children | 238fc722f87a |
rev | line source |
---|---|
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5993
ea9eef426962
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5861
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5861
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
172338b1407f
GWT client: Added copyright header.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
9 package org.dive4elements.river.client.server; |
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
|
10 |
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 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
|
12 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
|
13 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
|
14 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
|
15 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
|
16 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
|
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 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
|
19 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
|
20 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
|
21 |
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 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
|
23 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
|
24 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
|
25 |
5835
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
26 import org.dive4elements.artifacts.common.utils.XMLUtils; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
27 import org.dive4elements.artifacts.httpclient.http.HttpClient; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
28 import org.dive4elements.artifacts.httpclient.http.HttpClientImpl; |
821a02bbfb4e
Fixed internal java dependencies
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5834
diff
changeset
|
29 import org.dive4elements.artifacts.httpclient.http.response.StreamResponseHandler; |
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
|
30 |
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 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
|
33 |
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 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
|
35 .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
|
36 |
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 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
|
38 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
|
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 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
|
41 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
|
42 |
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 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
|
44 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
|
45 |
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 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
|
47 |
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 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
|
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 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
|
51 |
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 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
|
53 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
|
54 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
|
55 "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
|
56 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
|
57 |
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 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
|
59 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
|
60 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
|
61 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
|
62 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
|
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 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
|
66 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
|
67 } |
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 } |
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 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
|
70 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
|
71 } |
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 } |
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 |
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 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
|
75 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
|
76 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
|
77 } |
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 |
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 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
|
80 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
|
81 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
|
82 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
|
83 |
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 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
|
85 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
|
86 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
|
87 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
|
88 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
|
89 |
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 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
|
91 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
|
92 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
|
93 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
|
94 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
|
95 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
|
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 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
|
98 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
|
99 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
|
100 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
|
101 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
|
102 |
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 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
|
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 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
|
107 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
|
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 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
|
111 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
|
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 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
|
115 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
|
116 } |
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 |
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 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
|
119 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
|
120 } |
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 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
|
123 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
|
124 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
|
125 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
|
126 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
|
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 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
|
129 } |
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 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
|
131 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
|
132 } |
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 |
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 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
|
135 } |
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 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
|
138 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
|
139 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
|
140 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
|
141 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
|
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 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
|
144 } |
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
|
145 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
|
146 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
|
147 } |
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
|
148 |
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
|
149 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
|
150 } |
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
|
151 } |