Mercurial > dive4elements > gnv-client
comparison gnv-artifacts/src/main/java/de/intevation/gnv/exports/DefaultExport.java @ 771:a0e63136954e
Added and repaired javadoc in de.intevation.gnv.exports package.
gnv-artifacts/trunk@827 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Thu, 25 Mar 2010 09:01:14 +0000 |
parents | f28a7eac542a |
children | 9a828e5a2390 |
comparison
equal
deleted
inserted
replaced
770:d70cac2bafc0 | 771:a0e63136954e |
---|---|
12 import au.com.bytecode.opencsv.CSVWriter; | 12 import au.com.bytecode.opencsv.CSVWriter; |
13 import de.intevation.gnv.geobackend.base.Result; | 13 import de.intevation.gnv.geobackend.base.Result; |
14 import de.intevation.gnv.state.exception.StateException; | 14 import de.intevation.gnv.state.exception.StateException; |
15 | 15 |
16 /** | 16 /** |
17 * @author Sascha L. Teichmann (sascha.teichmann@intevation.de) | 17 * This class is the default implementation of {@link Export}. |
18 * @author Ingo Weinzierl (ingo.weinzierl@intevation.de) | 18 * |
19 * @author <a href="mailto:sascha.teichmann@intevation.de">Sascha L. Teichmann</a> | |
20 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | |
19 */ | 21 */ |
20 public class DefaultExport | 22 public class DefaultExport |
21 implements Export | 23 implements Export |
22 { | 24 { |
25 /** | |
26 * Logger used for logging via log4j. | |
27 */ | |
23 private static Logger log = Logger.getLogger(DefaultExport.class); | 28 private static Logger log = Logger.getLogger(DefaultExport.class); |
24 | 29 |
30 /** | |
31 * DataCollector used to extract data from <code>Result</code> objects. | |
32 */ | |
25 protected Export.DataCollector collector; | 33 protected Export.DataCollector collector; |
26 | 34 |
35 /** | |
36 * Constructor | |
37 * | |
38 * @param collector See {@link #collector} | |
39 */ | |
27 public DefaultExport(Export.DataCollector collector) { | 40 public DefaultExport(Export.DataCollector collector) { |
28 this.collector = collector; | 41 this.collector = collector; |
29 } | 42 } |
30 | 43 |
44 /** | |
45 * This method writes data stored in <code>result</code> into a CSV document | |
46 * using <code>writer</code>. | |
47 * | |
48 * @param profile {@link #Profile} used to specify the format and columns. | |
49 * @param result Collection storing the required data. | |
50 * @param writer CSVWriter to write the csv document. | |
51 * | |
52 * @throws StateException | |
53 */ | |
31 protected void writeData( | 54 protected void writeData( |
32 Profile profile, | 55 Profile profile, |
33 Collection result, | 56 Collection result, |
34 CSVWriter writer | 57 CSVWriter writer |
35 ) | 58 ) |
46 | 69 |
47 writer.writeNext(collector.getData(res)); | 70 writer.writeNext(collector.getData(res)); |
48 } | 71 } |
49 } | 72 } |
50 | 73 |
74 /** | |
75 * This method takes a data Collection and writes it to | |
76 * <code>outputStream</code> using the the format specified by | |
77 * <code>profile</code>. | |
78 * | |
79 * @param profile used to specify the format and columns. | |
80 * @param outputStream OutputStream which is used for writing the export | |
81 * document to. | |
82 * @param result Collection storing the data. | |
83 * | |
84 * @throws IOException if writing to OutputStream failed. | |
85 * @throws UnsupportedEncodingException if the encoding was not accepted. | |
86 * @throws StateException if result is null. | |
87 */ | |
51 public void create( | 88 public void create( |
52 Profile profile, | 89 Profile profile, |
53 OutputStream outputStream, | 90 OutputStream outputStream, |
54 Collection result | 91 Collection result |
55 ) | 92 ) |
76 writeData(profile, result, writer); | 113 writeData(profile, result, writer); |
77 | 114 |
78 writer.close(); | 115 writer.close(); |
79 } | 116 } |
80 } | 117 } |
118 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |