changeset 3223:282c9da923ab

FixA: flys/issue689: Export CSV for facet 'fix_parameters' flys-artifacts/trunk@4849 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 02 Jul 2012 10:13:00 +0000
parents 116b342893e3
children 075f1ba25758
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java
diffstat 3 files changed, 32 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Sun Jul 01 18:00:04 2012 +0000
+++ b/flys-artifacts/ChangeLog	Mon Jul 02 10:13:00 2012 +0000
@@ -1,3 +1,12 @@
+2012-07-02	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java:
+	  Generate CSV for facet 'fix_parameters'.
+
+	* src/main/java/de/intevation/flys/exports/AbstractExporter.java:
+	  Be more eloquent on which kind of facet the exporter does not
+	  like.
+
 2012-07-02	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/states/SQRelation.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java	Sun Jul 01 18:00:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java	Mon Jul 02 10:13:00 2012 +0000
@@ -37,6 +37,8 @@
     /** The logger used in this exporter.*/
     private static Logger logger = Logger.getLogger(AbstractExporter.class);
 
+    /* XXX: Why does AbstractExporter do not implement FacetTypes? */
+    public static String FIX_PARAMETERS = "fix_parameters";
 
     /** The name of the CSV facet which triggers the CSV creation. */
     public static final String FACET_CSV = "csv";
@@ -162,7 +164,8 @@
             generatePDF();
         }
         else {
-            throw new IOException("invalid facet for exporter.");
+            throw new IOException(
+                "invalid facet for exporter: '" + facet + "'");
         }
     }
 
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java	Sun Jul 01 18:00:04 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/ParametersExporter.java	Mon Jul 02 10:13:00 2012 +0000
@@ -56,6 +56,25 @@
     }
 
     @Override
+    public void generate()
+    throws IOException
+    {
+        log.debug("ParametersExporter.generate");
+
+        if (facet == null) {
+            throw new IOException("invalid (null) facet for exporter");
+        }
+
+        if (facet.equals(FIX_PARAMETERS)) {
+            generateCSV();
+        }
+        else {
+            throw new IOException(
+                "invalid facet for exporter: '" + facet + "'");
+        }
+    }
+
+    @Override
     protected void writeCSVData(final CSVWriter writer) throws IOException {
 
         if (parametersList.isEmpty()) {

http://dive4elements.wald.intevation.org