Mercurial > dive4elements > river
annotate flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java @ 3370:08b2472111aa
New implementation of OverviewOutputTab which has a minimalistic chart toolbar and no chart theme panel. The overview image is fetched as single image from server.
flys-client/trunk@5078 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 20 Jul 2012 07:40:55 +0000 |
parents | 96d02c6f44a2 |
children | 653dd9d7f5d5 |
rev | line source |
---|---|
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.client.server; |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import com.google.gwt.user.server.rpc.RemoteServiceServlet; |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
5 import de.intevation.artifacts.common.utils.XMLUtils; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
6 import de.intevation.artifacts.common.utils.XSLTransformer; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
7 |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
8 import de.intevation.artifacts.httpclient.exceptions.ConnectionException; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
9 |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
10 import de.intevation.artifacts.httpclient.http.HttpClient; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
11 import de.intevation.artifacts.httpclient.http.HttpClientImpl; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
12 |
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.client.client.services.FixingsOverviewService; |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import de.intevation.flys.client.shared.exceptions.ServerException; |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
17 import de.intevation.flys.client.shared.model.FixingsOverviewInfo.FixEvent; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
18 import de.intevation.flys.client.shared.model.FixingsOverviewInfo.Sector; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
19 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
20 import de.intevation.flys.client.shared.model.FixingsOverviewInfo; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
21 |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
22 import java.io.IOException; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
23 import java.io.InputStream; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
24 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
25 import java.util.ArrayList; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
26 import java.util.List; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
27 |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
28 import javax.xml.xpath.XPathConstants; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
29 |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
30 import org.apache.log4j.Logger; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
31 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
32 import org.w3c.dom.Document; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
33 import org.w3c.dom.Element; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
34 import org.w3c.dom.NodeList; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
35 |
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 public class FixingsOverviewServiceImpl |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 extends RemoteServiceServlet |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 implements FixingsOverviewService |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 { |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
40 private static final Logger log = |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
41 Logger.getLogger(FixingsOverviewServiceImpl.class); |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
42 |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
43 public static final String SERVICE_NAME = "fixings-overview"; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
44 |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
45 public static final String XSL_TRANSFORM = |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
46 "/WEB-INF/stylesheets/fixoverview2html.xsl"; |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
47 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
48 protected static final String XPATH_RID = "/fixings/river/@rid"; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
49 protected static final String XPATH_RIVER = "/fixings/river/@name"; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
50 protected static final String XPATH_RFROM = "/fixings/river/@from"; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
51 protected static final String XPATH_RTO = "/fixings/river/@to"; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
52 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
53 protected static final String XPATH_EVENT = "/fixings/events/event"; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
54 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
55 |
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 @Override |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
57 public FixingsOverviewInfo generateOverview( |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
58 String locale, |
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 String uuid, |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
60 String filter, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
61 boolean checkboxes, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
62 String callback |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
63 ) |
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 throws ServerException |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 { |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
66 log.info("FixingsOverviewServiceImpl.doGet"); |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
67 |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
68 if (filter == null || filter.length() == 0) { |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
69 log.warn("Missing 'filter' parameter."); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
70 return null; |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
71 } |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
72 |
2916
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
73 boolean debug = log.isDebugEnabled(); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
74 |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
75 if (debug) { |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
76 log.debug("JSON filter: ------------------"); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
77 log.debug(filter); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
78 } |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
79 |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
80 Document filterDoc = XMLUtils.jsonToXML(filter); |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
81 |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
82 if (filterDoc == null) { |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
83 log.warn("Creating filter document failed."); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
84 return null; |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
85 } |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
86 |
2916
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
87 if (debug) { |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
88 log.debug("XML filter: ------------------"); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
89 log.debug(XMLUtils.toString(filterDoc)); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
90 } |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
91 |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
92 try { |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
93 String url = getServletContext().getInitParameter("server-url"); |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
94 HttpClient client = new HttpClientImpl(url, locale); |
2921
96d02c6f44a2
Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2916
diff
changeset
|
95 Document resultDoc = |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
96 client.callService(url, SERVICE_NAME, filterDoc); |
2916
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
97 |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
98 if (debug) { |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
99 log.debug("Result XML: -----------"); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
100 log.debug(XMLUtils.toString(resultDoc)); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
101 } |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
102 |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
103 FixingsOverviewInfo i = |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
104 getInfo(resultDoc, uuid, checkboxes, callback); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
105 return i; |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
106 } |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
107 catch (ConnectionException ce) { |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
108 log.error(ce); |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
109 } |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
110 return null; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
111 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
112 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
113 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
114 protected FixingsOverviewInfo getInfo( |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
115 Document doc, |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
116 String uuid, |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
117 boolean checkboxes, |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
118 String callback |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
119 ) { |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
120 InputStream transform = getServletContext() |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
121 .getResourceAsStream(XSL_TRANSFORM); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
122 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
123 if (transform == null) { |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
124 log.warn("transform not found"); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
125 return null; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
126 } |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
127 |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
128 String result = null; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
129 try { |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
130 XSLTransformer xformer = new XSLTransformer(); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
131 xformer.addParameter("project-uuid", uuid); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
132 xformer.addParameter( |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
133 "render-checkboxes", |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
134 checkboxes ? Boolean.TRUE : Boolean.FALSE); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
135 xformer.addParameter("callback", callback); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
136 result = xformer.transform(doc, transform); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
137 } |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
138 finally { |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
139 try { transform.close(); } |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
140 catch (IOException ioe) {} |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
141 } |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
142 |
2916
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
143 if (log.isDebugEnabled()) { |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
144 log.debug("--------------------------------------"); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
145 log.debug(result); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
146 log.debug("--------------------------------------"); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
147 } |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
148 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
149 int rid = -1; |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
150 double from = -1; |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
151 double to = -1; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
152 |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
153 String rid_str = XMLUtils.xpathString(doc, XPATH_RID, null); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
154 String river = XMLUtils.xpathString(doc, XPATH_RIVER, null); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
155 String from_str = XMLUtils.xpathString(doc, XPATH_RFROM, null); |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
156 String to_str = XMLUtils.xpathString(doc, XPATH_RTO, null); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
157 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
158 try { |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
159 rid = Integer.parseInt(rid_str); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
160 from = Double.parseDouble(from_str); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
161 to = Double.parseDouble(to_str); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
162 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
163 catch(NumberFormatException nfe) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
164 log.warn(nfe, nfe); |
2493
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
165 } |
f905c936ffff
Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2489
diff
changeset
|
166 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
167 List<FixEvent> fixEvents = getFixEvents(doc); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
168 return new FixingsOverviewInfo( |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
169 rid, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
170 river, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
171 from, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
172 to, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
173 fixEvents, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
174 result); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
175 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
176 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
177 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
178 protected List<FixEvent> getFixEvents(Document doc) { |
2916
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
179 List<FixEvent> list = new ArrayList<FixEvent>(); |
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
180 |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
181 NodeList events = (NodeList) XMLUtils.xpath( |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
182 doc, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
183 XPATH_EVENT, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
184 XPathConstants.NODESET, |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
185 null); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
186 |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
187 if (events == null || events.getLength() == 0) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
188 log.warn("No events in Overview!"); |
2916
1f63e2ef03d2
Added more debug output about the transmitted fix overview documents.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2915
diff
changeset
|
189 return list; |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
190 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
191 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
192 for (int i = 0, E = events.getLength(); i < E; i++) { |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
193 Element n = (Element)events.item(i); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
194 List<Sector> sectors = getSectors(n); |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
195 String cid = n.getAttribute("cid"); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
196 String date = n.getAttribute("date");; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
197 String name = n.getAttribute("description"); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
198 list.add(new FixEvent( cid, date, name, sectors)); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
199 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
200 return list; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
201 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
202 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
203 protected List<Sector> getSectors(Element event) { |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
204 NodeList sectors = event.getElementsByTagName("sector"); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
205 |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
206 if (sectors.getLength() == 0) { |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
207 log.warn("No Sectors in Event!"); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
208 return null; |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
209 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
210 |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
211 List<Sector> list = new ArrayList<Sector>(); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
212 for (int i = 0, S = sectors.getLength(); i < S; i++) { |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
213 Element n = (Element)sectors.item(i); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
214 int cls = -1; |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
215 double from = -1; |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
216 double to = -1; |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
217 String cls_str = n.getAttribute("class"); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
218 String from_str = n.getAttribute("from"); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
219 String to_str = n.getAttribute("to"); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
220 try { |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
221 cls = Integer.parseInt(cls_str); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
222 from = Double.parseDouble(from_str); |
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
223 to = Double.parseDouble(to_str); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
224 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
225 catch(NumberFormatException nfe) { |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
226 log.warn(nfe, nfe); |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
227 } |
2915
d20f16a430a9
Removed some XPath misuse.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2536
diff
changeset
|
228 list.add(new Sector(cls, from, to)); |
2505
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
229 } |
87ac5c532523
First part of the UI for fixing analysis parameter.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
2493
diff
changeset
|
230 return list; |
2489
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 } |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
232 } |
2a504b6d9a1b
Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
233 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |