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