changeset 4836:01e82da3f919

Ignore constant WQKms in CSV and PDF output.
author Sascha L. Teichmann <teichmann@intevation.de>
date Wed, 23 Jan 2013 11:14:22 +0100
parents 8e72777c961c
children ac9a3d9576b4 61ebb6fb2ac4
files flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Wed Jan 23 05:53:44 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java	Wed Jan 23 11:14:22 2013 +0100
@@ -19,6 +19,8 @@
 
 import au.com.bytecode.opencsv.CSVWriter;
 
+import de.intevation.flys.artifacts.model.ConstantWQKms;
+
 import net.sf.jasperreports.engine.JasperExportManager;
 import net.sf.jasperreports.engine.JasperFillManager;
 import net.sf.jasperreports.engine.JasperPrint;
@@ -43,7 +45,6 @@
 import de.intevation.flys.utils.FLYSUtils.WQ_MODE;
 import de.intevation.flys.utils.Formatter;
 
-
 /**
  * Generates different output formats (wst, csv, pdf) of data that resulted from
  * a waterlevel computation.
@@ -449,6 +450,11 @@
     ) {
         logger.debug("WaterlevelExporter.wQKms2CSV");
 
+        // Skip constant data.
+        if (wqkms instanceof ConstantWQKms) {
+            return;
+        }
+
         NumberFormat kmf = getKmFormatter();
         NumberFormat wf  = getWFormatter();
         NumberFormat qf  = getQFormatter();
@@ -579,6 +585,9 @@
      * @param wqkms The new WST column.
      */
     protected void addWSTColumn(WstWriter writer, WQKms wqkms) {
+        if (wqkms instanceof ConstantWQKms) {
+            return;
+        }
         if (master instanceof WINFOArtifact) {
             writer.addColumn(getColumnTitle((WINFOArtifact) master, wqkms));
         }
@@ -613,8 +622,7 @@
             JasperExportManager.exportReportToPdfStream(print, out);
         }
         catch(JRException je) {
-            logger.warn("Error generating PDF Report!");
-            je.printStackTrace();
+            logger.warn("Error generating PDF Report!", je);
         }
     }
 
@@ -665,6 +673,11 @@
     {
         logger.debug("WaterlevelExporter.addWKmsData");
 
+        // Skip constant data.
+        if (wqkms instanceof ConstantWQKms) {
+            return;
+        }
+
         NumberFormat kmf = getKmFormatter();
         NumberFormat wf  = getWFormatter();
         NumberFormat qf  = getQFormatter();

http://dive4elements.wald.intevation.org