annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 610:6484464d2059

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

http://dive4elements.wald.intevation.org