diff artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java @ 7981:45cced06490c facet-metadata

merged with default.
author Raimund Renkert <rrenkert@intevation.de>
date Mon, 30 Jun 2014 11:29:45 +0200
parents a310b1f85ce0
children 705f8b92fd66
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Wed May 21 11:43:10 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/AbstractExporter.java	Mon Jun 30 11:29:45 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.
      */
@@ -263,6 +284,9 @@
             request, XPATH_FACET, ArtifactNamespaceContext.INSTANCE);
     }
 
+    protected String msg(String key) {
+        return Resources.getMsg(context.getMeta(), key, key);
+    }
 
     protected String msg(String key, String def) {
         return Resources.getMsg(context.getMeta(), key, def);

http://dive4elements.wald.intevation.org