changeset 9455:5f81d3f7b82b

pdf export disabled flag
author gernotbelger
date Thu, 23 Aug 2018 16:32:53 +0200
parents 4cccbd32b680
children c96f6c8a6b03
files artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonExporter.java
diffstat 3 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java	Thu Aug 23 16:32:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/bundu/bezugswst/BezugswstMissVolCalculationResult2.java	Thu Aug 23 16:32:53 2018 +0200
@@ -43,6 +43,11 @@
     }
 
     @Override
+    protected boolean pdfExportEnabled() {
+        return false;
+    }
+
+    @Override
     protected void writeCSVResultMetadata(final ExportContextCSV exportContextCSV) {
         // no metadata
     }
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java	Thu Aug 23 16:32:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCalculationExportableResult.java	Thu Aug 23 16:32:53 2018 +0200
@@ -43,6 +43,10 @@
             writeCSVRow(exportContextCSV, row);
     }
 
+    protected boolean pdfExportEnabled() {
+        return true;
+    }
+
     protected abstract void writeCSVResultMetadata(final ExportContextCSV exportContextCSV);
 
     protected void writeCSVRow(final ExportContextCSV exportContextCSV, final ResultRow row) {
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonExporter.java	Thu Aug 23 16:32:28 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/common/AbstractCommonExporter.java	Thu Aug 23 16:32:53 2018 +0200
@@ -107,13 +107,16 @@
             final JasperReporter reporter = new JasperReporter();
 
             for (final RESULT result : results.getResults()) {
-
-                final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource();
+                if (result.pdfExportEnabled()) { // TODO: only works for multiple result: if singleresult is disabled, ugly errors occur, 'cause no pdf will be
+                                                 // created at all
 
-                writePDFGlobalMetadata(exportContext, source);
+                    final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource();
 
-                final JasperDesigner design = result.addReport(exportContext, reporter, source);
-                configureDesign(result, design);
+                    writePDFGlobalMetadata(exportContext, source);
+
+                    final JasperDesigner design = result.addReport(exportContext, reporter, source);
+                    configureDesign(result, design);
+                }
             }
 
             reporter.exportPDF(out);

http://dive4elements.wald.intevation.org