diff artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java @ 7937:a310b1f85ce0

issue1633: Add info lines in SQ-relation CSV export.
author Tom Gottfried <tom@intevation.de>
date Tue, 17 Jun 2014 17:57:25 +0200
parents 5ef60ed15c25
children 705f8b92fd66
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Tue Jun 17 17:50:59 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Tue Jun 17 17:57:25 2014 +0200
@@ -62,6 +62,8 @@
     /** The default separator for the CSV export. */
     public static final char DEFAULT_CSV_SEPARATOR = ';';
 
+    public static final String START_META_CHAR = "#";
+
     /** XPath that points to the desired export facet. */
     public static final String XPATH_FACET = "/art:action/@art:type";
 
@@ -103,6 +105,25 @@
 
 
     /**
+     * Write lines of informative content to CSV file.
+     * Usually this will be done above the column headers from within
+     * the implementation of writeCSVData in concret subclasses.
+     *
+     * @param writer The CSVWriter
+     * @param infolines Array of Strings with informative content.
+     * Each will be written to a separate line prefixed with START_META_CHAR.
+     */
+    protected void  writeCSVInfo(CSVWriter writer, String[] infolines) {
+        String[] metaline = new String[1];
+
+        for (String infoline: infolines) {
+            metaline[0] = START_META_CHAR + " " + infoline;
+            writer.writeNext(metaline);
+        }
+
+    }
+
+    /**
      * Concrete subclasses need to use this method to write their special data
      * objects into the PDF document.
      */

http://dive4elements.wald.intevation.org