[Dive4elements-commits] [PATCH] Ignore constant WQKms in CSV and PDF output

Wald Commits scm-commit at wald.intevation.org
Wed Jan 23 11:14:28 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1358936062 -3600
# Node ID 01e82da3f9194bda064fc23649f569c710f0f31b
# Parent  8e72777c961c7e257126751dbb0023832d5fbe76
Ignore constant WQKms in CSV and PDF output.

diff -r 8e72777c961c -r 01e82da3f919 flys-artifacts/src/main/java/de/intevation/flys/exports/WaterlevelExporter.java
--- 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();


More information about the Dive4elements-commits mailing list