Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/transition/timeseries/TimeSeriesOutputTransition.java @ 233:2ceb4bf51cba
Added DataCollector which collects data used for exports.
gnv-artifacts/trunk@301 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Mon, 09 Nov 2009 09:43:52 +0000 |
parents | 3d6d89bcbf42 |
children | a157c6042cb4 |
comparison
equal
deleted
inserted
replaced
232:3d6d89bcbf42 | 233:2ceb4bf51cba |
---|---|
50 import de.intevation.gnv.transition.InputData; | 50 import de.intevation.gnv.transition.InputData; |
51 import de.intevation.gnv.transition.OutputTransitionBase; | 51 import de.intevation.gnv.transition.OutputTransitionBase; |
52 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; | 52 import de.intevation.gnv.transition.describedata.KeyValueDescibeData; |
53 import de.intevation.gnv.transition.describedata.NamedCollection; | 53 import de.intevation.gnv.transition.describedata.NamedCollection; |
54 import de.intevation.gnv.transition.exception.TransitionException; | 54 import de.intevation.gnv.transition.exception.TransitionException; |
55 import de.intevation.gnv.exports.DefaultExport; | |
56 import de.intevation.gnv.exports.DefaultDataCollector; | |
57 import de.intevation.gnv.exports.DefaultProfile; | |
58 import de.intevation.gnv.exports.Export.Profile; | |
55 import de.intevation.gnv.utils.ArtifactXMLUtilities; | 59 import de.intevation.gnv.utils.ArtifactXMLUtilities; |
56 | 60 |
57 | 61 |
58 /** | 62 /** |
59 * @author Tim Englich <tim.englich@intevation.de> | 63 * @author Tim Englich <tim.englich@intevation.de> |
106 /** | 110 /** |
107 * Profile for exporting data to cvs | 111 * Profile for exporting data to cvs |
108 */ | 112 */ |
109 public static final Profile TIMESERIES_CSV_PROFILE = | 113 public static final Profile TIMESERIES_CSV_PROFILE = |
110 new DefaultProfile( | 114 new DefaultProfile( |
111 TIMESERIES_CSV_PROFILE_NAMES, | |
112 ',', | 115 ',', |
113 '"', | 116 '"', |
114 '"', | 117 '"', |
115 "CSV", | 118 "CSV", |
116 "ISO-8859-1"); | 119 "ISO-8859-1"); |
119 * Profile for exporting data to odv | 122 * Profile for exporting data to odv |
120 * TODO Change TIMESERIES_PROFILE_NAMES, which belong to CSV exports | 123 * TODO Change TIMESERIES_PROFILE_NAMES, which belong to CSV exports |
121 */ | 124 */ |
122 public static final Profile TIMESERIES_ODV_PROFILE = | 125 public static final Profile TIMESERIES_ODV_PROFILE = |
123 new DefaultProfile( | 126 new DefaultProfile( |
124 TIMESERIES_ODV_PROFILE_NAMES, | |
125 '\t', | 127 '\t', |
126 CSVWriter.NO_QUOTE_CHARACTER, | 128 CSVWriter.NO_QUOTE_CHARACTER, |
127 CSVWriter.NO_ESCAPE_CHARACTER, | 129 CSVWriter.NO_ESCAPE_CHARACTER, |
128 "ODV", | 130 "ODV", |
129 "ISO-8859-1"); | 131 "ISO-8859-1"); |
188 Collection<Statistic> statistics = s | 190 Collection<Statistic> statistics = s |
189 .calculateStatistics(chartResult); | 191 .calculateStatistics(chartResult); |
190 Document doc = this.writeStatistics2XML(statistics); | 192 Document doc = this.writeStatistics2XML(statistics); |
191 this.writeDocument2OutputStream(doc, outputStream); | 193 this.writeDocument2OutputStream(doc, outputStream); |
192 } else if (outputMode.equalsIgnoreCase("odv")) { | 194 } else if (outputMode.equalsIgnoreCase("odv")) { |
193 //TimeSeriesExport export = new TimeSeriesExport(); | |
194 //export.createODV(outputStream, chartResult); | |
195 | 195 |
196 Collection<Result> odvResult = this.getODVResult(uuid); | 196 Collection<Result> odvResult = this.getODVResult(uuid); |
197 this.createODV(outputStream, odvResult); | 197 this.createODV(outputStream, odvResult); |
198 } | 198 } |
199 } catch (IOException e) { | 199 } catch (IOException e) { |
219 protected void createCSV(OutputStream outputStream, | 219 protected void createCSV(OutputStream outputStream, |
220 Collection<Result> chartResult) | 220 Collection<Result> chartResult) |
221 throws UnsupportedEncodingException, | 221 throws UnsupportedEncodingException, |
222 IOException, | 222 IOException, |
223 TransitionException { | 223 TransitionException { |
224 DefaultExport export = new DefaultExport(); | 224 DefaultExport export = new DefaultExport(new DefaultDataCollector( |
225 TIMESERIES_CSV_PROFILE_NAMES)); | |
225 | 226 |
226 export.create(TIMESERIES_CSV_PROFILE, outputStream, chartResult); | 227 export.create(TIMESERIES_CSV_PROFILE, outputStream, chartResult); |
227 } | 228 } |
228 | 229 |
229 /** | 230 /** |
230 * TODO Result is not used at the moment. Change result with correct data. | 231 * TODO Result is not used at the moment. Change result with correct data. |
231 */ | 232 */ |
232 protected void createODV(OutputStream outputStream, Collection result) | 233 protected void createODV(OutputStream outputStream, Collection result) |
233 throws IOException, TransitionException { | 234 throws IOException, TransitionException { |
234 | 235 |
235 DefaultExport export = new DefaultExport(); | 236 DefaultExport export = new DefaultExport(new DefaultDataCollector( |
237 TIMESERIES_CSV_PROFILE_NAMES)); | |
236 | 238 |
237 export.create(TIMESERIES_ODV_PROFILE, outputStream, result); | 239 export.create(TIMESERIES_ODV_PROFILE, outputStream, result); |
238 } | 240 } |
239 | 241 |
240 /** | 242 /** |