annotate flys-artifacts/src/main/java/de/intevation/flys/exports/AbstractExporter.java @ 4910:a707ef048188

Insert CR and LF at the end of each line in CSV exports.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 30 Jan 2013 14:42:17 +0100
parents 118fe1cc8cc8
children baf51f820838
rev   line source
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.exports;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.IOException;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.io.OutputStream;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.io.OutputStreamWriter;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
2284
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
7 import java.text.NumberFormat;
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
8
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import org.w3c.dom.Document;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import org.apache.log4j.Logger;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import au.com.bytecode.opencsv.CSVWriter;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import de.intevation.artifacts.Artifact;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import de.intevation.artifacts.CallContext;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
18 import de.intevation.artifactdatabase.state.ArtifactAndFacet;
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
19 import de.intevation.artifactdatabase.state.Settings;
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 445
diff changeset
20
445
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
21 import de.intevation.artifacts.common.ArtifactNamespaceContext;
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
22 import de.intevation.artifacts.common.utils.XMLUtils;
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
23
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
24 import de.intevation.flys.artifacts.resources.Resources;
3422
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
25 import de.intevation.flys.collections.FLYSArtifactCollection;
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
26
2284
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
27 import de.intevation.flys.utils.Formatter;
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
28
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 /**
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 * An abstract exporter that implements some basic methods for exporting data of
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 * artifacts.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 *
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a>
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 */
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 public abstract class AbstractExporter implements OutGenerator {
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38 /** The logger used in this exporter.*/
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 private static Logger logger = Logger.getLogger(AbstractExporter.class);
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
3223
282c9da923ab FixA: flys/issue689: Export CSV for facet 'fix_parameters'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3217
diff changeset
41 /* XXX: Why does AbstractExporter do not implement FacetTypes? */
282c9da923ab FixA: flys/issue689: Export CSV for facet 'fix_parameters'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3217
diff changeset
42 public static String FIX_PARAMETERS = "fix_parameters";
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
44 /** The name of the CSV facet which triggers the CSV creation. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 public static final String FACET_CSV = "csv";
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
2176
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
47 /** The name of the PDF facet which triggers the PDF creation. */
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
48 public static final String FACET_PDF = "pdf";
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
49
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
50 /** The default charset for the CSV export. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 public static final String DEFAULT_CSV_CHARSET = "UTF-8";
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
53 /** The default separator for the CSV export. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 public static final char DEFAULT_CSV_SEPARATOR = ',';
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
56 /** XPath that points to the desired export facet. */
445
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
57 public static final String XPATH_FACET = "/art:action/@art:type";
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
58
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
59 /** The document of the incoming out() request. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 protected Document request;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
62 /** The output stream where the data should be written to. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 protected OutputStream out;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
65 /** The CallContext object. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 protected CallContext context;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
68 /** The selected facet. */
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 protected String facet;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70
3422
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
71 /** The collection.*/
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
72 protected FLYSArtifactCollection collection;
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
73
1160
efe1b8545f5c Cosmetics
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 710
diff changeset
74 /** The master artifact. */
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
75 protected Artifact master;
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
76
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 /**
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 * Concrete subclasses need to use this method to write their special data
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 * objects into the CSV document.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 *
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 * @param writer The CSVWriter.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 */
2792
fe987587ebc9 Merged revisions 4539-4540,4543,4545-4546 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2284
diff changeset
84 protected abstract void writeCSVData(CSVWriter writer) throws IOException;
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 /**
2176
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
88 * Concrete subclasses need to use this method to write their special data
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
89 * objects into the PDF document.
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
90 */
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
91 protected abstract void writePDF(OutputStream out);
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
92
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
93
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
94 /**
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 * This method enables concrete subclasses to collected its own special
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 * data.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3223
diff changeset
98 * @param data The artifact that stores the data that has to be
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 * exported.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 */
701
dad1a2c88f9f Base WST/CSV exports on facets. TODO: generate the facets.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 695
diff changeset
101 protected abstract void addData(Object data);
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3223
diff changeset
103
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
104 @Override
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 public void init(Document request, OutputStream out, CallContext context) {
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 logger.debug("AbstractExporter.init");
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 this.request = request;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 this.out = out;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 this.context = context;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
114 @Override
412
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
115 public void setMasterArtifact(Artifact master) {
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
116 this.master = master;
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
117 }
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
118
046bd86ae41d Improved the OutGenerator interface to set a master artifact for the out generation.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 391
diff changeset
119
3422
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
120 @Override
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
121 public void setCollection(FLYSArtifactCollection collection) {
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
122 this.collection = collection;
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
123 }
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
124
118fe1cc8cc8 OutGenerators got a setCollection() method; analogous to setMasterArtifact(). Registered the SQOverviewGenerator as OutGenerator for 'sq_overview' Output.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 3270
diff changeset
125
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
126 /**
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
127 * This doOut() just collects the data of multiple artifacts. Therefore, it
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
128 * makes use of the addData() method which enables concrete subclasses to
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
129 * store its data on its own. The real output creation takes place in the
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
130 * concrete generate() methods.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
131 *
3270
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3223
diff changeset
132 * @param artifactFacet The artifact and facet.
4ac581062c40 Fix various documentation issues.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 3223
diff changeset
133 * The facet to add - NOTE: the facet needs to fit to the first
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
134 * facet inserted into this exporter. Otherwise this artifact/facet is
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
135 * skipped.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
136 * @param attr The attr document.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
137 */
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
138 @Override
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1160
diff changeset
139 public void doOut(
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
140 ArtifactAndFacet artifactFacet,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
141 Document attr,
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
142 boolean visible
1684
bdb05dc9b763 Bugfix: #353 Enabled chart's to be drawn with proper axes set even if no data is contained.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1160
diff changeset
143 ) {
1944
21a4d2c677a1 Changed doOut signature, side effect from blackboard feature (to come).
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 1684
diff changeset
144 String name = artifactFacet.getFacetName();
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
145
695
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 445
diff changeset
146 logger.debug("AbstractExporter.doOut: " + name);
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 445
diff changeset
147
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 445
diff changeset
148 if (!isFacetValid(name)) {
45cd58a2a2bb OutGenerators doOut() takes a facet object now instead of just its name.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 445
diff changeset
149 logger.warn("Facet '" + name + "' not valid. No output created!");
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
150 return;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152
2038
f73036b991e2 Bugfix: repaired broken named values in exports - the last solution had bad side effects.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2035
diff changeset
153 addData(artifactFacet.getData(context));
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
154 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
155
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
156
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
157 /**
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
158 * Generates an export based on a specified facet.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
159 */
710
cded0924193d Added generator and facet for error reports.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 701
diff changeset
160 @Override
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
161 public void generate()
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
162 throws IOException
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
163 {
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
164 logger.debug("AbstractExporter.generate");
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
165
3217
79dd823733e2 FixA: Added parameter exporter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2792
diff changeset
166 if (facet == null) {
79dd823733e2 FixA: Added parameter exporter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2792
diff changeset
167 throw new IOException("invalid (null) facet for exporter");
79dd823733e2 FixA: Added parameter exporter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2792
diff changeset
168 }
79dd823733e2 FixA: Added parameter exporter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2792
diff changeset
169
79dd823733e2 FixA: Added parameter exporter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2792
diff changeset
170 if (facet.equals(FACET_CSV)) {
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
171 generateCSV();
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
172 }
3217
79dd823733e2 FixA: Added parameter exporter.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 2792
diff changeset
173 else if (facet.equals(FACET_PDF)) {
2176
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
174 generatePDF();
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
175 }
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
176 else {
3223
282c9da923ab FixA: flys/issue689: Export CSV for facet 'fix_parameters'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3217
diff changeset
177 throw new IOException(
282c9da923ab FixA: flys/issue689: Export CSV for facet 'fix_parameters'
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 3217
diff changeset
178 "invalid facet for exporter: '" + facet + "'");
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
179 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
180 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
181
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
182
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
183 /**
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
184 * Determines if the desired facet is valid for this exporter. If no facet
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
185 * is currently set, <i>facet</i> is set.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
186 *
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
187 * @param facet The desired facet.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
188 *
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
189 * @return true, if <i>facet</i> is valid, otherwise false.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
190 */
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
191 protected boolean isFacetValid(String facet) {
2284
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
192 logger.debug("AbstractExporter.isFacetValid : " + facet + " (" + getFacet() + ")" );
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
193
445
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
194 String thisFacet = getFacet();
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
195
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
196 if (thisFacet == null || thisFacet.length() == 0) {
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
197 return false;
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
198 }
445
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
199 else if (facet == null || facet.length() == 0) {
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
200 return false;
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
201 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
202 else {
445
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
203 return thisFacet.equals(facet);
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
204 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
205 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
206
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
207
445
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
208 /**
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
209 * Returns the name of the desired facet.
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
210 *
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
211 * @return the name of the desired facet.
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
212 */
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
213 protected String getFacet() {
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
214 if (facet == null) {
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
215 facet = getFacetFromRequest();
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
216 }
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
217
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
218 return facet;
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
219 }
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
220
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
221
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
222 /**
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
223 * Extracts the name of the requested facet from request document.
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
224 *
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
225 * @return the name of the requested facet.
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
226 */
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
227 protected String getFacetFromRequest() {
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
228 return XMLUtils.xpathString(
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
229 request, XPATH_FACET, ArtifactNamespaceContext.INSTANCE);
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
230 }
a7947972fdeb Added a new class that supports formatters for different types of data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 418
diff changeset
231
416
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
232
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
233 protected String msg(String key, String def) {
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
234 return Resources.getMsg(context.getMeta(), key, def);
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
235 }
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
236
340dc41a7ea3 The CSV exports will now have headers.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 412
diff changeset
237
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
238 /**
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
239 * This method starts CSV creation. It makes use of writeCSVData() which has
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
240 * to be implemented by concrete subclasses.
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
241 */
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
242 protected void generateCSV()
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
243 throws IOException
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
244 {
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
245 logger.info("AbstractExporter.generateCSV");
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
246
4910
a707ef048188 Insert CR and LF at the end of each line in CSV exports.
Raimund Renkert <rrenkert@intevation.de>
parents: 3422
diff changeset
247 char quote = '"';
a707ef048188 Insert CR and LF at the end of each line in CSV exports.
Raimund Renkert <rrenkert@intevation.de>
parents: 3422
diff changeset
248 char escape = '\\';
a707ef048188 Insert CR and LF at the end of each line in CSV exports.
Raimund Renkert <rrenkert@intevation.de>
parents: 3422
diff changeset
249
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
250 CSVWriter writer = new CSVWriter(
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
251 new OutputStreamWriter(
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
252 out,
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
253 DEFAULT_CSV_CHARSET),
4910
a707ef048188 Insert CR and LF at the end of each line in CSV exports.
Raimund Renkert <rrenkert@intevation.de>
parents: 3422
diff changeset
254 DEFAULT_CSV_SEPARATOR, quote, escape, "\r\n");
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
255
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
256 writeCSVData(writer);
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
257
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
258 writer.close();
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
259 }
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
260
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
261
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
262 /**
2176
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
263 * This method starts PDF creation.
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
264 */
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
265 protected void generatePDF()
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
266 throws IOException
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
267 {
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
268 logger.info("AbstractExporter.generatePDF");
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
269 writePDF(this.out);
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
270 }
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
271
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
272
65dac9cf6ff5 Issue 138.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2047
diff changeset
273 /**
1979
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
274 * Returns an instance of <i>EmptySettings</i> currently!
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
275 *
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
276 * @return an instance of <i>EmptySettings</i>.
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
277 */
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
278 public Settings getSettings() {
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
279 return new EmptySettings();
a7c437c9547e Added a getSettings() operation to OutGenerator - FLYSArtifactCollection will now evaluate all available Outputs and create initial Settings using OutGenerators if the Settings for an Output is missing.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 1948
diff changeset
280 }
2047
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
281
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
282
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
283 /**
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
284 * This method is not implemented. Override it in subclasses if those need a
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
285 * <i>Settings</i> object.
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
286 */
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
287 public void setSettings(Settings settings) {
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
288 // do nothing
0318fa6f0844 Make use of first attributes specified in the ChartSettings. NOTE: work is still in progress.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2038
diff changeset
289 }
2284
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
290
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
291
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
292 /**
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
293 * Returns the number formatter for kilometer values.
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
294 *
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
295 * @return the number formatter for kilometer values.
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
296 */
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
297 protected NumberFormat getKmFormatter() {
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
298 return Formatter.getWaterlevelKM(context);
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
299 }
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
300
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
301
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
302 /**
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
303 * Returns the number formatter for W values.
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
304 *
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
305 * @return the number formatter for W values.
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
306 */
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
307 protected NumberFormat getWFormatter() {
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
308 return Formatter.getWaterlevelW(context);
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
309 }
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
310
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
311
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
312 /**
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
313 * Returns the number formatter for Q values.
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
314 *
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
315 * @return the number formatter for Q values.
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
316 */
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
317 protected NumberFormat getQFormatter() {
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
318 return Formatter.getWaterlevelQ(context);
5d1ba04d2f68 Refactored Formatter access to ease reuse.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 2176
diff changeset
319 }
391
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
320 }
5d6988836f01 Added an exporter to export the computed data of a duration curve.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
321 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org