Mercurial > dive4elements > river
view flys-client/src/main/java/de/intevation/flys/client/server/FixingsOverviewServiceImpl.java @ 2498:499d2692305d
Added i18 for linelabel theme property strings.
flys-client/trunk@4331 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 02 May 2012 19:05:16 +0000 |
parents | f905c936ffff |
children | 87ac5c532523 |
line wrap: on
line source
package de.intevation.flys.client.server; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import de.intevation.artifacts.common.utils.XMLUtils; import de.intevation.artifacts.common.utils.XSLTransformer; import de.intevation.artifacts.httpclient.exceptions.ConnectionException; import de.intevation.artifacts.httpclient.http.HttpClient; import de.intevation.artifacts.httpclient.http.HttpClientImpl; import de.intevation.flys.client.client.services.FixingsOverviewService; import de.intevation.flys.client.shared.exceptions.ServerException; import java.io.IOException; import java.io.InputStream; import org.apache.log4j.Logger; import org.w3c.dom.Document; public class FixingsOverviewServiceImpl extends RemoteServiceServlet implements FixingsOverviewService { private static final Logger log = Logger.getLogger(FixingsOverviewServiceImpl.class); public static final String SERVICE_NAME = "fixings-overview"; public static final String XSL_TRANSFORM = "/WEB-INF/stylesheets/fixoverview2html.xsl"; @Override public String generateOverview( String locale, String uuid, boolean checkboxes, String filter ) throws ServerException { log.info("FixingsOverviewServiceImpl.doGet"); if (filter == null || filter.length() == 0) { log.warn("Missing 'filter' parameter."); return ""; } Document filterDoc = XMLUtils.jsonToXML(filter); if (filterDoc == null) { log.warn("Creating filter document failed."); return ""; } InputStream transform = getServletContext().getResourceAsStream(XSL_TRANSFORM); try { String url = getServletContext().getInitParameter("server-url"); HttpClient client = new HttpClientImpl(url, locale); Document resultDoc = client.callService(url, SERVICE_NAME, filterDoc); XSLTransformer xformer = new XSLTransformer(); xformer.addParameter("project-uuid", uuid); xformer.addParameter( "render-checkboxes", checkboxes ? "true()" : "false()"); String result = xformer.transform(resultDoc, transform); return result != null ? result : ""; } catch (ConnectionException ce) { log.error(ce); } finally { try { transform.close(); } catch (IOException ioe) {} } return ""; } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :