diff flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java @ 3499:17c66d38f095

FixA: Added AT file export to FixAnalysis W/Q. flys-client/trunk@5223 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Fri, 17 Aug 2012 11:18:15 +0000
parents bc06a671ef60
children def13f23bb27
line wrap: on
line diff
--- a/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java	Thu Aug 16 16:38:21 2012 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/ExportServiceImpl.java	Fri Aug 17 11:18:15 2012 +0000
@@ -4,14 +4,17 @@
 import java.io.IOException;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.Element;
 
 import org.apache.log4j.Logger;
+import org.json.XML;
 
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import de.intevation.artifacts.common.utils.ClientProtocolUtils;
+import de.intevation.artifacts.common.utils.XMLUtils;
 
 import de.intevation.artifacts.httpclient.http.HttpClient;
 import de.intevation.artifacts.httpclient.http.HttpClientImpl;
@@ -43,14 +46,24 @@
             String mode      = req.getParameter("mode");
             String type      = req.getParameter("type");
             String locale    = req.getParameter("locale");
+            String km        = req.getParameter("km");
             String fn        = mode + "." + type;
 
             resp.setHeader("Content-Disposition", "attachment;filename=" + fn);
 
             logger.debug("Request " + type + " export.");
+
+            Document attr = null;
+            if (km != null && km.length() > 0) {
+                attr = XMLUtils.newDocument();
+                XMLUtils.ElementCreator ec =
+                        new XMLUtils.ElementCreator(attr, null, null);
+                Element e = ec.create("km");
+                e.setTextContent(km);
+                attr.appendChild(e);
+            }
             Document request = ClientProtocolUtils.newOutCollectionDocument(
-                uuid, mode, type);
-
+                uuid, mode, type, attr);
             HttpClient client = new HttpClientImpl(url, locale);
             client.collectionOut(request, uuid, mode, out);
 

http://dive4elements.wald.intevation.org