Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/uinfo/salix/SalixLineExporter.java @ 9006:7134a4c7d1b6
U-Info S-Info general work
author | gernotbelger |
---|---|
date | Tue, 17 Apr 2018 13:20:25 +0200 |
parents | fb9430250899 |
children | 41f4bc83aa7a |
comparison
equal
deleted
inserted
replaced
9005:460fcc128794 | 9006:7134a4c7d1b6 |
---|---|
7 * and comes with ABSOLUTELY NO WARRANTY! Check out the | 7 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
8 * documentation coming with Dive4Elements River for details. | 8 * documentation coming with Dive4Elements River for details. |
9 */ | 9 */ |
10 package org.dive4elements.river.artifacts.uinfo.salix; | 10 package org.dive4elements.river.artifacts.uinfo.salix; |
11 | 11 |
12 import java.io.OutputStream; | |
12 import java.util.ArrayList; | 13 import java.util.ArrayList; |
13 import java.util.Collection; | 14 import java.util.Collection; |
14 | 15 |
15 import org.apache.log4j.Logger; | 16 import org.apache.log4j.Logger; |
16 import org.dive4elements.river.artifacts.common.GeneralResultType; | 17 import org.dive4elements.river.artifacts.common.GeneralResultType; |
18 import org.dive4elements.river.artifacts.common.JasperReporter; | |
19 import org.dive4elements.river.artifacts.common.MetaAndTableJRDataSource; | |
17 import org.dive4elements.river.artifacts.common.ResultRow; | 20 import org.dive4elements.river.artifacts.common.ResultRow; |
18 import org.dive4elements.river.artifacts.sinfo.util.MetaAndTableJRDataSource; | |
19 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; | 21 import org.dive4elements.river.artifacts.sinfo.util.RiverInfo; |
20 import org.dive4elements.river.artifacts.uinfo.commons.AbstractUInfoExporter; | 22 import org.dive4elements.river.artifacts.uinfo.commons.AbstractUInfoExporter; |
21 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; | 23 import org.dive4elements.river.artifacts.uinfo.commons.UInfoResultType; |
22 | 24 |
23 import au.com.bytecode.opencsv.CSVWriter; | 25 import au.com.bytecode.opencsv.CSVWriter; |
26 import net.sf.jasperreports.engine.JRException; | |
24 | 27 |
25 /** | 28 /** |
26 * @author Domenico Nardi Tironi | 29 * @author Domenico Nardi Tironi |
27 * | 30 * |
28 */ | 31 */ |
29 public class SalixLineExporter extends AbstractUInfoExporter<SalixLineCalculationResult, SalixLineCalculationResults> { | 32 public class SalixLineExporter extends AbstractUInfoExporter<SalixLineCalculationResult, SalixLineCalculationResults> { |
30 | 33 |
31 /** The log used in this exporter. */ | 34 /** The log used in this exporter. */ |
32 private static Logger log = Logger.getLogger(SalixLineExporter.class); | 35 private static Logger log = Logger.getLogger(SalixLineExporter.class); |
33 | 36 |
34 private static final String JASPER_FILE = "/jasper/uinfo.salixline.jasper"; | 37 private static final String JASPER_FILE = "/jasper/templates/uinfo.salixline.jrxml"; |
35 | 38 |
36 @Override | 39 @Override |
37 protected Logger getLog() { | 40 protected Logger getLog() { |
38 return log; | 41 return log; |
39 } | 42 } |
154 lines.add(row.exportValue(this.context, UInfoResultType.salixlinescen)); | 157 lines.add(row.exportValue(this.context, UInfoResultType.salixlinescen)); |
155 return lines.toArray(new String[lines.size()]); | 158 return lines.toArray(new String[lines.size()]); |
156 } | 159 } |
157 | 160 |
158 @Override | 161 @Override |
159 protected final String getJasperFile() { | |
160 return JASPER_FILE; | |
161 } | |
162 | |
163 @Override | |
164 protected final void addJRMetaData(final MetaAndTableJRDataSource source, final SalixLineCalculationResults results) { | 162 protected final void addJRMetaData(final MetaAndTableJRDataSource source, final SalixLineCalculationResults results) { |
165 | 163 |
166 super.addJRMetaData(source, results); | 164 super.addJRMetaData(source, results); |
167 | 165 |
168 /* additional column headings */ | 166 /* additional column headings */ |
169 source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta())); | 167 source.addMetaData("station_header", GeneralResultType.station.getPdfHeader(this.context.getMeta())); |
170 // source.addMetaData("flowdepth_header", SInfoResultType.flowdepth.getPdfHeader(this.context.getMeta())); | 168 |
171 // source.addMetaData("flowdepth_tkh_header", SInfoResultType.flowdepthtkh.getPdfHeader(this.context.getMeta())); | 169 source.addMetaData("salix_line", UInfoResultType.salixline.getPdfHeader(this.context.getMeta())); |
172 // source.addMetaData("tkh_header", SInfoResultType.tkh.getPdfHeader(this.context.getMeta())); | 170 // wenn "historisch" gewählt wurde, nur "historisch" anzeigen; sonst für jeden scen-wert ne neue Spalte und "hist" |
173 // source.addMetaData("waterlevel_header", SInfoResultType.waterlevel.getPdfHeader(this.context.getMeta())); | 171 // ausblenden!...!..!! |
174 // source.addMetaData("discharge_header", SInfoResultType.discharge.getPdfHeader(this.context.getMeta())); | 172 source.addMetaData("salix_line_hist", UInfoResultType.salixlinehist.getPdfHeader(this.context.getMeta())); |
175 // source.addMetaData("waterlevel_name_header", SInfoResultType.waterlevelLabel.getPdfHeader(this.context.getMeta())); | 173 source.addMetaData("salix_line_scen", UInfoResultType.salixlinescen.getPdfHeader(this.context.getMeta())); |
176 // source.addMetaData("gauge_header", SInfoResultType.gaugeLabel.getPdfHeader(this.context.getMeta())); | 174 } |
177 // source.addMetaData("bedheight_header", SInfoResultType.meanBedHeight.getPdfHeader(this.context.getMeta())); | 175 |
178 // source.addMetaData("sounding_name_header", SInfoResultType.soundingLabel.getPdfHeader(this.context.getMeta())); | 176 @Override |
179 // source.addMetaData("location_header", SInfoResultType.location.getPdfHeader(this.context.getMeta())); | 177 protected void writePDF(final OutputStream out) { |
178 try { | |
179 final MetaAndTableJRDataSource source = createJRData(this.data); | |
180 | |
181 final JasperReporter reporter = new JasperReporter(); | |
182 reporter.addReport(JASPER_FILE, source); | |
183 reporter.exportPDF(out); | |
184 } | |
185 catch (final JRException je) { | |
186 getLog().warn("Error generating PDF Report!", je); | |
187 } | |
188 | |
180 } | 189 } |
181 | 190 |
182 } | 191 } |