Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java @ 208:a33d59f5791a
Use super.identifier as uuid. issue3
gnv-artifacts/trunk@264 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Fri, 23 Oct 2009 14:26:45 +0000 |
parents | d87347142702 |
children | 3dcd2b0b456e |
rev | line source |
---|---|
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
1 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
2 * |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
3 */ |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
4 package de.intevation.gnv.transition.timeseries; |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
5 |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
6 import java.awt.Color; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
7 import java.awt.Dimension; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
8 import java.io.IOException; |
73
504570de21fd
Refactoring Work depending on Infrastructurchanges in the Artifact-Module
Tim Englich <tim.englich@intevation.de>
parents:
68
diff
changeset
|
9 import java.io.OutputStream; |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
10 import java.io.OutputStreamWriter; |
177
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
11 import java.io.UnsupportedEncodingException; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
12 import java.util.Collection; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
13 import java.util.Iterator; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
14 |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
15 import javax.xml.transform.Transformer; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
16 import javax.xml.transform.TransformerConfigurationException; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
17 import javax.xml.transform.TransformerException; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
18 import javax.xml.transform.TransformerFactory; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
19 import javax.xml.transform.TransformerFactoryConfigurationError; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
20 import javax.xml.transform.dom.DOMSource; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
21 import javax.xml.transform.stream.StreamResult; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
22 |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
23 import org.apache.log4j.Logger; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
24 import org.w3c.dom.Document; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
25 import org.w3c.dom.Element; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
26 import org.w3c.dom.Node; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
27 |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
28 import au.com.bytecode.opencsv.CSVWriter; |
119 | 29 import de.intevation.artifactdatabase.Config; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
30 import de.intevation.artifactdatabase.XMLUtils; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
31 import de.intevation.artifacts.CallMeta; |
178
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
32 import de.intevation.artifacts.PreferredLocale; |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
33 import de.intevation.gnv.artifacts.ressource.RessourceFactory; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
34 import de.intevation.gnv.chart.ChartFactory; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
35 import de.intevation.gnv.chart.ChartLabels; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
36 import de.intevation.gnv.chart.ChartStyle; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
37 import de.intevation.gnv.chart.exception.TechnicalChartException; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
38 import de.intevation.gnv.geobackend.base.Result; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
39 import de.intevation.gnv.statistics.Statistic; |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
40 import de.intevation.gnv.statistics.Statistics; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
41 import de.intevation.gnv.statistics.TimeseriesStatistics; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
42 import de.intevation.gnv.statistics.exception.StatisticsException; |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
43 import de.intevation.gnv.transition.InputData; |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
44 import de.intevation.gnv.transition.OutputTransitionBase; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
45 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; |
81
9b41f3688610
Added Support for TimeSeriesMesh
Tim Englich <tim.englich@intevation.de>
parents:
73
diff
changeset
|
46 import de.intevation.gnv.transition.describedata.NamedCollection; |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
47 import de.intevation.gnv.transition.exception.TransitionException; |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
48 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
49 |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
50 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
51 * @author Tim Englich <tim.englich@intevation.de> |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
52 * |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
53 */ |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
54 public class TimeSeriesOutputTransition extends OutputTransitionBase { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
55 |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
56 /** |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
57 * The UID of this Class |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
58 */ |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
59 private static final long serialVersionUID = 4178407570503098858L; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
60 |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
61 /** |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
62 * the logger, used to log exceptions and additonaly information |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
63 */ |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
64 private static Logger log = Logger |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
65 .getLogger(TimeSeriesOutputTransition.class); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
66 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
67 protected String domainLable = "Zeit [UTC]"; |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
68 |
119 | 69 protected String featureValuesName = "featureid"; |
70 protected String parameterValuesName = "parameterid"; | |
71 protected String measuremenValueName = "measurementid"; | |
179
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
72 protected String dateValueName = "dateid"; |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
73 |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
74 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
75 * Constructor |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
76 */ |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
77 public TimeSeriesOutputTransition() { |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
78 super(); |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
79 } |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
80 |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
81 /** |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
82 * @see de.intevation.gnv.transition.Transition#validate() |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
83 */ |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
84 @Override |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
85 public boolean validate() { |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
86 return true; |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
87 } |
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
88 |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
89 /** |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
90 * @see de.intevation.gnv.transition.OutputTransition#out(java.lang.String, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
91 * java.util.Collection, java.io.OutputStream, java.lang.String, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
92 * de.intevation.artifacts.CallMeta) |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
93 */ |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
94 public void out(String outputMode, Collection<InputData> inputData, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
95 OutputStream outputStream, String uuid, CallMeta callMeta) |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
96 throws TransitionException { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
97 log.debug("TimeSeriesOutputTransition.out"); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
98 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
99 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
100 this.advance(uuid, callMeta); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
101 Collection<Result> chartResult = this.getChartResult(uuid); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
102 if (outputMode.equalsIgnoreCase("chart")) { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
103 log.debug("Chart will be generated."); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
104 int chartWidth = 600; |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
105 int chartHeight = 400; |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
106 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
107 if (inputData != null) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
108 Iterator<InputData> it = inputData.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
109 while (it.hasNext()) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
110 InputData ip = it.next(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
111 if (ip.getName().equalsIgnoreCase("width")) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
112 chartWidth = Integer.parseInt(ip.getValue()); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
113 } else if (ip.getName().equalsIgnoreCase("height")) { |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
114 chartHeight = Integer.parseInt(ip.getValue()); |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
115 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
116 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
117 } |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
118 } catch (NumberFormatException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
119 log.error(e, e); |
91
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
120 throw new TransitionException(e); |
bd284d8306db
Added Support for Patameters in OutputModes
Tim Englich <tim.englich@intevation.de>
parents:
90
diff
changeset
|
121 } |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
122 Collection<KeyValueDescibeData> parameters = this.getParameters(uuid); |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
123 Collection<KeyValueDescibeData> measurements = this.getMeasurements(uuid); |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
124 Collection<KeyValueDescibeData> dates = this.getDates(uuid); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
125 ChartStyle chartStyle = this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
126 .creatStyle(chartWidth, chartHeight); |
178
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
127 ChartLabels chartLables = new ChartLabels(this.getFisName(callMeta.getLanguages())+" "+this |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
128 .getSelectedFeatureName(uuid), this.domainLable); |
179
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
129 this.createChart(outputStream, parameters, measurements,dates, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
130 chartStyle, chartLables, uuid); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
131 } else if (outputMode.equalsIgnoreCase("csv")) { |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
132 log.debug("CSV-File will be generated."); |
177
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
133 this.createCSV(outputStream, chartResult); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
134 } else if (outputMode.equalsIgnoreCase("statistics")) { |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
135 log.debug("Statistics will be generated."); |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
136 Statistics s = getStatisticsGenerator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
137 Collection<Statistic> statistics = s |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
138 .calculateStatistics(chartResult); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
139 Document doc = this.writeStatistics2XML(statistics); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
140 this.writeDocument2OutputStream(doc, outputStream); |
90
6bdef6e590d6
Added CSV-Support and do some performanceimprovments
Tim Englich <tim.englich@intevation.de>
parents:
86
diff
changeset
|
141 } |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
142 } catch (IOException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
143 log.error(e, e); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
144 throw new TransitionException(e); |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
145 } catch (TechnicalChartException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
146 log.error(e, e); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
147 throw new TransitionException(e); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
148 } catch (StatisticsException e) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
149 log.error(e, e); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
150 throw new TransitionException(e); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
151 } |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
152 } |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
153 |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
154 /** |
177
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
155 * @param outputStream |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
156 * @param chartResult |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
157 * @throws UnsupportedEncodingException |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
158 * @throws IOException |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
159 * @throws TransitionException |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
160 */ |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
161 protected void createCSV(OutputStream outputStream, |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
162 Collection<Result> chartResult) |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
163 throws UnsupportedEncodingException, |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
164 IOException, |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
165 TransitionException { |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
166 if (chartResult != null) { |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
167 CSVWriter writer = new CSVWriter(new OutputStreamWriter( |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
168 outputStream, "ISO-8859-1"), ','); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
169 // USE THIS ENCODING BECAUSE OF |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
170 // PROBLEMS WITH EXCEL AND UTF-8 |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
171 Iterator<Result> it = chartResult.iterator(); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
172 while (it.hasNext()) { |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
173 Result result = it.next(); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
174 int i = 0; |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
175 String[] entries = new String[5]; |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
176 entries[i++] = result.getString("XORDINATE"); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
177 entries[i++] = result.getString("YORDINATE"); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
178 entries[i++] = result.getString("GROUP1"); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
179 entries[i++] = result.getString("GROUP2"); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
180 entries[i++] = result.getString("GROUP3"); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
181 writer.writeNext(entries); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
182 } |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
183 writer.close(); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
184 } else { |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
185 log.error("No Data given for generation an CSV-File."); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
186 throw new TransitionException( |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
187 "No Data given for generation an CSV-File."); |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
188 } |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
189 } |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
190 |
08b8b79b30ff
Integrated special CSV-Export for HorizontalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
171
diff
changeset
|
191 /** |
98
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
192 * @return |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
193 */ |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
194 protected Statistics getStatisticsGenerator() { |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
195 Statistics s = new TimeseriesStatistics(); |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
196 return s; |
156db25ad4b4
Add Statisticssupport also to VerticalProfiles
Tim Englich <tim.englich@intevation.de>
parents:
95
diff
changeset
|
197 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
198 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
199 protected void writeDocument2OutputStream(Document document, OutputStream os) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
200 |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
201 try { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
202 TransformerFactory transformerFactory = TransformerFactory |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
203 .newInstance(); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
204 Transformer transformer = transformerFactory.newTransformer(); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
205 DOMSource source = new DOMSource(document); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
206 StreamResult result = new StreamResult(os); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
207 transformer.transform(source, result); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
208 } catch (TransformerConfigurationException e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
209 log.error(e, e); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
210 } catch (TransformerFactoryConfigurationError e) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
211 log.error(e, e); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
212 } catch (TransformerException e) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
213 log.error(e, e); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
214 } |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
215 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
216 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
217 protected Document writeStatistics2XML(Collection<Statistic> statistic) { |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
218 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities(); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
219 Document doc = XMLUtils.newDocument(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
220 if (statistic != null) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
221 Node statisticResults = xmlUtilities.createArtifactElement(doc, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
222 "statistic-values"); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
223 doc.appendChild(statisticResults); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
224 Iterator<Statistic> it = statistic.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
225 while (it.hasNext()) { |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
226 Statistic s = it.next(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
227 Element result = xmlUtilities.createArtifactElement(doc, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
228 "statistic"); |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
229 result.setAttribute("name", s.getKey()); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
230 result.setAttribute("value", s.getStringValue()); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
231 statisticResults.appendChild(result); |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
232 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
233 |
95
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
234 } |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
235 return doc; |
13402ac8d8fe
Put the Statisticscalulation to the Outmethod of the OutputTransition.
Tim Englich <tim.englich@intevation.de>
parents:
91
diff
changeset
|
236 } |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
237 |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
238 protected String getSelectedFeatureName(String uuid) { |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
239 Collection<KeyValueDescibeData> values = this |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
240 .getCollection(featureValuesName, uuid); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
241 if (values != null) { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
242 Iterator<KeyValueDescibeData> it = values.iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
243 while (it.hasNext()) { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
244 KeyValueDescibeData data = it.next(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
245 if (data.isSelected()) { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
246 return data.getValue(); |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
247 } |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
248 } |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
249 } |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
250 return null; |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
251 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
252 |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
253 /** |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
254 * @param outputStream |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
255 * @param parameters |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
256 * @param measurements |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
257 * @param timeSeriesName |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
258 * @param chartStyle |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
259 * @param chartLables |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
260 * @throws IOException |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
261 * @throws TechnicalChartException |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
262 */ |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
263 protected void createChart(OutputStream outputStream, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
264 Collection<KeyValueDescibeData> parameters, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
265 Collection<KeyValueDescibeData> measurements, |
179
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
266 Collection<KeyValueDescibeData> dates, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
267 ChartStyle chartStyle, ChartLabels chartLables, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
268 String uuid) throws IOException, |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
269 TechnicalChartException { |
86
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
270 ChartFactory chartFactory = new ChartFactory(); |
5d4f5d26bb7a
Some Codecleanup done
Tim Englich <tim.englich@intevation.de>
parents:
82
diff
changeset
|
271 chartFactory.createSimpleTimeSeriesChart(chartLables, chartStyle, |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
272 parameters, measurements, outputStream, this |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
273 .getChartResult(uuid)); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
274 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
275 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
276 protected ChartStyle creatStyle(int witdh, int height) { |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
277 // TODO Konfigurierbar machen |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
278 de.intevation.gnv.chart.Insets lInsets = new de.intevation.gnv.chart.Insets( |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
279 5d, 5d, 5d, 5d); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
280 Dimension lChartSize = new Dimension(witdh, height); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
281 return new ChartStyle(Color.white, new Color(230, 230, 230), |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
282 Color.white, Color.white, true, true, lInsets, lChartSize); |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
283 } |
178
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
284 |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
285 protected String getFisName(PreferredLocale[] preferredLocales){ |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
286 String returnValue = ""; |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
287 InputData inputData = this.inputData.get("fisname"); |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
288 if (inputData != null){ |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
289 returnValue = RessourceFactory.getInstance() |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
290 .getRessource(preferredLocales, |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
291 inputData.getValue(), |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
292 inputData.getValue()); |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
293 } |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
294 return returnValue; |
9bcf315f57e4
Added Name of FIS to the Title of Charts
Tim Englich <tim.englich@intevation.de>
parents:
177
diff
changeset
|
295 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
296 |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
297 protected Collection<KeyValueDescibeData> getParameters(String uuid) { |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
298 return this.getCollection(parameterValuesName, uuid); |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
299 } |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
300 |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
301 protected Collection<KeyValueDescibeData> getMeasurements(String uuid) { |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
302 return this.getCollection(measuremenValueName, uuid); |
119 | 303 } |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
304 protected Collection<KeyValueDescibeData> getDates(String uuid) { |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
305 return this.getCollection(dateValueName,uuid); |
179
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
306 } |
119 | 307 |
308 @Override | |
309 public void setup(Node configuration) { | |
310 super.setup(configuration); | |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
311 String featureNameValue = Config.getStringXPath(configuration, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
312 "value-names/value-name[@name='feature']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
313 if (featureNameValue != null) { |
119 | 314 this.featureValuesName = featureNameValue; |
315 } | |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
316 String parameterNameValue = Config.getStringXPath(configuration, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
317 "value-names/value-name[@name='parameter']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
318 if (parameterNameValue != null) { |
119 | 319 this.parameterValuesName = parameterNameValue; |
320 } | |
171
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
321 String measurementNameValue = Config.getStringXPath(configuration, |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
322 "value-names/value-name[@name='measurement']/@value"); |
7fb9441dd8af
Format Code to max 80 Chars per Row and Cleanup
Tim Englich <tim.englich@intevation.de>
parents:
119
diff
changeset
|
323 if (measurementNameValue != null) { |
119 | 324 this.measuremenValueName = measurementNameValue; |
325 } | |
179
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
326 |
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
327 String dateNameValue = Config.getStringXPath(configuration, |
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
328 "value-names/value-name[@name='date']/@value"); |
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
329 if (dateNameValue != null) { |
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
330 this.dateValueName = dateNameValue; |
f2c76f35da5a
Added missing Class Description Values to the Horizontal Profile Charts
Tim Englich <tim.englich@intevation.de>
parents:
178
diff
changeset
|
331 } |
82
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
332 } |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
333 |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
334 /** |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
335 * @param collectionName |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
336 * @return |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
337 */ |
5eb62df21f9a
Added Support for Vertical Profiles Marnet, STAUN, IMIS
Tim Englich <tim.englich@intevation.de>
parents:
81
diff
changeset
|
338 protected Collection<KeyValueDescibeData> getCollection( |
207
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
339 String collectionName, |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
340 String uuid) { |
d87347142702
Store the Results of an Artifact not in the Artifact but in an ehcache instance. issue3
Tim Englich <tim.englich@intevation.de>
parents:
179
diff
changeset
|
341 Iterator<Object> it = this.getDescibeData(uuid).iterator(); |
117
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
342 while (it.hasNext()) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
343 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
344 Object o = it.next(); |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
345 |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
346 if (o instanceof NamedCollection<?>) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
347 NamedCollection<KeyValueDescibeData> nc = (NamedCollection<KeyValueDescibeData>) o; |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
348 if (nc.getName().equals(collectionName)) { |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
349 return nc; |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
350 } |
ef157bd2fa92
LanguageSupport integrated
Tim Englich <tim.englich@intevation.de>
parents:
99
diff
changeset
|
351 } |
68
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
352 } |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
353 return null; |
d117fd4b82e5
Chartrendering integrated in Timeseries Transition
Tim Englich <tim.englich@intevation.de>
parents:
64
diff
changeset
|
354 } |
64
5db77e0a8594
Integrated Output Methods and Interfacsstructure
Tim Englich <tim.englich@intevation.de>
parents:
diff
changeset
|
355 } |