Mercurial > dive4elements > gnv-client
annotate gnv-artifacts/src/main/java/de/intevation/gnv/state/timeseries/TimeSeriesVectorOutputState.java @ 1068:a4e490e0af5b
Enable GetFeatureInforRequests on all layer
gnv-artifacts/trunk@1163 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Tim Englich <tim.englich@intevation.de> |
---|---|
date | Mon, 07 Jun 2010 12:17:57 +0000 |
parents | cc4ec127d666 |
children | 9bb1979aabbe |
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 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
45 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
|
46 "Cruise", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
47 "Station", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
48 "Type", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
49 "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
|
50 "Lon (°E)", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
51 "Lat (°N)", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
52 "Bot. Depth [m]", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
53 "Depth [m]", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
54 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
55 "XComponent", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
56 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
57 "YComponent", |
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 "ZComponent", |
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 "Speed", |
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 "Direction", |
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 }; |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
66 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
67 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
|
68 "CRUISE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
69 "STATION", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
70 "TYPE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
71 "TIMEVALUE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
72 "SHAPE", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
73 "BOTDEPTH", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
74 "DEPTH", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
75 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
76 "XCOMPONENT", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
77 "QF", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
78 "YCOMPONENT", |
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 "ZCOMPONENT", |
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 "SPEED", |
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 "DIRECTION", |
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 |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 public TimeSeriesVectorOutputState() { |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 @Override |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
92 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
|
93 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
|
94 CacheFactory factory = CacheFactory.getInstance(); |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
95 |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
96 if (factory.isInitialized()) { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
97 // 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
|
98 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
|
99 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
|
100 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
|
101 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
102 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
|
103 if (value != null) { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
104 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
|
105 return value.getObjectValue(); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
106 } |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
107 else { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
108 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
|
109 Collection<Result> res = (Collection<Result>)getData(queryID); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
110 res = VectorDataProcessor.process(res); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
111 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
|
112 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
113 return res; |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
114 } |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
115 } |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
116 else { |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
117 // 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
|
118 // single time |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
119 logger.info("Not using a cache."); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
120 return VectorDataProcessor.process(getData(queryID)); |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
121 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
122 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
123 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
124 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
125 @Override |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
126 protected Chart getChart( |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
127 ChartLabels chartLables, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
128 ChartTheme theme, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
129 Collection parameters, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
130 Collection measurements, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
131 Collection dates, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
132 Object result, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
133 Locale locale, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
134 String uuid, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
135 boolean linesVisible, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
136 boolean shapesVisible, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
137 CallContext callContext |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
138 ) { |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
139 Chart chart = new TimeSeriesVectorChart( |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
140 chartLables, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
141 theme, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
142 parameters, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
143 measurements, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
144 dates, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
145 (Collection)result, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
146 timeGapDefinitions, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
147 locale, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
148 linesVisible, |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
149 shapesVisible |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
150 ); |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
151 chart.generateChart(); |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
152 |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
153 return chart; |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
154 } |
1041
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
155 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
156 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
157 @Override |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
158 protected void createODV( |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
159 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
|
160 throws IOException, StateException |
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 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
|
163 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
|
164 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
|
165 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
166 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
|
167 ODV_COLUMN_HEADERS, |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
168 '\t', |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
169 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
|
170 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
|
171 "ODV", |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
172 "ISO-8859-1"); |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
173 |
8a8ee5abc084
Implemented the odv export for timeseries using vector data (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
1040
diff
changeset
|
174 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
|
175 } |
1040
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
176 } |
70653c29fc1d
Finished vector support for timeseriespoints (Issue27).
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
177 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |