changeset 3129:04952869e4fa

FixA: Added reference events to CSV export. flys-artifacts/trunk@4730 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 20 Jun 2012 15:30:38 +0000
parents 1dd6f30b0a76
children 0dd569e9b9f1
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/exports/DeltaWtExporter.java
diffstat 2 files changed, 31 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Wed Jun 20 15:24:01 2012 +0000
+++ b/flys-artifacts/ChangeLog	Wed Jun 20 15:30:38 2012 +0000
@@ -1,3 +1,8 @@
+2012-06-20  Raimund Renkert <raimund.renkert@intevation.de>
+
+	* src/main/java/de/intevation/flys/exports/DeltaWtExporter.java:
+	  Added reference events to CSV export.
+
 2012-06-20  Raimund Renkert <raimund.renkert@intevation.de>
 
 	* src/main/java/de/intevation/flys/artifacts/model/fixings/FixReferenceEventsFacet.java:
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/DeltaWtExporter.java	Wed Jun 20 15:24:01 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/DeltaWtExporter.java	Wed Jun 20 15:30:38 2012 +0000
@@ -58,11 +58,14 @@
 
     protected List<KMIndex<AnalysisPeriod []>> analysisPeriods;
 
+    protected List<KMIndex<QWD[]>> referenceEvents;
+
     @Override
     public void init(Document request, OutputStream out, CallContext context) {
         log.debug("DeltaWtExporter.init");
         super.init(request, out, context);
         analysisPeriods = new ArrayList<KMIndex<AnalysisPeriod []>>();
+        referenceEvents = new ArrayList<KMIndex<QWD[]>>();
     }
 
     @Override
@@ -96,6 +99,7 @@
         }
         FixResult result = (FixResult)data;
         analysisPeriods.add(result.getAnalysisPeriods());
+        referenceEvents.add(result.getReferenced());
     }
 
     @Override
@@ -112,6 +116,28 @@
         Locale locale = Resources.getLocale(meta);
         DateFormat dF = DateFormat.getDateInstance(DateFormat.SHORT, locale);
 
+        for (KMIndex<QWD[]> reference: referenceEvents) {
+
+            for (KMIndex.Entry<QWD[]> kmEntry: reference) {
+
+               String kmS = kmF.format(kmEntry.getKm());
+               for (QWD qwd: kmEntry.getValue()) {
+                    double deltaW = qwd.getDeltaW();
+                    Date   date   = qwd.getDate();
+                    String desc   = qwd.getDescription();
+
+                    String deltaWS = dwF.format(deltaW);
+                    String dateS   = dF.format(date);
+
+                    writer.writeNext(new String[] {
+                        kmS,
+                        deltaWS,
+                        dateS,
+                        desc != null ? desc : "" });
+               }
+            }
+        }
+
         if (debug) {
             log.debug("AnalysisPeriods: " + analysisPeriods.size());
         }

http://dive4elements.wald.intevation.org