annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesOutputState.java @ 851:4bcf7bf4bfb7

Presentation of values in the statistic is now language specific (issue228). gnv-artifacts/trunk@967 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Wed, 21 Apr 2010 13:38:26 +0000
parents 47280aff0eb7
children 70653c29fc1d
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;
839
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
6
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
7 import java.text.DateFormat;
851
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
8 import java.text.NumberFormat;
839
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
9 import java.text.ParseException;
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
10
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
11 import java.util.ArrayList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
12 import java.util.Collection;
839
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
13 import java.util.Date;
629
d08b9ba148c5 Implemented logic to adjust number of bins corresponding to user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
14 import java.util.HashMap;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
15 import java.util.Iterator;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
16 import java.util.List;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
17 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
18 import java.util.Map;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
19 import java.util.Vector;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
20
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
21 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
22 import org.jfree.chart.ChartTheme;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
23 import org.w3c.dom.Document;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
24 import org.w3c.dom.Element;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
25 import org.w3c.dom.Node;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
26 import org.w3c.dom.NodeList;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
27
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
28 import au.com.bytecode.opencsv.CSVWriter;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
29 import de.intevation.artifactdatabase.Config;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
30 import de.intevation.artifactdatabase.XMLUtils;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
31 import de.intevation.artifacts.ArtifactNamespaceContext;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
32 import de.intevation.artifacts.CallContext;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
33 import de.intevation.artifacts.CallMeta;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
34 import de.intevation.gnv.artifacts.context.GNVArtifactContext;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
35 import de.intevation.gnv.artifacts.ressource.RessourceFactory;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
36 import de.intevation.gnv.chart.Chart;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
37 import de.intevation.gnv.chart.ChartLabels;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
38 import de.intevation.gnv.chart.DefaultHistogram;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
39 import de.intevation.gnv.chart.TimeSeriesChart;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
40 import de.intevation.gnv.chart.XMLChartTheme;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
41 import de.intevation.gnv.chart.exception.TechnicalChartException;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
42 import de.intevation.gnv.exports.ChartExportHelper;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
43 import de.intevation.gnv.exports.DefaultDataCollector;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
44 import de.intevation.gnv.exports.DefaultExport;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
45 import de.intevation.gnv.exports.DefaultProfile;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
46 import de.intevation.gnv.exports.Export;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
47 import de.intevation.gnv.exports.ODVExport;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
48 import de.intevation.gnv.exports.SimpleOdvDataCollector;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
49 import de.intevation.gnv.exports.Export.Profile;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
50 import de.intevation.gnv.geobackend.base.Result;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
51 import de.intevation.gnv.histogram.HistogramHelper;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
52 import de.intevation.gnv.state.InputData;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
53 import de.intevation.gnv.state.OutputStateBase;
838
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
54 import de.intevation.gnv.state.State;
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
55 import de.intevation.gnv.state.describedata.DefaultKeyValueDescribeData;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
56 import de.intevation.gnv.state.describedata.KeyValueDescibeData;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
57 import de.intevation.gnv.state.describedata.MinMaxDescribeData;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
58 import de.intevation.gnv.state.describedata.NamedArrayList;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
59 import de.intevation.gnv.state.describedata.NamedCollection;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
60 import de.intevation.gnv.state.exception.StateException;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
61 import de.intevation.gnv.statistics.Statistic;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
62 import de.intevation.gnv.statistics.StatisticSet;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
63 import de.intevation.gnv.statistics.Statistics;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
64 import de.intevation.gnv.statistics.TimeseriesStatistics;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
65 import de.intevation.gnv.statistics.exception.StatisticsException;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
66 import de.intevation.gnv.timeseries.gap.DefaultTimeGap;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
67 import de.intevation.gnv.timeseries.gap.TimeGap;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
68 import de.intevation.gnv.utils.ArtifactXMLUtilities;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
69
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
70 /**
780
c4156275c1e1 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 779
diff changeset
71 * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a>
c4156275c1e1 Bring @author javadoc tags in form '@author <a href="john.doe@example.com">John Doe</a>'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 779
diff changeset
72 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
73 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
74 public class TimeSeriesOutputState extends OutputStateBase {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
75
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
76 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
77 * A boolean property to enable caching of charts after they have been
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
78 * created. This property can be adjusted via system property 'cache.chart'.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
79 * 'true' of 'false' are valid options - defaults to 'false'.<br>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
80 * <b>NOTE:</b> If chart caching is enabled, charts aren't sensible to
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
81 * changes in the parameterization anymore, after a first chart has been
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
82 * created for an artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
83 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
84 protected static final boolean CACHE_CHART =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
85 Boolean.parseBoolean(System.getProperty("cache.chart", "false"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
86
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
87 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
88 * A field parsing a system property to adjust the alignment of pdf exports.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
89 * The system property is 'export.pdf.landscape' and should be true or
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
90 * false. If this property is true, PDFs will be created in landscape
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
91 * format.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
92 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
93 protected static final boolean PDF_FORMAT_LANDSCAPE =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
94 Boolean.parseBoolean(System.getProperty("export.pdf.landscape","true"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
95
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
96 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
97 * Supported image export formats.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
98 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
99 protected static final String[] IMG_EXPORT_FORMAT = {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
100 "PNG", "JPEG", "GIF"
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
101 };
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
102
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
103 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
104 * The UID of this Class
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
105 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
106 private static final long serialVersionUID = 4178407570503098858L;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
107
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
108 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
109 * the logger, used to log exceptions and additonaly information
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
110 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
111 private static Logger log = Logger
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
112 .getLogger(TimeSeriesOutputState.class);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
113
781
5dd94448538d Added timegap definitions as attribute to each state.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 780
diff changeset
114 private List<TimeGap> timeGapDefinitions = null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
115
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
116 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
117 * Key in resource bundle the x-axis title is stored.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
118 */
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
119 protected String domainLable = "chart.timeseries.title.xaxis";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
120
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
121 protected String featureValuesName = "featureid";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
122 protected String parameterValuesName = "parameterid";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
123 protected String measuremenValueName = "measurementid";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
124 protected String dateValueName = "dateid";
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
125 protected String timeIntervalValueName = "timeinterval";
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
126
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
127
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
128 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
129 * Array used to specify the columns used in csv exports.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
130 */
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
131 public static final String [] TIMESERIES_CSV_PROFILE_COLUMNS = {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
132 "XORDINATE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
133 "YORDINATE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
134 "GROUP1",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
135 "GROUP2",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
136 "GROUP3"
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
137 };
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
138
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
139
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
140 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
141 * Column labels used in csv exports.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
142 */
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
143 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
144 "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
145 "Value",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
146 "ParameterID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
147 "MeasurementID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
148 "TimeseriesID"
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
149 };
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
150
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
151
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
152 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
153 * Array used to specify the column in csv exports on meshes.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
154 */
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
155 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
156 "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
157 "Value",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
158 "ParameterID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
159 "FeatureID",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
160 "MeshID"
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
161 };
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
162
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
163
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
164 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
165 * Array used to specify the columns in odv exports.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
166 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
167 public static final String [] TIMESERIES_ODV_PROFILE_NAMES = {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
168 "CRUISE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
169 "STATION",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
170 "TYPE",
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
171 "TIMEVALUE",
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
172 "SHAPE",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
173 "BOTDEPTH",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
174 "DEPTH",
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
175 "QF"
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
176 };
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
177
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
178
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
179 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
180 * Column labels used in odv exports.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
181 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
182 public static final String [] ODV_COLUMN_HEADER = {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
183 "Cruise",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
184 "Station",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
185 "Type",
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
186 "yyyy-mm-dd hh:mm",
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
187 "Lon (°E)",
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
188 "Lat (°N)",
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
189 "Bot. Depth [m]",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
190 "Depth [m]",
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
191 "QF"
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
192 };
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
193
805
bb7afd783321 Removed trailing whitespace. Added more javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 804
diff changeset
194
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
195 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
196 * Profile for exporting data to odv
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
197 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
198 public static final Profile TIMESERIES_ODV_PROFILE =
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
199 new DefaultProfile(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
200 ODV_COLUMN_HEADER,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
201 '\t',
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
202 CSVWriter.NO_QUOTE_CHARACTER,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
203 CSVWriter.NO_ESCAPE_CHARACTER,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
204 "ODV",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
205 "ISO-8859-1");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
206
839
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
207
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
208 /**
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
209 * Constructor
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
210 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
211 public TimeSeriesOutputState() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
212 super();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
213 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
214
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
215
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
216 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
217 * Calls <code>getChartResult</code> which puts the data used for chart
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
218 * creation into cache. This redruces waiting periods after selecting an
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
219 * output type.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
220 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
221 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
222 * @param context The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
223 * @throws StateException if an error occured while fetching the data used
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
224 * for chart creation.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
225 */
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
226 @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
227 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
228 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
229 {
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
230 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
231 }
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
232
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
233
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
234 /**
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
235 * This out target has following modes:<br>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
236 * <ol>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
237 * <li>chart: Creates a chart displaying the data corresponding to the
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
238 * current parameterization. A chart has following export modes:<br>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
239 * <ol>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
240 * <li>img: Image representation of a chart.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
241 * <li>pdf: PDF representation of a chart.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
242 * <li>svg: SVG representation of a chart.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
243 * </ol>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
244 * All selected parameters are drawn into a single chart.<br>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
245 * </li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
246 * <li>histogram: Creates a histogram displaying the data corresponding to
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
247 * the current parameterization. A histogram has following export modes:<br>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
248 * <ol>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
249 * <li>img: Image representation of a histogram.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
250 * <li>pdf: PDF representation of a histogram.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
251 * <li>svg: SVG representation of a histogram.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
252 * </ol>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
253 * A single histogram is created for each selected parameter.<br>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
254 * </li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
255 * <li>statistic: Creates a statistic with important figures.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
256 * <li>csv: Creates a csv file.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
257 * <li>odv: Creates a odv file.</li>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
258 * </ol>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
259 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
260 * @param format Document which contains some export specific information.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
261 * @param inputData Contains some meta information to adjust the export
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
262 * (e.g. width and height of a chart).
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
263 * @param outputStream The output stream used to return the export.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
264 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
265 * @param callContext The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
266 * @throws StateException if an error occured while creating the export
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
267 * object.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
268 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
269 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
270 Document format,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
271 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
272 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
273 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
274 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
275 ) throws StateException
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
276 {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
277 log.debug("TimeSeriesOutputTransition.out");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
278
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
279 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
280 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
281
639
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
282 String mode = XMLUtils.xpathString(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
283 format, XPATH_EXPORT_MODE, ArtifactNamespaceContext.INSTANCE);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
284
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
285 if (mode == null || mode.equals("")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
286 mode = "img";
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
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
289 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
290 format, XPATH_MIME_TYPE, ArtifactNamespaceContext.INSTANCE);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
291
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
292 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
293
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
294 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
295 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
296 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
297 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
298 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
299
d08b9ba148c5 Implemented logic to adjust number of bins corresponding to user input.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 627
diff changeset
300 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
301
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
302 // 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
303 // 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
304 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
305
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
306 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
307 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
308 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
309 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
310 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
311 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
312 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
313
fec85cd01497 Fixed issue105. Added option to enable/disable data points in charts. Parse this option while creating charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 498
diff changeset
314 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
315 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
316 }
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
317 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
318 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
319 }
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
320 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
321 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
322 }
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
323 }
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
324 }
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
325 } catch (NumberFormatException e) {
725
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 652
diff changeset
326 log.warn(e, e);
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 652
diff changeset
327 XMLUtils.toStream(
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 652
diff changeset
328 feedFailure("not.a.number"),
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 652
diff changeset
329 outputStream);
dde7f51dbe1e Improved exception handling while feeding an artifact.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 652
diff changeset
330 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
331 }
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
332
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
333 try {
639
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
334 Collection<KeyValueDescibeData> parameters =
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
335 getParameters(uuid);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
336 Collection<KeyValueDescibeData> measurements =
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
337 getMeasurements(uuid);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
338 Collection<KeyValueDescibeData> dates =
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
339 getDates(uuid);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
340
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
341 Locale[] serverLocales =
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
342 RessourceFactory.getInstance().getLocales();
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
343 Locale locale =
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
344 callMeta.getPreferredLocale(serverLocales);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
345
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
346 ChartLabels chartLables = createChartLabels(locale, uuid);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
347
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
348 log.debug(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
349 "Best locale - regarding intersection of server and " +
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
350 "browser locales - is " + locale.toString()
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
351 );
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
352
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
353 String exportFormat = getExportFormat(mimeType);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
354
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
355 // CHART
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
356 if (outputMode.equalsIgnoreCase("chart")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
357 log.debug("Chart will be generated.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
358
639
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
359 if (mode.equalsIgnoreCase("img")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
360 createChart(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
361 outputStream,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
362 parameters,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
363 measurements,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
364 dates,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
365 chartLables,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
366 callContext,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
367 uuid,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
368 exportFormat,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
369 locale,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
370 chartWidth,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
371 chartHeight,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
372 lVisible,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
373 sVisible,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
374 callContext
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
375 );
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
376 }
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
377 else if (mode.equalsIgnoreCase("pdf")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
378 createPDF(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
379 outputStream,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
380 parameters,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
381 measurements,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
382 dates,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
383 chartLables,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
384 uuid,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
385 "A4",
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
386 true,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
387 lVisible,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
388 sVisible,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
389 locale,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
390 callContext
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
391 );
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
392 }
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
393 else if (mode.equalsIgnoreCase("svg")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
394 createSVG(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
395 outputStream,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
396 getParameters(uuid),
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
397 getMeasurements(uuid),
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
398 getDates(uuid),
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
399 createChartLabels(locale, uuid),
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
400 uuid,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
401 locale,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
402 chartWidth,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
403 chartHeight,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
404 lVisible,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
405 sVisible,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
406 callContext
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
407 );
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
408 }
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
409 }
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
410 // HISTOGRAM
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
411 else if (outputMode.equalsIgnoreCase("histogram")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
412 Collection results = (Collection) getChartResult(uuid, callContext);
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
413 requestParameter.put("locale", locale);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
414
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
415 Object[][] data = HistogramHelper.prepareHistogramData(
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
416 results, parameters, measurements, dates);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
417
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
418 int size = data.length;
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
419 Chart[] histograms = new Chart[size];
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
420
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
421 for (int i = 0; i < size; i++) {
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
422 ChartLabels labels = createHistogramLabels(
848
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
423 uuid, callContext, locale, data[i]);
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
424
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
425 ChartTheme theme = createStyle(callContext);
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
426
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
427 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
428 labels, data[i], theme, requestParameter);
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
429 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
430
639
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
431 if (mode.equalsIgnoreCase("img")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
432 ChartExportHelper.exportHistograms(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
433 outputStream,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
434 histograms,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
435 exportFormat,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
436 chartWidth,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
437 chartHeight
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
438 );
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
439 }
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
440 else if (mode.equalsIgnoreCase("pdf")) {
640
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
441 ChartExportHelper.exportHistogramsAsPDF(
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
442 outputStream,
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
443 histograms,
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
444 "A4",
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
445 PDF_FORMAT_LANDSCAPE,
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
446 50F, 50F, 50F, 50F
e5f1e868ee3e Implementedr histogram pdf export.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 639
diff changeset
447 );
639
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
448 }
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
449 else if (mode.equalsIgnoreCase("svg")) {
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
450 ChartExportHelper.exportHistogramsAsSVG(
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
451 outputStream,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
452 histograms,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
453 null,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
454 chartWidth,
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
455 chartHeight
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
456 );
a94ed2755480 Implemented SVG export for histograms.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 629
diff changeset
457 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
458 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
459 else if (outputMode.equalsIgnoreCase("csv")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
460 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
461 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
462 if (result instanceof Collection) {
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
463 this.createCSV(
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
464 outputStream,
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
465 (Collection<Result>)result);
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
466 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
467 } else if (outputMode.equalsIgnoreCase("statistics")) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
468 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
469
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
470 Collection<StatisticSet> statistics;
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
471
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
472 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
473 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
474
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
475 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
476 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
477 result,
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
478 parameters,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
479 measurements,
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
480 dates);
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
481 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
482 else {
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
483 statistics = new ArrayList<StatisticSet>();
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
484 }
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
485
851
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
486 Document doc = writeStatistics2XML(statistics, locale);
454
04cfb4e3da4f Refactored statistics classes a bit. Added class for vertical cross sections.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 452
diff changeset
487
481
20dde2b6f1b5 Added end of life support for artifact states. Implemented ZIP download
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 480
diff changeset
488 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
489
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
490 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
491 else if (outputMode.equalsIgnoreCase("odv")) {
830
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
492 createODV(outputStream, uuid, callContext);
335
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 } catch (IOException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
495 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
496 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
497 } catch (TechnicalChartException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
498 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
499 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
500 } catch (StatisticsException e) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
501 log.error(e, e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
502 throw new StateException(e);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
503 }
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
506
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
507 /**
830
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
508 * @param outputStream
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
509 * @param uuid
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
510 * @throws IOException
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
511 * @throws StateException
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
512 */
835
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 830
diff changeset
513 protected void createODV(OutputStream outputStream,
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 830
diff changeset
514 String uuid,
830
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
515 CallContext callContext)
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
516 throws IOException,
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
517 StateException {
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
518 Collection<Result> odvResult = this.getODVResult(uuid);
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
519 this.createODV(outputStream, odvResult,uuid);
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
520 }
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
521
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
522
3ab5754e72e3 Extract ODV-Generation into its own method that it is possible to override it in subclasses.
Tim Englich <tim.englich@intevation.de>
parents: 823
diff changeset
523 /**
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
524 * Retrieves the export format (e.g. png, gif, jpeg).
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
525 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
526 * @param mime Export format specified by the incoming request.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
527 * @return <i>mime</i> if it is supported - otherwise the first format in
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
528 * {@link #IMG_EXPORT_FORMAT}.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
529 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
530 protected String getExportFormat(String mime) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
531 for(int i = 0; i < IMG_EXPORT_FORMAT.length; i++) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
532 if (mime.trim().toUpperCase().indexOf(IMG_EXPORT_FORMAT[i]) > 0)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
533 return IMG_EXPORT_FORMAT[i];
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 // no format found relating to mimeType, default export as PNG
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
537 return IMG_EXPORT_FORMAT[0];
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
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
541 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
542 * Returns a collection containing all selected KeyValueDescibeData objects
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
543 * of <i>parameters</i>.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
544 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
545 * @param parameters A collection with KeyValueDescibeData objects.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
546 * @return a collection cleaned from unselected objects.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
547 * @deprecated
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
548 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
549 protected Collection getCleanedParameters(Collection parameters) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
550 Iterator iter = parameters.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
551 Collection parameter = new Vector(parameters);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
552 while (iter.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
553 KeyValueDescibeData data = (KeyValueDescibeData)iter.next();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
554 if (!data.isSelected())
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
555 parameter.remove(data);
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 return parameter;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
559 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
560
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
561
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
562 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
563 * Calls {@link #getCleanedParameters(java.util.Collection)} with the
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
564 * collection returned by {@link #getParameters(java.lang.String)}.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
565 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
566 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
567 * @return a cleaned collection.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
568 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
569 protected Collection getCleanedParameters(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
570 return getCleanedParameters(getParameters(uuid));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
571 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
572
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
573
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
574 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
575 * Create a csv file representing the data corresponding to the current
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
576 * parameterization.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
577 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
578 * @param out The output stream used to export the csv file.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
579 * @param results The data used for csv file creation.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
580 * @throws UnsupportedEncodingException if the encoding is not supported.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
581 * @throws IOException if an error occured while writing to output stream.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
582 * @throws StateException if an error occured while creating the csv file.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
583 */
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
584 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
585 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
586 {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
587 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
588 Result res = iter.hasNext() ? (Result) iter.next() : null;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
589
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
590 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
591 return;
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
592
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
593 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
594 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
595
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
596 // 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
597 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
598 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
599 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
600 ',',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
601 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
602 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
603 "CSV",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
604 "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
605 }
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
606
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
607 // 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
608 else {
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
609 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
610 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
611 ',',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
612 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
613 '"',
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
614 "CSV",
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
615 "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
616 }
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
617
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
618 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
619 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
620 export.create(profile, out, results);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
621 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
622
368
6491000407dd Added column labels for csv export of timeseries, vertical and horizontal profiles.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 358
diff changeset
623
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
624 /**
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
625 * Create an odv file representing the data corresponding to the current
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
626 * parameterization.
805
bb7afd783321 Removed trailing whitespace. Added more javadoc.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 804
diff changeset
627 *
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
628 * @param outputStream The output stream used to export the odv file.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
629 * @param result The data used for odv file creation.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
630 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
631 * @throws IOException if an error occured while writing to output stream.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
632 * @throws StateException if an error occured while creating the odv file.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
633 */
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
634 protected void createODV(OutputStream outputStream,
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
635 Collection result,
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
636 String uuid)
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
637 throws IOException, StateException {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
638
765
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
639 Export export = new ODVExport(new SimpleOdvDataCollector(
f28a7eac542a Integrated valid ODV-Export to the GNV-Artifacts
Tim Englich <tim.englich@intevation.de>
parents: 762
diff changeset
640 TIMESERIES_ODV_PROFILE_NAMES),
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
641 this.getParameters(uuid),
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
642 this.getStartTime());
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
643
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
644 if (result == null)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
645 log.error("#################### RESULT == NULL #################");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
646 export.create(TIMESERIES_ODV_PROFILE, outputStream, result);
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 /**
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
650 * Method that returns the Starttime of an TimeSeries or
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
651 * null if it is not a TimeSeries.
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
652 * @return the Starttime of an TimeSeries or null if it is not a TimeSeries.
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
653 */
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
654 protected String getStartTime(){
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
655 InputData data = inputData.get(this.timeIntervalValueName);
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
656 if (data != null){
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
657 Object describeData = data.getObject();
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
658 if (describeData instanceof MinMaxDescribeData){
816
cda3bede32f8 ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601
Tim Englich <tim.englich@intevation.de>
parents: 812
diff changeset
659 String value = ((MinMaxDescribeData)describeData)
cda3bede32f8 ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601
Tim Englich <tim.englich@intevation.de>
parents: 812
diff changeset
660 .getMinValue().toString();
cda3bede32f8 ISSUE215 Switched Values between columns yyyy-mm-dd hh:mm and time_ISO8601
Tim Englich <tim.englich@intevation.de>
parents: 812
diff changeset
661 return value.substring(0,value.lastIndexOf(':'));
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
662 }
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
663 return null;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
664 }else{
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
665 return null;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
666 }
835
2423cefe7d39 Removed trailing whitespace.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 830
diff changeset
667
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
668 }
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
669
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
670 /**
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
671 * Returns the statistic generator.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
672 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
673 * @return the statistic generator.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
674 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
675 protected Statistics getStatisticsGenerator() {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
676 Statistics s = new TimeseriesStatistics();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
677 return s;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
678 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
679
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
680
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
681 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
682 * Writes the statistic into an xml document.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
683 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
684 * @param statistic Statistic to be written to xml document.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
685 * @return the xml document containing the statistic.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
686 */
851
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
687 protected Document writeStatistics2XML(
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
688 Collection<StatisticSet> statistic, Locale locale)
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
689 {
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
690 ArtifactXMLUtilities xmlUtilities = new ArtifactXMLUtilities();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
691 Document doc = XMLUtils.newDocument();
851
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
692
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
693 NumberFormat format = NumberFormat.getInstance(locale);
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
694
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
695 if (statistic != null) {
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
696 Node statisticResults = ArtifactXMLUtilities.createArtifactElement(doc,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
697 "statistics");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
698 doc.appendChild(statisticResults);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
699 Iterator<StatisticSet> it = statistic.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
700 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
701 StatisticSet set = it.next();
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
702 Element setElement = ArtifactXMLUtilities.createArtifactElement(doc,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
703 "statistic");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
704 setElement.setAttribute("name", set.getName());
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
705
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
706 Iterator<Statistic> sit = set.getStatistics().iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
707 while (sit.hasNext()){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
708 Statistic s = sit.next();
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
709 Element result = ArtifactXMLUtilities.createArtifactElement(doc,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
710 "statistic-value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
711 result.setAttribute("name", s.getKey());
851
4bcf7bf4bfb7 Presentation of values in the statistic is now language specific (issue228).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 848
diff changeset
712 result.setAttribute("value", format.format(s.getValue()));
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
713 setElement.appendChild(result);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
714 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
715 statisticResults.appendChild(setElement);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
716 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
717
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
718 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
719 return doc;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
720 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
721
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
722
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
723 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
724 * Returns the name of the selected feature.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
725 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
726 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
727 * @return the name of the selectef feature.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
728 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
729 protected String getSelectedFeatureName(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
730 Collection values = getCollection(featureValuesName, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
731
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
732 if (values != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
733 Iterator it = values.iterator();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
734
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
735 while (it.hasNext()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
736 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
737 return data.getValue();
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
738 }
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
739
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
740 return "";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
741 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
742 return "";
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
743 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
744
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
745
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
746 /**
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
747 * Creates a chart and writes it to <i>outputStream</i>.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
748 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
749 * @param outputStream The stream used to write the chart to.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
750 * @param parameters A collection with parameters.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
751 * @param measurements A collection with measurements.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
752 * @param dates A collection with dates.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
753 * @param chartLables The labels used to decorate the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
754 * @param context The CallContext.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
755 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
756 * @param exportFormat The format the chart used to be exported as.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
757 * @param locale The Locale to specify the language.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
758 * @param width The width of the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
759 * @param height The height of the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
760 * @param linesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
761 * lines connecting two datapoins.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
762 * @param shapesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
763 * datapoints.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
764 * @param callContext The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
765 * @throws IOException if an error occured while writing to output stream.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
766 * @throws TechnicalChartException if an error occured while chart creation.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
767 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
768 protected void createChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
769 OutputStream outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
770 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
771 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
772 Collection dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
773 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
774 CallContext context,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
775 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
776 String exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
777 Locale locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
778 int width,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
779 int height,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
780 boolean linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
781 boolean shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
782 CallContext callContext
335
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 throws IOException, TechnicalChartException
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
785 {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
786 log.debug("Create chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
787 Chart chart = getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
788 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
789 createStyle(context),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
790 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
791 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
792 dates,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
793 getChartResult(uuid, callContext),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
794 locale, // Locale
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
795 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
796 linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
797 shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
798 callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
799 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
800
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
801 if (chart == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
802 log.error("Could not initialize chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
803 return;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
804 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
805
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
806 log.debug(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
807 "export chart as " + exportFormat +
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
808 " in " + width + "x" + height
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
811 ChartExportHelper.exportImage(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
812 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
813 chart.generateChart(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
814 exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
815 width,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
816 height
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
817 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
818 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
819
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
820
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
821 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
822 * Creates a chart and writes it as pdf to <i>outputStream</i>.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
823 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
824 * @param outputStream The stream used to write the chart to.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
825 * @param parameters A collection with parameters.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
826 * @param measurements A collection with measurements.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
827 * @param dates A collection with dates.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
828 * @param chartLables The labels used to decorate the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
829 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
830 * @param exportFormat The format the chart used to be exported as.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
831 * @param landscape A boolean property to determine the alignment of the
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
832 * chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
833 * @param linesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
834 * lines connecting two datapoins.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
835 * @param shapesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
836 * datapoints.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
837 * @param locale The Locale to specify the language.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
838 * @param context The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
839 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
840 protected void createPDF(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
841 OutputStream outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
842 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
843 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
844 Collection dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
845 ChartLabels chartLables,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
846 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
847 String exportFormat,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
848 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
849 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
850 boolean shapesVisible,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
851 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
852 CallContext context
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
853 ) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
854 Chart chart = getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
855 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
856 createStyle(context),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
857 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
858 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
859 dates,
452
4cd03910f97e Enable PDF export of vertical cross section charts.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 446
diff changeset
860 getChartResult(uuid, context),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
861 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
862 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
863 linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
864 shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
865 context
335
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
868 if (chart == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
869 log.error("Could not initialize chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
870 return;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
871 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
872
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
873 ChartExportHelper.exportPDF(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
874 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
875 chart.generateChart(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
876 "A4",
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
877 PDF_FORMAT_LANDSCAPE,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
878 50F, 50F, 50F, 50F
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
879 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
880 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
881
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
882
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
883 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
884 * Creates a chart and writes it as svg to <i>outputStream</i>.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
885 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
886 * @param outputStream The stream used to write the chart to.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
887 * @param parameters A collection with parameters.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
888 * @param measurements A collection with measurements.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
889 * @param dates A collection with dates.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
890 * @param chartLables The labels used to decorate the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
891 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
892 * @param locale The Locale to specify the language.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
893 * @param width The width of the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
894 * @param height The height of the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
895 * @param linesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
896 * lines connecting two datapoins.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
897 * @param shapesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
898 * datapoints.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
899 * @param callContext The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
900 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
901 protected void createSVG(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
902 OutputStream outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
903 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
904 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
905 Collection dates,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
906 ChartLabels chartLables,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
907 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
908 Locale locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
909 int width,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
910 int height,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
911 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
912 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
913 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
914 ) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
915 Chart chart = getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
916 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
917 createStyle(callContext),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
918 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
919 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
920 dates,
446
f5a041000357 Connected vertical cross section with chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 443
diff changeset
921 getChartResult(uuid, callContext),
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
922 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
923 uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
924 linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
925 shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
926 callContext
335
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
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
929 if (chart == null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
930 log.error("Could not initialize chart.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
931 return;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
932 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
933
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
934 ChartExportHelper.exportSVG(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
935 outputStream,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
936 chart.generateChart(),
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
937 null,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
938 600, 400
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
939 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
940
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
941 log.debug("svg export finished.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
942 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
943
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
944
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
945 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
946 * This method creates a chart and returns it. In normal case, this is the
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
947 * only method to be overriden by subclasses to create other types of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
948 * charts.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
949 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
950 * @param chartLables Labels used to decorate the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
951 * @param theme The theme used to adjust the look of the chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
952 * @param parameters A collection with parameters this chart contains.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
953 * @param measurements A collection with measurement this chart contains.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
954 * @param dates A collection with dates this chart contains.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
955 * @param result The data collection used to be displayed in this chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
956 * @param locale The Locale used to determine the language.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
957 * @param uuid The uuid of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
958 * @param linesVisible A boolean property to determine the visibility of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
959 * lines connecting two points in a chart (not used in this chart type).
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
960 * @param shapesVisible A boolean property to determine the visiblity of
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
961 * datapoints in this chart (not used in this chart type).
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
962 * @param callContext The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
963 * @return a timeseries chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
964 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
965 protected Chart getChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
966 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
967 ChartTheme theme,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
968 Collection parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
969 Collection measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
970 Collection dates,
429
bed9735adf84 Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
971 Object result,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
972 Locale locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
973 String uuid,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
974 boolean linesVisible,
439
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
975 boolean shapesVisible,
8975de9d7483 Loop through configuration to chart generation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 429
diff changeset
976 CallContext callContext
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
977 ) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
978 Chart chart = null;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
979
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
980 if (CACHE_CHART) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
981 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
982 chart = (Chart) getChartFromCache(uuid, callContext);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
983 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
984
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
985 if (chart != null)
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
986 return chart;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
987
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
988 log.info("Chart not in cache yet.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
989 chart = new TimeSeriesChart(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
990 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
991 theme,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
992 parameters,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
993 measurements,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
994 dates,
429
bed9735adf84 Finished preprocessing data for interpolation in verticalcrosssection charts.ß
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 368
diff changeset
995 (Collection)result,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
996 timeGapDefinitions,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
997 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
998 linesVisible,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
999 shapesVisible
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1000 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1001 chart.generateChart();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1002
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1003 if (CACHE_CHART) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1004 log.info("Put chart into cache.");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1005 purifyChart(chart, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1006 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1007
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1008 return chart;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1009 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1010
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1011
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1012 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1013 * Fetches the ChartTheme from <i>callContext</i> and returns it.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1014 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1015 * @param callContext CallContext objects storing a chart theme.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1016 * @return a chart theme.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1017 */
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
1018 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
1019 log.debug("Fetch chart theme from global context");
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1020
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
1021 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
1022 (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
1023
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
1024 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
1025 GNVArtifactContext.CHART_TEMPLATE_KEY);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1026
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1027 return theme;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1028 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1029
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1030 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1031 * Creates a ChartLabels object storing different labels used to decorate a
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1032 * chart.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1033 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1034 * @param locale The Locale object to adjust the language of labels.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1035 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1036 * @return the chart labels.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1037 */
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1038 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
1039 return new ChartLabels(
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1040 createChartTitle(locale, uuid),
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1041 createChartSubtitle(locale, uuid),
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1042 RessourceFactory.getInstance().getRessource(
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1043 locale,
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1044 domainLable,
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1045 domainLable
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1046 )
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1047 );
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1048 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1049
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1050
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1051 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1052 * Creates and returns the chart title.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1053 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1054 * @param locale The Locale used to adjust the language of the title.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1055 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1056 * @return the name of the selected fis.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1057 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1058 protected String createChartTitle(Locale locale, String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1059 return getFisName(locale);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1060
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1061 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1062
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1063
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1064 /**
839
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1065 * Creates and returns the subtitle of a chart. The subtitle in this class
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1066 * contains the station and the time interval.
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1067 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1068 * @param locale The Locale used to adjust the language of the subtitle.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1069 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1070 * @return the selected feature.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1071 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1072 protected String createChartSubtitle(Locale locale, String uuid) {
839
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1073 String subtitle = "";
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1074 subtitle += getSelectedFeatureName(uuid);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1075
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1076 InputData data = inputData.get(timeIntervalValueName);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1077 if (data != null){
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1078 Object describeData = data.getObject();
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1079 if (describeData instanceof MinMaxDescribeData) {
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1080 MinMaxDescribeData tmp = (MinMaxDescribeData) describeData;
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1081
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1082 DateFormat format = DateFormat.getDateTimeInstance(
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1083 DateFormat.MEDIUM, DateFormat.SHORT, locale);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1084
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1085 String lDateStr = (String) tmp.getMinValue();
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1086 String rDateStr = (String) tmp.getMaxValue();
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1087
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1088 try {
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1089 Date lDate = srcFormat.parse(lDateStr);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1090 Date rDate = srcFormat.parse(rDateStr);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1091
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1092 String interval = format.format(lDate);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1093 interval += " - ";
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1094 interval += format.format(rDate);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1095
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1096 if (subtitle != null && subtitle.length() > 0)
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1097 subtitle += ", ";
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1098
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1099 subtitle += interval;
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1100 }
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1101 catch (ParseException pe) {
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1102 log.error(pe, pe);
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1103 }
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1104 }
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1105 }
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1106
ac5988f27714 Added the time interval into the subtitle of timeseries charts (issue152).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 838
diff changeset
1107 return subtitle;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1108 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1109
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1110
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1111 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1112 * Creates and returns labels to decorate histograms.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1113 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1114 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1115 * @param context The CallContext object.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1116 * @param data An array storing strings.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1117 * @return A ChartLabels object with the 1st string in <i>data</i> as title.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1118 */
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
1119 protected ChartLabels createHistogramLabels(
848
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1120 String uuid, CallContext context, Locale locale, Object[] data)
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
1121 {
848
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1122 RessourceFactory fac = RessourceFactory.getInstance();
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1123
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1124 return new ChartLabels(
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1125 (String) data[0],
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1126 "",
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1127 "",
47280aff0eb7 Added an y-axis label in histograms (issue243).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 839
diff changeset
1128 fac.getRessource(locale, "histogram.axis.range.title", ""));
617
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
1129 }
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
1130
3d13fa281a7e Added new ouput mode: histogram.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 615
diff changeset
1131
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1132 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1133 * Returns the selected fis name.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1134 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1135 * @param locale The Locale object used to adjust the language.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1136 * @return the name of the fis.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1137 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1138 protected String getFisName(Locale locale) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1139 String returnValue = "";
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1140 InputData input = inputData.get("fisname");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1141
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1142 if (input != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1143 String value = input.getValue();
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1144
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1145 returnValue = RessourceFactory.getInstance().getRessource(
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1146 locale,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1147 value,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1148 value
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1149 );
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1150 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1151 return returnValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1152 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1153
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1154
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1155 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1156 * Returns the name of the selected object in the collection specified by
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1157 * <i>key</i>.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1158 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1159 * @param uuid The UUID of the current artifat.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1160 * @param key A key to specify a collection.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1161 * @return the name of the selected item.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1162 */
492
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1163 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
1164 Collection values = getCollection(key, uuid);
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1165
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1166 if (values != null) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1167 Iterator it = values.iterator();
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1168
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1169 while (it.hasNext()) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1170 KeyValueDescibeData data = (KeyValueDescibeData) it.next();
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1171
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1172 if (data.isSelected()) {
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1173 return data.getValue();
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1174 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1175 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1176 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1177 return null;
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1178 }
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1179
79e80c289018 Added labels and titles to 'Profilschnitt' charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 481
diff changeset
1180
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1181 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1182 * Returns a collection of selected parameters.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1183 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1184 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1185 * @return selected parameters.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1186 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1187 protected Collection<KeyValueDescibeData> getParameters(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1188 return this.getCollection(parameterValuesName, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1189 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1190
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1191 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1192 * Returns a collection of selected measurements.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1193 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1194 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1195 * @return selected measurements.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1196 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1197 protected Collection<KeyValueDescibeData> getMeasurements(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1198 return this.getCollection(measuremenValueName, uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1199 }
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1200
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1201 /**
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1202 * Returns a collection of selected dates.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1203 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1204 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1205 * @return selected dates.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1206 */
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1207 protected Collection<KeyValueDescibeData> getDates(String uuid) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1208 return this.getCollection(dateValueName,uuid);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1209 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1210
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1211 @Override
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1212 public void setup(Node configuration) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1213 super.setup(configuration);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1214 String featureNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1215 "value-names/value-name[@name='feature']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1216 if (featureNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1217 this.featureValuesName = featureNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1218 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1219 String parameterNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1220 "value-names/value-name[@name='parameter']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1221 if (parameterNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1222 this.parameterValuesName = parameterNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1223 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1224 String measurementNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1225 "value-names/value-name[@name='measurement']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1226 if (measurementNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1227 this.measuremenValueName = measurementNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1228 }
812
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
1229 String timeIntervalValue = Config.getStringXPath(configuration,
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
1230 "value-names/value-name[@name='timeinterval']/@value");
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
1231 if (timeIntervalValue != null){
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
1232 this.timeIntervalValueName = timeIntervalValue;
41a7c49b5cb4 ISSUE 215 msg1170: Integrated additional Column into the ODV-Export to identify TimeSeries
Tim Englich <tim.englich@intevation.de>
parents: 805
diff changeset
1233 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
1234
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1235 String dateNameValue = Config.getStringXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1236 "value-names/value-name[@name='date']/@value");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1237 if (dateNameValue != null) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1238 this.dateValueName = dateNameValue;
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1239 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1240 if (timeGapDefinitions == null){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1241 Element gapDefinition = (Element)Config.getNodeXPath(configuration,
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1242 "time-gap-definition");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1243 synchronized (this.getClass()) {
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1244 if (gapDefinition != null){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1245 String link = gapDefinition.getAttribute("xlink:href");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1246 if (link != null ){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1247 String absolutFileName = Config.replaceConfigDir(link);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1248 gapDefinition = (Element)new ArtifactXMLUtilities().
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1249 readConfiguration(absolutFileName);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1250 }
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
1251
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
1252 NodeList gapDefinitions = Config.getNodeSetXPath(gapDefinition,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1253 "/time-gaps/time-gap");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1254 if (gapDefinition != null){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1255 timeGapDefinitions = new ArrayList<TimeGap>(gapDefinitions.
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1256 getLength());
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1257 for (int i = 0; i < gapDefinitions.getLength(); i++){
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1258 Element gapNode = (Element)gapDefinitions.item(i);
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1259 String unit = gapNode.getAttribute("unit");
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1260 int key = Integer.parseInt(gapNode.getAttribute("key"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1261 int value = Integer.parseInt(gapNode.getAttribute("gap"));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1262 log.info("Add new Timegap: "+key+" "+value+" "+ unit);
778
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
1263 timeGapDefinitions.add(new DefaultTimeGap(unit,
9a828e5a2390 Removed trailing whitespace
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 765
diff changeset
1264 key,
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1265 value));
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1266 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1267 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1268 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1269 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1270 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1271 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1272
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1273
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1274 /**
804
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1275 * Creates a <code>NamedArrayList</code> storing some <code>
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1276 * KeyValueDescibeData</code> objects found in the input data with the key
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1277 * <i>collectionName</i>.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1278 *
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1279 * @param collectionName String to specify the input data.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1280 * @param uuid The UUID of the current artifact.
9058c08eac3a Added more Javadoc in some classes of state.profile.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 781
diff changeset
1281 * @return a collection with values from input data.
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1282 */
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1283 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
1284 String collectionName,
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1285 String uuid)
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1286 {
838
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1287 log.debug("Search for input data: " + collectionName);
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1288 NamedCollection<KeyValueDescibeData> c = new NamedArrayList<KeyValueDescibeData>(collectionName);
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1289
838
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1290 InputData data = null;
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1291 State parent = this;
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1292 do {
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1293 data = parent.inputData().get(collectionName);
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1294
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1295 if (data != null) {
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1296 break;
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1297 }
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1298 }
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1299 while ((parent = parent.getParent()) != null);
e91ebe3696ec Iterate through former states as well when searching for an input collection (issue226).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 835
diff changeset
1300
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1301 if (data == null) {
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1302 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
1303 return c;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1304 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1305
615
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1306 String[] descs = data.getDescription();
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1307 String[] values = data.splitValue();
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1308 int size = values.length;
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1309
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1310 for (int i = 0; i < size; i++){
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1311 c.add(new DefaultKeyValueDescribeData(
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1312 values[i], descs[i], getID()));
01054ddccb0f Repaired multi parameter selection.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 611
diff changeset
1313 }
610
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1314
6484464d2059 Changed the mechanism for searching for specific parameter collections.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 536
diff changeset
1315 return c;
335
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1316 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1317 }
e964a3d8f7bc Some Refactoring work done.
Tim Englich <tim.englich@intevation.de>
parents:
diff changeset
1318 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org