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