Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/sq/SQMeasurementsJRDataSource.java @ 8578:4eb1a3c71579
(issue1753) Implement PDF export of SQ Measurement data.
The SQRelationExporter now consists of two reports
(to avoid subreport woes). The old SQReleation PDF
only takes the Page count of the Measurement attachment
as argument to correctly print the page numbers. Otherwise
it is unchanged.
The new SQMeasurements report lists the measured data points
on which the calculation was based.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 16 Mar 2015 11:35:19 +0100 |
parents | |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8577:3fae08a8cb90 | 8578:4eb1a3c71579 |
---|---|
1 /* Copyright (C) 2011, 2012, 2013, 2015 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.artifacts.model.sq; | |
10 | |
11 import java.util.ArrayList; | |
12 | |
13 import org.apache.log4j.Logger; | |
14 | |
15 import net.sf.jasperreports.engine.JRDataSource; | |
16 import net.sf.jasperreports.engine.JRException; | |
17 import net.sf.jasperreports.engine.JRField; | |
18 | |
19 | |
20 /** | |
21 * @author <a href="mailto:aheinecke@intevation.de">Andre Heinecke</a> | |
22 */ | |
23 public class SQMeasurementsJRDataSource implements JRDataSource | |
24 { | |
25 /** The log used in this exporter.*/ | |
26 private static Logger log = Logger.getLogger(SQMeasurementsJRDataSource.class); | |
27 | |
28 private ArrayList<String[]> data; | |
29 | |
30 private int index = -1; | |
31 | |
32 public SQMeasurementsJRDataSource() { | |
33 data = new ArrayList<String[]>(); | |
34 } | |
35 | |
36 public void addData(String[] val) { | |
37 data.add(val); | |
38 } | |
39 | |
40 public boolean next() throws JRException { | |
41 index++; | |
42 return (index < data.size()); | |
43 } | |
44 | |
45 public Object getFieldValue(JRField field) throws JRException { | |
46 Object value = ""; | |
47 String fieldName = field.getName(); | |
48 if ("param".equals(fieldName)) { | |
49 value = data.get(index)[0]; | |
50 } | |
51 else if ("transport".equals(fieldName)) { | |
52 value = data.get(index)[1]; | |
53 } | |
54 else if ("discharge".equals(fieldName)) { | |
55 value = data.get(index)[2]; | |
56 } | |
57 else if ("date".equals(fieldName)) { | |
58 value = data.get(index)[3]; | |
59 } | |
60 else if ("outlier".equals(fieldName)) { | |
61 value = data.get(index)[4]; | |
62 } | |
63 return value; | |
64 } | |
65 } | |
66 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |