annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 627:c009d8df53aa

Removed a bug in pdf and svg creation. gnv-artifacts/trunk@702 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Tue, 23 Feb 2010 15:33:10 +0000
parents 3d13fa281a7e
children d08b9ba148c5
rev   line source
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
2 *
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
3 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
4 package de.intevation.gnv.state.timeseries;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
5
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
6 import au.com.bytecode.opencsv.CSVWriter;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
7
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
8 import de.intevation.artifactdatabase.Config;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
9 import de.intevation.artifactdatabase.XMLUtils;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
10
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
11 import de.intevation.artifacts.ArtifactNamespaceContext;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
12 import de.intevation.artifacts.CallContext;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
13 import de.intevation.artifacts.CallMeta;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
14 import de.intevation.artifacts.PreferredLocale;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
15
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
16 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
17
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
18 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
19
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
20 import de.intevation.gnv.chart.Chart;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
21 import de.intevation.gnv.chart.ChartLabels;
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
22 import de.intevation.gnv.chart.DefaultHistogram;
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
23 import de.intevation.gnv.chart.TimeSeriesChart;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
24 import de.intevation.gnv.chart.XMLChartTheme;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
25
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
26 import de.intevation.gnv.chart.exception.TechnicalChartException;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
27
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
28 import de.intevation.gnv.exports.ChartExportHelper;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
29 import de.intevation.gnv.exports.DefaultDataCollector;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
30 import de.intevation.gnv.exports.DefaultExport;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
31 import de.intevation.gnv.exports.DefaultProfile;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
32
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
33 import de.intevation.gnv.exports.Export.Profile;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
34
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
35 import de.intevation.gnv.exports.SimpleOdvDataCollector;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
36
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
37 import de.intevation.gnv.geobackend.base.Result;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
38
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
39 import de.intevation.gnv.histogram.HistogramHelper;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
40
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
41 import de.intevation.gnv.state.InputData;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
42 import de.intevation.gnv.state.OutputStateBase;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
43
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
44 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
45 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
46 import de.intevation.gnv.state.describedata.NamedArrayList;
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
47 import de.intevation.gnv.state.describedata.NamedCollection;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
48
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
49 import de.intevation.gnv.state.exception.StateException;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
50
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
51 import de.intevation.gnv.statistics.Statistic;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
52 import de.intevation.gnv.statistics.StatisticSet;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
53 import de.intevation.gnv.statistics.Statistics;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
54 import de.intevation.gnv.statistics.TimeseriesStatistics;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
55
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
56 import de.intevation.gnv.statistics.exception.StatisticsException;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
57
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
58 import de.intevation.gnv.timeseries.gap.DefaultTimeGap;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
59 import de.intevation.gnv.timeseries.gap.TimeGap;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
60
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
61 import de.intevation.gnv.utils.ArtifactXMLUtilities;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
62
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
63 import java.io.File;
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
64 import java.io.IOException;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
65 import java.io.OutputStream;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
66 import java.io.UnsupportedEncodingException;
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
67
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
68 import java.util.ArrayList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
69 import java.util.Collection;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 import java.util.Iterator;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
71 import java.util.List;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
72 import java.util.Locale;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 import java.util.Vector;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75 import org.apache.log4j.Logger;
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
76
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
77 import org.jfree.chart.ChartTheme;
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
78
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
79 import org.w3c.dom.Document;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
80 import org.w3c.dom.Element;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
81 import org.w3c.dom.Node;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
82 import org.w3c.dom.NodeList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
83
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 /**
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
86 * @author Tim Englich (tim.englich@intevation.de)
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
87 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de)
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
88 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
89 public class TimeSeriesOutputState extends OutputStateBase {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
90
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
91 protected static final boolean CACHE_CHART =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
92 Boolean.parseBoolean(System.getProperty("cache.chart", "false"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 protected static final boolean PDF_FORMAT_LANDSCAPE =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95 Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
96
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
97 protected static final String[] IMG_EXPORT_FORMAT = {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
98 "PNG", "JPEG", "GIF"
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 };
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102 * The UID of this Class
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 private static final long serialVersionUID = 4178407570503098858L;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107 * the logger, used to log exceptions and additonaly information
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 private static Logger log = Logger
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 .getLogger(TimeSeriesOutputState.class);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 private static List<TimeGap> timeGapDefinitions = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113
342
bb1afbbd93e4 Read x-axis label for timeseries charts from ressources, instead of a hard coded string in source.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 335
diff changeset
114 protected String domainLable = "chart.timeseries.title.xaxis";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
116 protected String featureValuesName = "featureid";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
117 protected String parameterValuesName = "parameterid";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
118 protected String measuremenValueName = "measurementid";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
119 protected String dateValueName = "dateid";
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
120
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
121 public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 "XORDINATE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 "YORDINATE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 "GROUP1",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
125 "GROUP2",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
126 "GROUP3"
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
127 };
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
128
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
129
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
130 public static final String [] TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL = {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
131 "Date/Time",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
132 "Value",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
133 "ParameterID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
134 "MeasurementID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
135 "TimeseriesID"
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
136 };
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
137
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
138 public static final String [] TIMESERIES_MESH_CSV_COLUMN_LABEL = {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
139 "Date/Time",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
140 "Value",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
141 "ParameterID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
142 "FeatureID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
143 "MeshID"
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
144 };
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
145
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
146 public static final String [] TIMESERIES_ODV_PROFILE_NAMES = {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
147 "CRUISE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
148 "STATION",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
149 "TYPE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
150 "SHAPE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
151 "BOTDEPTH",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
152 "DEPTH",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
153 "TIMEVALUE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
154 "DATAVALUE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
155 "PARAMETER"
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
156 };
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
157
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
158
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
159 public static final String [] ODV_COLUMN_HEADER = {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
160 "Cruise",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
161 "Station",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
162 "Type",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
163 "Longitude [deegrees_east]",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
164 "Latitude [deegrees_north]",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
165 "Bot. Depth [m]",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
166 "Depth [m]",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 "Date/Time",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 "Value",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 "Parameterid"
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 };
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
171
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 * Profile for exporting data to odv
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 * TODO Change TIMESERIES_PROFILE_NAMES, which belong to CSV exports
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
175 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 public static final Profile TIMESERIES_ODV_PROFILE =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177 new DefaultProfile(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178 ODV_COLUMN_HEADER,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
179 '\t',
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
180 CSVWriter.NO_QUOTE_CHARACTER,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
181 CSVWriter.NO_ESCAPE_CHARACTER,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 "ODV",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 "ISO-8859-1");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
186 * Constructor
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
187 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
188 public TimeSeriesOutputState() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189 super();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
191
536
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
192
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
193 @Override
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
194 public void initialize(String uuid, CallContext context)
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
195 throws StateException
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
196 {
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
197 getChartResult(uuid, context);
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
198 }
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
199
f1dc3c2f9be7 Calculate results and put them into cache when reaching the output state - avoids latencies.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 535
diff changeset
200
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
201 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
202 * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 * java.util.Collection, java.io.OutputStream, java.lang.String,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204 * de.intevation.artifacts.CallMeta)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
206 public void out(
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
207 Document format,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
208 Collection<InputData> inputData,
480
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
209 OutputStream outputStream,
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
210 String uuid,
211cad2fb5ba Rebased "Horizonalschnitte" to own state class to break from the not
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 467
diff changeset
211 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
212 ) throws StateException
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214 log.debug("TimeSeriesOutputTransition.out");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
215
467
b2d2b36b20a0 Use XMLUtils to evaluate xpath expressions instead of using Config class. Adapted xpath (namespace and prefix).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 454
diff changeset
216 String outputMode = XMLUtils.xpathString(
b2d2b36b20a0 Use XMLUtils to evaluate xpath expressions instead of using Config class. Adapted xpath (namespace and prefix).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 454
diff changeset
217 format, XPATH_OUTPUT_MODE, ArtifactNamespaceContext.INSTANCE);
b2d2b36b20a0 Use XMLUtils to evaluate xpath expressions instead of using Config class. Adapted xpath (namespace and prefix).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 454
diff changeset
218
b2d2b36b20a0 Use XMLUtils to evaluate xpath expressions instead of using Config class. Adapted xpath (namespace and prefix).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 454
diff changeset
219 String mimeType = XMLUtils.xpathString(
b2d2b36b20a0 Use XMLUtils to evaluate xpath expressions instead of using Config class. Adapted xpath (namespace and prefix).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 454
diff changeset
220 format, XPATH_MIME_TYPE, ArtifactNamespaceContext.INSTANCE);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
221
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
222 CallMeta callMeta = callContext.getMeta();
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
223
502
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
224 int chartWidth = 600;
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
225 int chartHeight = 400;
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
226 boolean sVisible = false;
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
227
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
228 // lines are always visible. if lines should be configurable we need a
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
229 // parameter in the user interface
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
230 boolean lVisible = true;
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
231
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
232 try {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
233 if (inputData != null) {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
234 Iterator<InputData> it = inputData.iterator();
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
235 while (it.hasNext()) {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
236 InputData ip = it.next();
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
237 String optionName = ip.getName().trim();
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
238
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
239 if (optionName.equals("width")) {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
240 chartWidth = Integer.parseInt(ip.getValue());
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
241 }
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
242 else if (optionName.equals("height")) {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
243 chartHeight = Integer.parseInt(ip.getValue());
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
244 }
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
245 else if (optionName.equals("points")) {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
246 sVisible = Boolean.parseBoolean(ip.getValue());
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
247 }
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
248 }
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
249 }
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
250 } catch (NumberFormatException e) {
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
251 log.error(e, e);
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
252 throw new StateException(e);
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
253 }
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
254
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
255 try {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
256 if (outputMode.equalsIgnoreCase("chart")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
257 log.debug("Chart will be generated.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
258
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
259 PreferredLocale[] locales = callMeta.getLanguages();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
260 Locale[] serverLocales =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
261 RessourceFactory.getInstance().getLocales();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
262 Locale locale =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
263 callMeta.getPreferredLocale(serverLocales);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
264
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
265 log.debug(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
266 "Best locale - regarding intersection of server and " +
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
267 "browser locales - is " + locale.toString()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
268 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
269
611
4b818f13e20a Repaired chart creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 610
diff changeset
270 Collection parameters = this.getParameters(uuid);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
271 Collection measurements = this.getMeasurements(uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
272 Collection dates = this.getDates(uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
273
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
274 ChartLabels chartLables = createChartLabels(locale, uuid);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
275
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
276 String exportFormat = getExportFormat(mimeType);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
277
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
278 this.createChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
279 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
280 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
281 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
282 dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
283 chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
284 callContext,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
285 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
286 exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
287 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
288 chartWidth,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
289 chartHeight,
502
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
290 lVisible,
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
291 sVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
292 callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
293 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
294 }
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
295 else if (outputMode.equalsIgnoreCase("histogram")) {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
296 log.debug("Create histogram.");
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
297
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
298 Collection results = (Collection)
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
299 getChartResult(uuid, callContext);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
300
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
301 String exportFormat = getExportFormat(mimeType);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
302 Collection<KeyValueDescibeData> parameters = getParameters(uuid);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
303 Collection<KeyValueDescibeData> measurements = getMeasurements(uuid);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
304 Collection<KeyValueDescibeData> dates = getDates(uuid);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
305 Object[][] data = HistogramHelper.prepareHistogramData(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
306 results, parameters, measurements, dates);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
307
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
308 int size = data.length;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
309 Chart[] histograms = new Chart[size];
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
310
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
311 for (int i = 0; i < size; i++) {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
312 ChartLabels labels = createHistogramLabels(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
313 uuid, callContext, data[i]);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
314
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
315 ChartTheme theme = createStyle(callContext);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
316
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
317 histograms[i] = new DefaultHistogram(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
318 labels, data[i], theme);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
319 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
320
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
321 ChartExportHelper.exportHistograms(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
322 outputStream,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
323 histograms,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
324 exportFormat,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
325 chartWidth,
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
326 chartHeight
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
327 );
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
328 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
329 else if (outputMode.equalsIgnoreCase("pdf")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
330 log.debug("Output mode == pdf");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
331
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
332 Locale[] serverLocales =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
333 RessourceFactory.getInstance().getLocales();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
334 Locale locale =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
335 callMeta.getPreferredLocale(serverLocales);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
336
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
337 log.debug(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
338 "Best locale - regarding intersection of server and " +
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
339 "browser locales - is " + locale.toString()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
340 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
341
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
342 createPDF(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
343 outputStream,
627
c009d8df53aa Removed a bug in pdf and svg creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 617
diff changeset
344 getParameters(uuid),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
345 getMeasurements(uuid),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
346 getDates(uuid),
535
a162793b6053 Solved issue158. Added labels to 'Profilschnitte'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 502
diff changeset
347 createChartLabels(locale, uuid),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
348 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
349 "A4",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
350 true,
502
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
351 lVisible,
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
352 sVisible,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
353 locale,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
354 callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
355 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
356 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
357 else if (outputMode.equalsIgnoreCase("svg")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
358 log.debug("Output mode == svg");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
359
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
360 Locale[] serverLocales =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
361 RessourceFactory.getInstance().getLocales();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
362 Locale locale =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
363 callMeta.getPreferredLocale(serverLocales);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
364
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
365 log.debug(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
366 "Best locale - regarding intersection of server and " +
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
367 "browser locales - is " + locale.toString()
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
368 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
369
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
370 createSVG(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
371 outputStream,
627
c009d8df53aa Removed a bug in pdf and svg creation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 617
diff changeset
372 getParameters(uuid),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
373 getMeasurements(uuid),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
374 getDates(uuid),
535
a162793b6053 Solved issue158. Added labels to 'Profilschnitte'.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 502
diff changeset
375 createChartLabels(locale, uuid),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
376 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
377 locale,
502
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
378 chartWidth,
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
379 chartHeight,
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
380 lVisible,
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
381 sVisible,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
382 callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
383 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
384 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
385 else if (outputMode.equalsIgnoreCase("csv")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
386 log.debug("CSV-File will be generated.");
452
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
387 Object result = getChartResult(uuid, callContext);
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
388 if (result instanceof Collection) {
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
389 this.createCSV(
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
390 outputStream,
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
391 (Collection<Result>)result);
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
392 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
393 } else if (outputMode.equalsIgnoreCase("statistics")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
394 log.debug("Statistics will be generated.");
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
395
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
396 Collection<StatisticSet> statistics;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
397
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
398 Statistics s = getStatisticsGenerator();
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
399 Object result = getChartResult(uuid, callContext);
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
400
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
401 if (result != null && s != null) {
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
402 Collection<KeyValueDescibeData> parameters =
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
403 getParameters(uuid);
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
404
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
405 Collection<KeyValueDescibeData> measurements =
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
406 getMeasurements(uuid);
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
407
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
408 Collection<KeyValueDescibeData> dates =
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
409 getDates(uuid);
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
410
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
411 statistics = s.calculateStatistics(
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
412 result,
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
413 parameters,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
414 measurements,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
415 dates);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
416 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
417 else {
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
418 statistics = new ArrayList<StatisticSet>();
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
419 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
420
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
421 Document doc = writeStatistics2XML(statistics);
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
422
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
423 XMLUtils.toStream(doc, outputStream);
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
424
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
425 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
426 else if (outputMode.equalsIgnoreCase("odv")) {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
427 Collection<Result> odvResult = this.getODVResult(uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
428 this.createODV(outputStream, odvResult);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
429 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
430 } catch (IOException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
431 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
432 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
433 } catch (TechnicalChartException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
434 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
435 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
436 } catch (StatisticsException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
437 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
438 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
439 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
440 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
441
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
442
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
443 protected String getExportFormat(String mime) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
444 for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
445 if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
446 return IMG_EXPORT_FORMAT[i];
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
447 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
448
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
449 // no format found relating to mimeType, default export as PNG
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
450 return IMG_EXPORT_FORMAT[0];
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
451 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
452
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
453
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
454 protected Collection getCleanedParameters(Collection parameters) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
455 Iterator iter = parameters.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
456 Collection parameter = new Vector(parameters);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
457 while (iter.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
458 KeyValueDescibeData data = (KeyValueDescibeData)iter.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
459 if (!data.isSelected())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
460 parameter.remove(data);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
461 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
462
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
463 return parameter;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
464 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
465
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
466
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
467 protected Collection getCleanedParameters(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
468 return getCleanedParameters(getParameters(uuid));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
469 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
470
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
471
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
472 protected void createCSV(OutputStream out, Collection<Result> results)
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
473 throws UnsupportedEncodingException, IOException, StateException
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
474 {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
475 Iterator iter = results.iterator();
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
476 Result res = iter.hasNext() ? (Result) iter.next() : null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
477
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
478 if (res == null)
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
479 return;
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
480
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
481 Profile profile = null;
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
482 int dataid = res.getInteger("DATAID").intValue();
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
483
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
484 // on meshes
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
485 if (dataid == 2) {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
486 profile = new DefaultProfile(
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
487 TIMESERIES_MESH_CSV_COLUMN_LABEL,
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
488 ',',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
489 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
490 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
491 "CSV",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
492 "ISO-8859-1");
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
493 }
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
494
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
495 // on timeseries
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
496 else {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
497 profile = new DefaultProfile(
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
498 TIMESERIES_TIMESERIES_CSV_COLUMN_LABEL,
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
499 ',',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
500 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
501 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
502 "CSV",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
503 "ISO-8859-1");
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
504 }
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
505
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
506 DefaultExport export = new DefaultExport(
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
507 new DefaultDataCollector(TIMESERIES_CSV_PROFILE_COLUMNS));
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
508 export.create(profile, out, results);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
509 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
510
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
511
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
512 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
513 * TODO Result is not used at the moment. Change result with correct data.
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
514 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
515 protected void createODV(OutputStream outputStream, Collection result)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
516 throws IOException, StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
517
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
518 DefaultExport export = new DefaultExport(new SimpleOdvDataCollector(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
519 TIMESERIES_ODV_PROFILE_NAMES));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
520
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
521 if (result == null)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
522 log.error("#################### RESULT == NULL #################");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
523 export.create(TIMESERIES_ODV_PROFILE, outputStream, result);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
524 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
525
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
526 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
527 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
528 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
529 protected Statistics getStatisticsGenerator() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
530 Statistics s = new TimeseriesStatistics();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
531 return s;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
532 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
533
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
534 protected Document writeStatistics2XML( Collection<StatisticSet> statistic) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
535 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
536 Document doc = XMLUtils.newDocument();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
537 if (statistic != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
538 Node statisticResults = xmlUtilities.createArtifactElement(doc,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
539 "statistics");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
540 doc.appendChild(statisticResults);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
541 Iterator<StatisticSet> it = statistic.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
542 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
543 StatisticSet set = it.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
544 Element setElement = xmlUtilities.createArtifactElement(doc,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
545 "statistic");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
546 setElement.setAttribute("name", set.getName());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
547
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
548 Iterator<Statistic> sit = set.getStatistics().iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
549 while (sit.hasNext()){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
550 Statistic s = sit.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
551 Element result = xmlUtilities.createArtifactElement(doc,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
552 "statistic-value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
553 result.setAttribute("name", s.getKey());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
554 result.setAttribute("value", s.getStringValue());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
555 setElement.appendChild(result);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
556 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
557 statisticResults.appendChild(setElement);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
558 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
559
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
560 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
561 return doc;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
562 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
563
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
564
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
565 protected String getSelectedFeatureName(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
566 Collection values = getCollection(featureValuesName, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
567
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
568 if (values != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
569 Iterator it = values.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
570
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
571 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
572 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
573 return data.getValue();
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
574 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
575
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
576 return "";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
577 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
578 return "";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
579 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
580
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
581
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
582 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
583 * @param outputStream
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
584 * @param parameters
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
585 * @param measurements
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
586 * @param timeSeriesName
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
587 * @param chartStyle
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
588 * @param chartLables
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
589 * @throws IOException
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
590 * @throws TechnicalChartException
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
591 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
592 protected void createChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
593 OutputStream outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
594 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
595 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
596 Collection dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
597 ChartLabels chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
598 CallContext context,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
599 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
600 String exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
601 Locale locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
602 int width,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
603 int height,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
604 boolean linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
605 boolean shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
606 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
607 )
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
608 throws IOException, TechnicalChartException
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
609 {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
610 log.debug("Create chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
611 Chart chart = getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
612 chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
613 createStyle(context),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
614 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
615 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
616 dates,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
617 getChartResult(uuid, callContext),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
618 locale, // Locale
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
619 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
620 linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
621 shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
622 callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
623 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
624
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
625 if (chart == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
626 log.error("Could not initialize chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
627 return;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
628 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
629
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
630 log.debug(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
631 "export chart as " + exportFormat +
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
632 " in " + width + "x" + height
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
633 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
634
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
635 ChartExportHelper.exportImage(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
636 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
637 chart.generateChart(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
638 exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
639 width,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
640 height
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
641 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
642 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
643
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
644
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
645 protected void createPDF(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
646 OutputStream outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
647 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
648 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
649 Collection dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
650 ChartLabels chartLables,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
651 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
652 String exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
653 boolean landscape,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
654 boolean linesVisible,
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
655 boolean shapesVisible,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
656 Locale locale,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
657 CallContext context
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
658 ) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
659 Chart chart = getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
660 chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
661 createStyle(context),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
662 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
663 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
664 dates,
452
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
665 getChartResult(uuid, context),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
666 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
667 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
668 linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
669 shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
670 context
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
671 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
672
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
673 if (chart == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
674 log.error("Could not initialize chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
675 return;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
676 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
677
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
678 ChartExportHelper.exportPDF(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
679 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
680 chart.generateChart(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
681 "A4",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
682 PDF_FORMAT_LANDSCAPE,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
683 50F, 50F, 50F, 50F
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
684 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
685 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
686
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
687
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
688 protected void createSVG(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
689 OutputStream outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
690 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
691 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
692 Collection dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
693 ChartLabels chartLables,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
694 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
695 Locale locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
696 int width,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
697 int height,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
698 boolean linesVisible,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
699 boolean shapesVisible,
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
700 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
701 ) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
702 Chart chart = getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
703 chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
704 createStyle(callContext),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
705 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
706 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
707 dates,
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
708 getChartResult(uuid, callContext),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
709 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
710 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
711 linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
712 shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
713 callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
714 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
715
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
716 if (chart == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
717 log.error("Could not initialize chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
718 return;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
719 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
720
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
721 ChartExportHelper.exportSVG(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
722 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
723 chart.generateChart(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
724 null,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
725 600, 400
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
726 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
727
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
728 log.debug("svg export finished.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
729 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
730
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
731
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
732 protected Chart getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
733 ChartLabels chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
734 ChartTheme theme,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
735 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
736 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
737 Collection dates,
429
bed9735adf84 Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
738 Object result,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
739 Locale locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
740 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
741 boolean linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
742 boolean shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
743 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
744 ) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
745 Chart chart = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
746
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
747 if (CACHE_CHART) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
748 log.info("Try to get timeseries chart from cache.");
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
749 chart = (Chart) getChartFromCache(uuid, callContext);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
750 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
751
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
752 if (chart != null)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
753 return chart;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
754
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
755 log.info("Chart not in cache yet.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
756 chart = new TimeSeriesChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
757 chartLables,
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
758 theme,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
759 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
760 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
761 dates,
429
bed9735adf84 Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
762 (Collection)result,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
763 timeGapDefinitions,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
764 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
765 linesVisible,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
766 shapesVisible
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
767 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
768 chart.generateChart();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
769
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
770 if (CACHE_CHART) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
771 log.info("Put chart into cache.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
772 purifyChart(chart, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
773 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
774
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
775 return chart;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
776 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
777
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
778 protected ChartTheme createStyle(CallContext callContext) {
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
779 log.debug("Fetch chart theme from global context");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
780
358
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
781 GNVArtifactContext context =
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
782 (GNVArtifactContext) callContext.globalContext();
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
783
2f7a28f211c7 Fetch ChartTheme from CallContext instead of creating it each time before creating a chart.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 342
diff changeset
784 XMLChartTheme theme = (XMLChartTheme) context.get(
443
da21c256a0ba "horizontale Schnittprofile" are now configured via conf.xml
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 439
diff changeset
785 GNVArtifactContext.CHART_TEMPLATE_KEY);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
786
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
787 return theme;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
788 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
789
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
790 protected ChartLabels createChartLabels(Locale locale, String uuid) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
791 return new ChartLabels(
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
792 createChartTitle(locale, uuid),
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
793 createChartSubtitle(locale, uuid),
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
794 RessourceFactory.getInstance().getRessource(
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
795 locale,
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
796 domainLable,
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
797 domainLable
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
798 )
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
799 );
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
800 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
801
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
802
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
803 protected String createChartTitle(Locale locale, String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
804 return getFisName(locale);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
805
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
806 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
807
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
808
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
809 protected String createChartSubtitle(Locale locale, String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
810 return getSelectedFeatureName(uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
811 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
812
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
813
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
814 protected ChartLabels createHistogramLabels(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
815 String uuid, CallContext context, Object[] data)
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
816 {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
817 return new ChartLabels((String) data[0], "", "");
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
818 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
819
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
820
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
821 protected String getFisName(Locale locale) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
822 String returnValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
823 InputData input = inputData.get("fisname");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
824
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
825 if (input != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
826 String value = input.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
827
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
828 returnValue = RessourceFactory.getInstance().getRessource(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
829 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
830 value,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
831 value
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
832 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
833 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
834 return returnValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
835 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
836
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
837
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
838 protected String getSelectedInputDataName(String uuid, String key) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
839 Collection values = getCollection(key, uuid);
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
840
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
841 if (values != null) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
842 Iterator it = values.iterator();
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
843
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
844 while (it.hasNext()) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
845 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
846
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
847 if (data.isSelected()) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
848 return data.getValue();
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
849 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
850 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
851 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
852 return null;
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
853 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
854
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
855
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
856 protected Collection<KeyValueDescibeData> getParameters(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
857 return this.getCollection(parameterValuesName, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
858 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
859
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
860 protected Collection<KeyValueDescibeData> getMeasurements(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
861 return this.getCollection(measuremenValueName, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
862 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
863 protected Collection<KeyValueDescibeData> getDates(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
864 return this.getCollection(dateValueName,uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
865 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
866
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
867 @Override
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
868 public void setup(Node configuration) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
869 super.setup(configuration);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
870 String featureNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
871 "value-names/value-name[@name='feature']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
872 if (featureNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
873 this.featureValuesName = featureNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
874 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
875 String parameterNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
876 "value-names/value-name[@name='parameter']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
877 if (parameterNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
878 this.parameterValuesName = parameterNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
879 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
880 String measurementNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
881 "value-names/value-name[@name='measurement']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
882 if (measurementNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
883 this.measuremenValueName = measurementNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
884 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
885
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
886 String dateNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
887 "value-names/value-name[@name='date']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
888 if (dateNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
889 this.dateValueName = dateNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
890 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
891 if (timeGapDefinitions == null){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
892 Element gapDefinition = (Element)Config.getNodeXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
893 "time-gap-definition");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
894 synchronized (this.getClass()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
895 if (gapDefinition != null){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
896 String link = gapDefinition.getAttribute("xlink:href");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
897 if (link != null ){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
898 String absolutFileName = Config.replaceConfigDir(link);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
899 gapDefinition = (Element)new ArtifactXMLUtilities().
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
900 readConfiguration(absolutFileName);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
901 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
902
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
903 NodeList gapDefinitions = Config.getNodeSetXPath(gapDefinition,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
904 "/time-gaps/time-gap");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
905 if (gapDefinition != null){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
906 timeGapDefinitions = new ArrayList<TimeGap>(gapDefinitions.
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
907 getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
908 for (int i = 0; i < gapDefinitions.getLength(); i++){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
909 Element gapNode = (Element)gapDefinitions.item(i);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
910 String unit = gapNode.getAttribute("unit");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
911 int key = Integer.parseInt(gapNode.getAttribute("key"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
912 int value = Integer.parseInt(gapNode.getAttribute("gap"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
913 log.info("Add new Timegap: "+key+" "+value+" "+ unit);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
914 timeGapDefinitions.add(new DefaultTimeGap(unit,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
915 key,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
916 value));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
917 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
918 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
919 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
920 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
921 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
922 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
923
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
924 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
925 * @param collectionName
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
926 * @return
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
927 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
928 protected Collection<KeyValueDescibeData> getCollection(
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
929 String collectionName,
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
930 String uuid)
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
931 {
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
932 NamedCollection<KeyValueDescibeData> c = new NamedArrayList<KeyValueDescibeData>(collectionName);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
933
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
934 InputData data = inputData.get(collectionName);
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
935 if (data == null) {
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
936 log.warn("No collection found with name: " + collectionName);
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
937 return c;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
938 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
939
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
940 String[] descs = data.getDescription();
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
941 String[] values = data.splitValue();
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
942 int size = values.length;
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
943
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
944 for (int i = 0; i < size; i++){
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
945 c.add(new DefaultKeyValueDescribeData(
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
946 values[i], descs[i], getID()));
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
947 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
948
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
949 return c;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
950 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
951 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
952 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org