annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WWQQJRDataSource.java @ 2719:d1d35892bbdd

Adjusted fixings transitions and implemented event select state. flys-artifacts/trunk@4450 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 21 May 2012 09:27:32 +0000
parents 87085ccea466
children 4bd3d8bbb60c
rev   line source
2310
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.model;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
2
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
3 import java.util.ArrayList;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
4 import java.util.HashMap;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
5
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
6 import org.apache.log4j.Logger;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
7
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
8 import net.sf.jasperreports.engine.JRDataSource;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
9 import net.sf.jasperreports.engine.JRException;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
10 import net.sf.jasperreports.engine.JRField;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
11
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
12
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
13 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
14 * @author <a href="mailto:raimund.renkert@intevation.de">Raimund Renkert</a>
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
15 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
16 public class WWQQJRDataSource implements JRDataSource
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
17 {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
18 /** The logger used in this exporter.*/
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
19 private static Logger logger = Logger.getLogger(WWQQJRDataSource.class);
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
20
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
21 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
22 *
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
23 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
24 private ArrayList<String[]> data;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
25 private HashMap<String, String> metaData;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
26
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
27 private int index = -1;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
28
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
29 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
30 *
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
31 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
32 public WWQQJRDataSource()
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
33 {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
34 data = new ArrayList<String[]>();
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
35 metaData = new HashMap<String, String>();
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
36 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
37
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
38
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
39 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
40 *
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
41 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
42 public void addData(String[] data) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
43 this.data.add(data);
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
44 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
45
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
46
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
47 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
48 *
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
49 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
50 public void addMetaData(String key, String value) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
51 this.metaData.put(key, value);
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
52 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
53
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
54
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
55 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
56 *
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
57 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
58 public boolean next() throws JRException
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
59 {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
60 index++;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
61
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
62 return (index < data.size());
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
63 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
64
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
65
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
66 /**
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
67 *
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
68 */
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
69 public Object getFieldValue(JRField field) throws JRException
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
70 {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
71 Object value = "";
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
72 String fieldName = field.getName();
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
73 if ("river".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
74 value = metaData.get("river");
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
75 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
76 if ("date".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
77 value = metaData.get("date");
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
78 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
79 if ("calculation".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
80 value = metaData.get("calculation");
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
81 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
82 if ("reference".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
83 value = metaData.get("reference");
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
84 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
85 if ("location".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
86 value = metaData.get("location");
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
87 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
88 if ("km1".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
89 value = data.get(index)[0];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
90 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
91 if ("location1".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
92 value = data.get(index)[1];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
93 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
94 if ("W1".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
95 value = data.get(index)[2];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
96 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
97 if ("Q1".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
98 value = data.get(index)[3];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
99 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
100 if ("km2".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
101 value = data.get(index)[4];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
102 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
103 if ("location2".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
104 value = data.get(index)[5];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
105 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
106 if ("W2".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
107 value = data.get(index)[6];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
108 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
109 if ("Q2".equals(fieldName)) {
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
110 value = data.get(index)[7];
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
111 }
2631
87085ccea466 Issue 528, 637.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2310
diff changeset
112 if ("Wcm1".equals(fieldName)) {
87085ccea466 Issue 528, 637.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2310
diff changeset
113 value = data.get(index)[8];
87085ccea466 Issue 528, 637.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2310
diff changeset
114 }
87085ccea466 Issue 528, 637.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2310
diff changeset
115 if("Wcm2".equals(fieldName)) {
87085ccea466 Issue 528, 637.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2310
diff changeset
116 value = data.get(index)[9];
87085ccea466 Issue 528, 637.
Raimund Renkert <raimund.renkert@intevation.de>
parents: 2310
diff changeset
117 }
2310
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
118 return value;
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
119 }
ecb76933362f Added PDF export to reference curve calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff changeset
120 }

http://dive4elements.wald.intevation.org