annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java @ 1071:9bb1979aabbe

Added a new output state and chart type for vertical profiles using vector data. gnv-artifacts/trunk@1168 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 07 Jun 2010 15:00:23 +0000
parents cc4ec127d666
children 1728aac87717
rev   line source
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.gnv.state.timeseries;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
3 import au.com.bytecode.opencsv.CSVWriter;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
4
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import de.intevation.artifacts.CallContext;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
7 import de.intevation.gnv.artifacts.cache.CacheFactory;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
8
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import de.intevation.gnv.chart.Chart;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import de.intevation.gnv.chart.ChartLabels;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import de.intevation.gnv.chart.TimeSeriesVectorChart;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
13 import de.intevation.gnv.exports.DefaultExport;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
14 import de.intevation.gnv.exports.DefaultProfile;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
15 import de.intevation.gnv.exports.Export;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
16 import de.intevation.gnv.exports.Export.Profile;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
17 import de.intevation.gnv.exports.SimpleOdvDataCollector;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
18
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19 import de.intevation.gnv.geobackend.base.Result;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 import de.intevation.gnv.utils.VectorDataProcessor;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
23 import de.intevation.gnv.state.exception.StateException;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
24
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
25 import java.io.IOException;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
26 import java.io.OutputStream;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
27
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 import java.util.Collection;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 import java.util.Locale;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
31 import net.sf.ehcache.Cache;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
32
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 import org.apache.log4j.Logger;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 import org.jfree.chart.ChartTheme;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 /**
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 */
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public class TimeSeriesVectorOutputState extends TimeSeriesOutputState {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42 private static Logger logger =
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 Logger.getLogger(TimeSeriesVectorOutputState.class);
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
1071
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
45 public static final String[] RESULT_COLUMNS = {
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
46 "YORDINATE", "XORDINATE", "GROUP1", "GROUP2", "GROUP3", "GAPID", "SERIES"
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
47 };
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
48
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
49 public static final String[] ODV_COLUMN_HEADERS = {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
50 "Cruise",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
51 "Station",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
52 "Type",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
53 "yyyy-mm-dd hh:mm",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
54 "Lon (°E)",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
55 "Lat (°N)",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
56 "Bot. Depth [m]",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
57 "Depth [m]",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
58 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
59 "XComponent",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
60 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
61 "YComponent",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
62 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
63 "ZComponent",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
64 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
65 "Speed",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
66 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
67 "Direction",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
68 "QF"
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
69 };
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
70
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
71 public static final String[] ODV_PROFILE_NAMES = {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
72 "CRUISE",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
73 "STATION",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
74 "TYPE",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
75 "TIMEVALUE",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
76 "SHAPE",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
77 "BOTDEPTH",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
78 "DEPTH",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
79 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
80 "XCOMPONENT",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
81 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
82 "YCOMPONENT",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
83 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
84 "ZCOMPONENT",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
85 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
86 "SPEED",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
87 "QF",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
88 "DIRECTION",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
89 "QF"};
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
90
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 public TimeSeriesVectorOutputState() {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 @Override
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
96 protected Object getChartResult(String uuid, CallContext callContext) {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
97 logger.debug("OutputStateBase.getChartResult");
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
98 CacheFactory factory = CacheFactory.getInstance();
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
100 if (factory.isInitialized()) {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
101 // we use a cache
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
102 logger.info("Using cache.");
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
103 Cache cache = factory.getCache();
1060
cc4ec127d666 Remove the elements of an outdated state from cache if its endOfLife method is called.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1041
diff changeset
104 String key = "chart_" + getHash();
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
105
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
106 net.sf.ehcache.Element value = cache.get(key);
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
107 if (value != null) {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
108 logger.debug("Found element in cache.");
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
109 return value.getObjectValue();
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
110 }
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
111 else {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
112 logger.debug("Element not in cache, we ask the database");
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
113 Collection<Result> res = (Collection<Result>)getData(queryID);
1071
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
114 res = VectorDataProcessor.process(res, RESULT_COLUMNS);
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
115 cache.put(new net.sf.ehcache.Element(key, res));
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
116
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
117 return res;
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
118 }
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 }
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
120 else {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
121 // we don't use a cache, so we have to query the database every
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
122 // single time
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
123 logger.info("Not using a cache.");
1071
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
124 return VectorDataProcessor.process(
9bb1979aabbe Added a new output state and chart type for vertical profiles using vector data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1060
diff changeset
125 getData(queryID), RESULT_COLUMNS);
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 @Override
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 protected Chart getChart(
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
132 ChartLabels chartLables,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
133 ChartTheme theme,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 Collection parameters,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 Collection measurements,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 Collection dates,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 Object result,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
138 Locale locale,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
139 String uuid,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
140 boolean linesVisible,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
141 boolean shapesVisible,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
142 CallContext callContext
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
143 ) {
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
144 Chart chart = new TimeSeriesVectorChart(
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145 chartLables,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
146 theme,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
147 parameters,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
148 measurements,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
149 dates,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 (Collection)result,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 timeGapDefinitions,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 locale,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
153 linesVisible,
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 shapesVisible
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155 );
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156 chart.generateChart();
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 return chart;
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 }
1041
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
160
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
161
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
162 @Override
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
163 protected void createODV(
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
164 OutputStream outputStream, Collection result, String uuid)
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
165 throws IOException, StateException
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
166 {
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
167 logger.info("Start exporting " + result.size() + " items to odv.");
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
168 Export export = new DefaultExport(
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
169 new SimpleOdvDataCollector(ODV_PROFILE_NAMES));
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
170
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
171 Profile profile = new DefaultProfile(
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
172 ODV_COLUMN_HEADERS,
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
173 '\t',
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
174 CSVWriter.NO_QUOTE_CHARACTER,
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
175 CSVWriter.NO_ESCAPE_CHARACTER,
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
176 "ODV",
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
177 "ISO-8859-1");
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
178
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
179 export.create(profile, outputStream, result);
8a8ee5abc084 Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1040
diff changeset
180 }
1040
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181 }
70653c29fc1d Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :

http://dive4elements.wald.intevation.org