[PATCH] (issue1632) Add Unit to CSV export

Wald Commits scm-commit at wald.intevation.org
Tue Dec 3 12:50:49 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1386071415 -3600
# Node ID 10993baf02c555a5d56831173cc768bcdaf85362
# Parent  e469d9939a52240c39047d4bb7e8fdd6cf0e4392
(issue1632) Add Unit to CSV export

diff -r e469d9939a52 -r 10993baf02c5 artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java	Tue Dec 03 11:48:20 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/minfo/SedimentLoadExporter.java	Tue Dec 03 12:50:15 2013 +0100
@@ -19,11 +19,14 @@
 
 import org.apache.log4j.Logger;
 
+import org.dive4elements.river.artifacts.access.SedimentLoadAccess;
 import org.dive4elements.river.artifacts.model.CalculationResult;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoad;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadFraction;
 import org.dive4elements.river.artifacts.model.minfo.SedimentLoadResult;
 
+import org.dive4elements.river.artifacts.D4EArtifact;
+
 import org.dive4elements.river.exports.AbstractExporter;
 
 import org.dive4elements.river.utils.Formatter;
@@ -140,16 +143,22 @@
         logger.debug("writeCSVHeader()");
 
         List<String> header = new LinkedList<String>();
-        if (results != null)  {
+        if (results != null) {
+            SedimentLoadAccess access =
+                new SedimentLoadAccess((D4EArtifact) master);
+
+            String unit = " [" + msg("state.minfo.sediment.load." +
+                    access.getUnit(), "translation missing") + "]";
+
             header.add(msg(CSV_KM,          "km"));
             header.add(msg(CSV_YEAR,        "Jahr"));
-            header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst."));
-            header.add(msg(CSV_SUSP_SAND,   "Susp.Sand"));
-            header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)"));
-            header.add(msg(CSV_SAND,        "Sand"));
-            header.add(msg(CSV_FINEMIDDLE,  "Kies(f+m)"));
-            header.add(msg(CSV_COARSE,      "Kies(g)"));
-            header.add(msg(CSV_TOTAL,       "Gesamt"));
+            header.add(msg(CSV_SUSP_SEDIMENT, "Schwebst.") + unit);
+            header.add(msg(CSV_SUSP_SAND,   "Susp.Sand") + unit);
+            header.add(msg(CSV_SUSP_SAND_BB, "Susp.Sand(BB)") + unit);
+            header.add(msg(CSV_SAND,        "Sand") + unit);
+            header.add(msg(CSV_FINEMIDDLE,  "Kies(f+m)") + unit);
+            header.add(msg(CSV_COARSE,      "Kies(g)") + unit);
+            header.add(msg(CSV_TOTAL,       "Gesamt") + unit);
         }
         writer.writeNext(header.toArray(new String[header.size()]));
     }


More information about the Dive4elements-commits mailing list