Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/sinfo/flood_duration/FloodDurationExporter.java @ 9176:1614cb14308f
Work on calculations for S-Info flood duration workflow
author | mschaefer |
---|---|
date | Mon, 25 Jun 2018 19:21:11 +0200 |
parents | 23945061daec |
children | a4121ec450d6 |
comparison
equal
deleted
inserted
replaced
9175:34dc0163ad2d | 9176:1614cb14308f |
---|---|
27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> | 27 * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> |
28 * @author Gernot Belger | 28 * @author Gernot Belger |
29 */ | 29 */ |
30 // REMARK: must be public because its registered in generators.xml | 30 // REMARK: must be public because its registered in generators.xml |
31 public class FloodDurationExporter extends AbstractCommonExporter<FloodDurationCalculationResults> { | 31 public class FloodDurationExporter extends AbstractCommonExporter<FloodDurationCalculationResults> { |
32 | |
33 @Override | |
34 protected void doWritePdf(final OutputStream out, final FloodDurationCalculationResults results) { | |
35 | |
36 // TODO: Move to super (hier ist aber spezieller code drin...) | |
37 try { | |
38 final ExportContextCSV exportContextCSV = new ExportContextCSV(this.context, null); | |
39 | |
40 final JasperReporter reporter = new JasperReporter(); | |
41 | |
42 for (final AbstractCalculationExportableResult<FloodDurationCalculationResults> result : results.getResults()) { | |
43 final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource(); | |
44 getHelper().addJRMetaDataUSINFO(source, results); | |
45 | |
46 final JasperDesigner design = result.addReport(exportContextCSV, results, reporter, source); | |
47 if (result instanceof FloodDurationCalculationResult) { | |
48 final int wlCount = ((FloodDurationCalculationResult) result).getWaterlevelCount(); | |
49 if (wlCount == 0 || wlCount == 2) { | |
50 design.removeColumn("wOpt"); | |
51 design.removeColumn("qOpt"); | |
52 design.removeColumn("bezOpt"); | |
53 design.removeColumn("durOpt"); | |
54 } | |
55 } | |
56 } | |
57 | |
58 reporter.exportPDF(out); | |
59 } | |
60 catch (final JRException je) { | |
61 getLog().warn("Error generating PDF Report!", je); | |
62 } | |
63 | |
64 } | |
65 | 32 |
66 @Override | 33 @Override |
67 protected void doWriteCSVData(final CSVWriter writer, final FloodDurationCalculationResults results) { | 34 protected void doWriteCSVData(final CSVWriter writer, final FloodDurationCalculationResults results) { |
68 // TODO: Diesen Ablauf in super? | 35 // TODO: Diesen Ablauf in super? |
69 | 36 |
94 result.writeCsv(exportContextCSV, results); | 61 result.writeCsv(exportContextCSV, results); |
95 } | 62 } |
96 | 63 |
97 } | 64 } |
98 | 65 |
66 @Override | |
67 protected void doWritePdf(final OutputStream out, final FloodDurationCalculationResults results) { | |
68 | |
69 // TODO: Move to super (hier ist aber spezieller code drin...) | |
70 try { | |
71 final ExportContextCSV exportContextCSV = new ExportContextCSV(this.context, null); | |
72 | |
73 final JasperReporter reporter = new JasperReporter(); | |
74 | |
75 for (final AbstractCalculationExportableResult<FloodDurationCalculationResults> result : results.getResults()) { | |
76 final MetaAndTableJRDataSource source = new MetaAndTableJRDataSource(); | |
77 getHelper().addJRMetaDataUSINFO(source, results); | |
78 | |
79 final JasperDesigner design = result.addReport(exportContextCSV, results, reporter, source); | |
80 if (result instanceof FloodDurationCalculationResult) { | |
81 // final int wlCount = ((FloodDurationCalculationResult) result).getWaterlevelCount(); | |
82 // if (wlCount == 0 || wlCount == 2) { | |
83 design.removeColumn("wOpt"); | |
84 design.removeColumn("qOpt"); | |
85 design.removeColumn("bezOpt"); | |
86 design.removeColumn("durOpt"); | |
87 // } | |
88 } | |
89 } | |
90 | |
91 reporter.exportPDF(out); | |
92 } | |
93 catch (final JRException je) { | |
94 getLog().warn("Error generating PDF Report!", je); | |
95 } | |
96 | |
97 } | |
99 } | 98 } |