Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/exports/fixings/DeltaWtExporter.java @ 9556:9b8e8fc1f408
Use facetName in all processors as themeType for legend aggregation.
author | gernotbelger |
---|---|
date | Tue, 23 Oct 2018 16:26:58 +0200 |
parents | 9744ce3c3853 |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5603
diff
changeset
|
9 package org.dive4elements.river.exports.fixings; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.io.IOException; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import java.io.OutputStream; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import java.text.DateFormat; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
14 import java.text.MessageFormat; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import java.text.NumberFormat; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 import java.util.ArrayList; |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
17 import java.util.Collection; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
18 import java.util.Date; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 import java.util.List; |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
20 import java.util.TreeMap; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 import org.apache.log4j.Logger; |
9082 | 23 import org.dive4elements.artifacts.CallMeta; |
24 import org.dive4elements.river.artifacts.D4EArtifact; | |
9306 | 25 import org.dive4elements.river.artifacts.access.RangeAccess; |
9082 | 26 import org.dive4elements.river.artifacts.access.RiverAccess; |
9306 | 27 import org.dive4elements.river.artifacts.common.DefaultCalculationResults; |
28 import org.dive4elements.river.artifacts.common.ExportContextPDF; | |
29 import org.dive4elements.river.artifacts.common.GeneralResultType; | |
30 import org.dive4elements.river.artifacts.common.JasperReporter; | |
31 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
9082 | 32 import org.dive4elements.river.artifacts.model.CalculationResult; |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
33 import org.dive4elements.river.artifacts.model.fixings.AnalysisPeriodEventResults; |
9082 | 34 import org.dive4elements.river.artifacts.model.fixings.FixAnalysisResult; |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
35 import org.dive4elements.river.artifacts.model.fixings.FixResultColumn; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
36 import org.dive4elements.river.artifacts.model.fixings.FixResultColumns; |
9082 | 37 import org.dive4elements.river.artifacts.model.fixings.QWD; |
38 import org.dive4elements.river.artifacts.resources.Resources; | |
9306 | 39 import org.dive4elements.river.artifacts.sinfo.util.CalculationUtils; |
40 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | |
9082 | 41 import org.dive4elements.river.exports.AbstractExporter; |
42 import org.dive4elements.river.utils.Formatter; | |
43 import org.dive4elements.river.utils.KMIndex; | |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
44 import org.dive4elements.river.utils.KMIndex.Entry; |
9082 | 45 |
46 import au.com.bytecode.opencsv.CSVWriter; | |
9306 | 47 import net.sf.jasperreports.engine.JRException; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
49 /** Exports fixation analysis deltaw(t) computation results to csv. */ |
9082 | 50 public class DeltaWtExporter extends AbstractExporter { |
8202
e4606eae8ea5
sed src/**/*.java 's/logger/log/g'
Sascha L. Teichmann <teichmann@intevation.de>
parents:
7088
diff
changeset
|
51 /** Private log. */ |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 private static Logger log = Logger.getLogger(DeltaWtExporter.class); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 |
9306 | 54 private static final String JASPER_FILE = "/jasper/templates/fixanalysis.delta_wt.jrxml"; |
55 | |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
56 private static final String CSV_KM_HEADER = "export.fixings.deltawt.csv.header.km"; |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
57 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
58 private static final String CSV_DELTA_W_HEADER = "export.fixings.deltawt.csv.header.deltaw"; |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
59 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
60 private static final String CSV_Q_HEADER = "export.fixings.deltawt.csv.header.q"; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
62 private static final String CSV_W_HEADER = "export.fixings.deltawt.csv.header.w"; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
64 private static final String CSV_TRANGE_HEADER = "export.fixings.deltawt.csv.header.time.range"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
65 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
66 private static final String CSV_T_HEADER = "export.fixings.deltawt.csv.header.t"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
67 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
68 private static final String CSV_T_FORMAT = "export.fixings.deltawt.csv.t.format"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
69 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
70 private static final String DEFAULT_CSV_KM_HEADER = "km"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
71 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
72 private static final String DEFAULT_CSV_DELTA_W_HEADER = "\u0394 W [cm]"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
73 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
74 private static final String DEFAULT_CSV_W_HEADER = "Wasserstand [m]"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
75 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
76 private static final String DEFAULT_CSV_Q_HEADER = "Abfluss [m\u00b3/s]"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
77 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
78 private static final String DEFAULT_CSV_T_HEADER = "Datum"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
79 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
80 private static final String DEFAULT_CSV_TRANGE_DESC_HEADER = "Status"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
81 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
82 private static final String CSV_REFERENCE = "export.fixings.deltawt.csv.reference"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
83 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
84 private static final String CSV_ANALYSIS = "export.fixings.deltawt.csv.analysis"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
85 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
86 private static final String DEFAULT_CSV_REFERENCE = "B"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
87 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
88 private static final String DEFAULT_CSV_ANALYSIS = "A{0,number,integer}"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
89 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
90 private static final String DEFAULT_CSV_T_FORMAT = "dd.MM.yyyy"; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
91 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
92 private final List<AnalysisPeriodEventResults> analysisEvents = new ArrayList<>(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
93 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
94 private final List<FixResultColumns> referenceEvents = new ArrayList<>(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 @Override |
9082 | 97 protected void addData(final Object d) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 log.debug("DeltaWtExporter.addData"); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 if (!(d instanceof CalculationResult)) { |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 log.warn("Invalid data type"); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 return; |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 |
9082 | 104 final Object data = ((CalculationResult) d).getData(); |
3415
e3c7a3228bc2
FixA: Renamed FixResult to FixAnalysisResult.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3402
diff
changeset
|
105 if (!(data instanceof FixAnalysisResult)) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 log.warn("Invalid data stored in result."); |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
107 return; |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 } |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
109 |
9082 | 110 final FixAnalysisResult result = (FixAnalysisResult) data; |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
111 this.analysisEvents.add(result.getAnalysisEventResults()); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
112 this.referenceEvents.add(result.getFixResultColumns()); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 @Override |
9082 | 116 protected void writeCSVData(final CSVWriter writer) throws IOException { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 writeCSVHeader(writer); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
120 final TreeMap<Double, List<String[]>> sorted = getRows(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
121 for (final List<String[]> list : sorted.values()) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
122 for (final String[] row : list) |
9306 | 123 writer.writeNext(row); |
124 } | |
125 | |
126 writer.flush(); | |
127 } | |
128 | |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
129 private TreeMap<Double, List<String[]>> getRows() { |
9082 | 130 final NumberFormat kmF = getKMFormatter(); |
131 final NumberFormat dwF = getDeltaWFormatter(); | |
132 final NumberFormat qF = getQFormatter(); | |
133 final NumberFormat wF = getWFormatter(); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 |
9082 | 135 final DateFormat dF = getDateFormatter(); |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
136 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
137 final TreeMap<Double, List<String[]>> sorted = new TreeMap<>(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 |
9082 | 139 final String referenceS = getReference(); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
141 for (final FixResultColumns referenceColumns : this.referenceEvents) { |
9082 | 142 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
143 appendRows(sorted, referenceColumns, referenceS, kmF, dwF, qF, wF, dF); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
144 } |
9082 | 145 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
146 final String analysisTemplate = getAnalysisTemplate(); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
147 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
148 int analysisCount = 1; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
149 for (final AnalysisPeriodEventResults analysisPeriodEventResults : this.analysisEvents) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
150 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
151 final Collection<FixResultColumns> analysisResults = analysisPeriodEventResults.getEventResults(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
152 for (final FixResultColumns analysisColumns : analysisResults) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
153 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
154 final String analyisS = MessageFormat.format(analysisTemplate, analysisCount); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
155 appendRows(sorted, analysisColumns, analyisS, kmF, dwF, qF, wF, dF); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
156 } |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
157 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
158 analysisCount++; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
159 } |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
160 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
161 return sorted; |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
162 } |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
163 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
164 private void appendRows(final TreeMap<Double, List<String[]>> sorted, final FixResultColumns resultColumns, final String referenceS, final NumberFormat kmF, |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
165 final NumberFormat dwF, final NumberFormat qF, final NumberFormat wF, final DateFormat dF) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
166 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
167 final Collection<FixResultColumn> cols = resultColumns.getSortedColumns(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
168 for (final FixResultColumn column : cols) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
169 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
170 final Date date = column.getDate(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
171 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
172 final KMIndex<QWD> qwds = column.getQWDs(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
173 for (final Entry<QWD> qwdEntry : qwds) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
174 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
175 final double km = qwdEntry.getKm(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
176 final QWD qwd = qwdEntry.getValue(); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
177 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
178 List<String[]> list = sorted.get(km); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
179 if (list == null) { |
9082 | 180 list = new ArrayList<>(); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
181 sorted.put(km, list); |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
182 } |
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
183 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
184 if (!qwd.isOutlier()) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
185 final String kmS = kmF.format(km); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
186 final String deltaWS = dwF.format(qwd.getDeltaW()); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
187 final String qS = qF.format(qwd.getQ()); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
188 final String wS = wF.format(qwd.getW()); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
189 final String dateS = dF.format(date); |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
190 |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
191 list.add(new String[] { kmS, dateS, qS, wS, referenceS, deltaWS }); |
5603
47e5bc64d3de
FixA: tab output ist now grouped by km and periods. Fixes flys/issue1163
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4736
diff
changeset
|
192 } |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
195 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
196 |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
197 /** Template to create "State" strings like A1,A2... */ |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
198 protected String getAnalysisTemplate() { |
9082 | 199 return Resources.getMsg(this.context.getMeta(), CSV_ANALYSIS, DEFAULT_CSV_ANALYSIS); |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
200 } |
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
201 |
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
202 protected String getReference() { |
9082 | 203 return Resources.getMsg(this.context.getMeta(), CSV_REFERENCE, DEFAULT_CSV_REFERENCE); |
3398
7f9fe694f8d1
FixA: Added time range column to Delta W(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3397
diff
changeset
|
204 } |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
205 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
206 protected NumberFormat getKMFormatter() { |
9082 | 207 return Formatter.getFixDeltaWKM(this.context); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
208 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
209 |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
210 protected NumberFormat getDeltaWFormatter() { |
9082 | 211 return Formatter.getFixDeltaWDeltaW(this.context); |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
212 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
213 |
9082 | 214 @Override |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
215 protected NumberFormat getQFormatter() { |
9082 | 216 return Formatter.getFixDeltaWQ(this.context); |
3397
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
217 } |
6d1740533810
FixA: Added discharge column to DeltaW(t) CSV export.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3217
diff
changeset
|
218 |
9082 | 219 @Override |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
220 protected NumberFormat getWFormatter() { |
9082 | 221 return Formatter.getFixDeltaWW(this.context); |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
222 } |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
223 |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
224 protected DateFormat getDateFormatter() { |
9082 | 225 final CallMeta meta = this.context.getMeta(); |
226 return Formatter.getDateFormatter(meta, Resources.getMsg(meta, CSV_T_FORMAT, DEFAULT_CSV_T_FORMAT)); | |
3402
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
227 } |
0336132ec9db
Adjusted Delta W(t) CSV exporter to customers wishes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3398
diff
changeset
|
228 |
9082 | 229 protected void writeCSVHeader(final CSVWriter writer) { |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
230 log.debug("DeltaWtExporter.writeCSVHeader"); |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
231 |
9082 | 232 /* |
233 * issue825 | |
234 * km; Ereignis, Abfluss, GEMESSENER Wasserstand; | |
235 * Status (RECHTSBÜNDIG), del W | |
236 */ | |
237 final RiverAccess river = new RiverAccess((D4EArtifact) this.master); | |
238 final String unit = river.getRiver().getWstUnit().getName(); | |
3644
fa633f6a5fd9
smaller part of issue825 fixed (column ordering of dwt-export).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
3415
diff
changeset
|
239 |
9082 | 240 writer.writeNext(new String[] { msg(CSV_KM_HEADER, DEFAULT_CSV_KM_HEADER), msg(CSV_T_HEADER, DEFAULT_CSV_T_HEADER), |
241 msg(CSV_Q_HEADER, DEFAULT_CSV_Q_HEADER), msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { unit }), | |
242 msg(CSV_TRANGE_HEADER, DEFAULT_CSV_TRANGE_DESC_HEADER), msg(CSV_DELTA_W_HEADER, DEFAULT_CSV_DELTA_W_HEADER) }); | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
243 } |
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
244 |
9306 | 245 private void addMetaData(final MetaAndTableJRDataSource source) { |
246 final D4EArtifact flys = (D4EArtifact) this.master; | |
247 final String user = CalculationUtils.findArtifactUser(this.context, flys); | |
248 final RangeAccess ra = new RangeAccess(flys); | |
249 final RiverInfo ri = new RiverInfo(ra.getRiver()); | |
250 | |
251 final DefaultCalculationResults results = new DefaultCalculationResults(msg("calculation.analysis"), user, ri, ra.getRange()); | |
252 final ExportContextPDF contextPdf = new ExportContextPDF(this.context, results); | |
253 contextPdf.addJRMetaDataDefaults(source); | |
9322 | 254 contextPdf.addJRMetaDataForModules(source); |
9306 | 255 |
256 /* column headings */ | |
257 contextPdf.addJRMetadata(source, "station_header", GeneralResultType.station); | |
258 contextPdf.addJRMetadata(source, "fix_date", msg(CSV_T_HEADER)); | |
259 contextPdf.addJRMetadata(source, "fix_q", msg(CSV_Q_HEADER)); | |
260 contextPdf.addJRMetadata(source, "fix_w", msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] { ri.getWstUnit() })); | |
261 contextPdf.addJRMetadata(source, "fix_state", msg(CSV_TRANGE_HEADER)); | |
262 contextPdf.addJRMetadata(source, "fix_delta_w", msg(CSV_DELTA_W_HEADER)); | |
263 } | |
264 | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
265 @Override |
9082 | 266 protected void writePDF(final OutputStream out) { |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
267 |
9306 | 268 final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource(); |
269 final String jasperFile = Resources.getMsg(this.context.getMeta(), JASPER_FILE); | |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
270 |
9306 | 271 addMetaData(source); |
272 try { | |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
273 final TreeMap<Double, List<String[]>> sorted = getRows(); // Custom Result could be nice, too... |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
274 for (final List<String[]> list : sorted.values()) { |
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
275 for (final String[] row : list) |
9306 | 276 source.addData(row); |
277 } | |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
9360
diff
changeset
|
278 |
9306 | 279 final JasperReporter reporter = new JasperReporter(); |
280 reporter.addReport(jasperFile, source); | |
281 reporter.exportPDF(out); | |
282 } | |
283 catch (final JRException je) { | |
284 log.warn("Error generating PDF Report!", je); | |
285 } | |
3216
a46910e61dfb
FixA: Moved DeltaWtExporter to fixings exporter package.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
286 } |
9306 | 287 } |