changeset 258:5091675676d6

Fixed attributes/namespaces in the XML document that is used to fetch the CSV export of WINFO computations. flys-client/trunk@1871 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 10 May 2011 06:48:46 +0000
parents 7017ed659ee6
children 50a95db68e66
files flys-client/ChangeLog flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java
diffstat 2 files changed, 16 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-client/ChangeLog	Mon May 09 16:22:11 2011 +0000
+++ b/flys-client/ChangeLog	Tue May 10 06:48:46 2011 +0000
@@ -1,3 +1,13 @@
+2011-05-10  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java:
+	  Bugfix: Use the ElementCreator from XMLUtils to add attribute to nodes
+	  in the xml document. Then, those nodes will have the ArtifactNamespace
+	  automatically. If we do something like
+	    node.setAttribute("art:attr", "value")
+	  Restlet will throw an exception, because it does not know the "art:"
+	  namespace.
+
 2011-05-09  Ingo Weinzierl <ingo@intevation.de>
 
 	* pom.xml: Bugfix: replaced the goupId of the OpenCSV dependency with the
--- a/flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java	Mon May 09 16:22:11 2011 +0000
+++ b/flys-client/src/main/java/de/intevation/flys/client/server/CSVExportServiceImpl.java	Tue May 10 06:48:46 2011 +0000
@@ -54,20 +54,19 @@
             name = name.substring(name.indexOf(".") + 1);
         }
 
-        Element action = ec.create("art:action");
-        action.setAttribute("art:type", "csv");
-        action.setAttribute("art:name", name);
+        Element action = ec.create("action");
+        ec.addAttr(action, "type", "csv", true);
+        ec.addAttr(action, "name", name, true);
 
         requestDoc.appendChild(action);
 
         HttpClient client = new HttpClientImpl(url, locale);
         try {
             InputStream in = client.collectionOut(requestDoc, uuid, "export");
-            Reader reader = new InputStreamReader (in, "UTF-8");
+            Reader reader       = new InputStreamReader (in, "UTF-8");
             CSVReader csvReader = new CSVReader (reader);
-            String[] line;
-            List l = csvReader.readAll ();
-            return l;
+
+            return csvReader.readAll ();
         }
         catch (IOException ce) {
             System.err.println(ce.getLocalizedMessage());

http://dive4elements.wald.intevation.org