changeset 576:b21fc7502750

Fixed issue 178. Export modes CSV and ODV work again. gnv/trunk@709 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 25 Feb 2010 08:18:41 +0000
parents a634d5ee961d
children 60caaa265e2b
files gnv/ChangeLog gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java
diffstat 2 files changed, 37 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gnv/ChangeLog	Wed Feb 24 14:38:36 2010 +0000
+++ b/gnv/ChangeLog	Thu Feb 25 08:18:41 2010 +0000
@@ -1,3 +1,10 @@
+2010-02-25  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	  Issue178
+
+	* src/main/java/de/intevation/gnv/action/DoExportAction.java: Added a code
+	  path for export actions, where no export mode is given.
+
 2010-02-24  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* src/main/java/de/intevation/gnv/action/ChangeOptionsAction.java: Added
--- a/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java	Wed Feb 24 14:38:36 2010 +0000
+++ b/gnv/src/main/java/de/intevation/gnv/action/DoExportAction.java	Thu Feb 25 08:18:41 2010 +0000
@@ -114,6 +114,36 @@
                     outputStream.flush();
                     outputStream.close();
                 }
+                else if (exportMode == null) {
+                    Collection<OutputParameter> inputParameter = outputMode
+                            .getOutputParameters();
+                    Collection<InputParameter> ips = null;
+                    if (inputParameter != null) {
+                        ips = new ArrayList<InputParameter>(inputParameter.size());
+                        Iterator<OutputParameter> it = inputParameter.iterator();
+                        while (it.hasNext()) {
+                            String name = it.next().getName();
+                            String[] values = request.getParameterValues(name);
+                            InputParameter ip = new DefaultInputParameter(name,
+                                    values);
+                            ips.add(ip);
+                        }
+                    }
+
+                    ArtifactDatabaseClient adc = ArtifactDatabaseClientFactory
+                            .getInstance()
+                            .getArtifactDatabaseClient(getLocale(request));
+
+                    this.setHeaders(target, mimeType, response, request);
+
+                    OutputStream outputStream = response.getOutputStream();
+                    adc.doOutput(sm.getSelectedArtifactFactory(), sm
+                            .getCurrentArtifact(), outputStream, target, mimeType,
+                            ips);
+
+                    outputStream.flush();
+                    outputStream.close();
+                }
                 else {
                     if (outputMode == null) {
                         log.error("Outputmode is not supported.");

http://dive4elements.wald.intevation.org