annotate flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java @ 2497:a6c6f305546c

Removed superfluous imports. flys-client/trunk@4324 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 27 Apr 2012 15:57:11 +0000
parents f905c936ffff
children 87ac5c532523
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
2493
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
17 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
18 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
19
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
20 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
21
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
22 import org.w3c.dom.Document;
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
23
2489
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 public class FixingsOverviewServiceImpl
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 extends RemoteServiceServlet
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 implements FixingsOverviewService
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27 {
2493
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
28 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
29 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
30
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
31 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
32
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
33 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
34 "/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
35
2489
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 @Override
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37 public String generateOverview(
2493
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
38 String locale,
2489
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 String uuid,
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 boolean checkboxes,
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 String filter
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 )
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 throws ServerException
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 {
2493
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
45 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
46
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
47 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
48 log.warn("Missing 'filter' parameter.");
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
49 return "";
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
50 }
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
51
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
52 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
53
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
54 if (filterDoc == null) {
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
55 log.warn("Creating filter document failed.");
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
56 return "";
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
57 }
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
58
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
59 InputStream transform =
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
60 getServletContext().getResourceAsStream(XSL_TRANSFORM);
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
61
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
62 try {
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
63 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
64 HttpClient client = new HttpClientImpl(url, locale);
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
65 Document resultDoc =
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
66 client.callService(url, SERVICE_NAME, filterDoc);
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
67 XSLTransformer xformer = new XSLTransformer();
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
68 xformer.addParameter("project-uuid", uuid);
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
69 xformer.addParameter(
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
70 "render-checkboxes", checkboxes ? "true()" : "false()");
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
71 String result = xformer.transform(resultDoc, transform);
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
72 return result != null ? result : "";
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
73 }
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
74 catch (ConnectionException ce) {
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
75 log.error(ce);
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
76 }
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
77 finally {
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
78 try { transform.close(); }
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
79 catch (IOException ioe) {}
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
80 }
f905c936ffff Added the XSL transformation to generate the fixings overview.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2489
diff changeset
81
2489
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 return "";
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 }
2a504b6d9a1b Added stub for fixings overview service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org