Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/Access.java @ 4305:8c51c43e59ca
Rename gauge_discharge_curve_at_export facet to at
Rename gauge_discharge_curve_at_export facet to at to get an export with a
filename ending .at. This feels horribly wrong...
author | Björn Ricks <bjoern.ricks@intevation.de> |
---|---|
date | Mon, 29 Oct 2012 15:24:32 +0100 |
parents | 5ff3b2f5fb1c |
children | cbd0fafcb26b |
rev | line source |
---|---|
3208
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.access; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import de.intevation.artifactdatabase.data.StateData; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import de.intevation.flys.artifacts.FLYSArtifact; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
3210
ae14f412ba10
SQ: finished the access stuff.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3209
diff
changeset
|
7 import de.intevation.flys.artifacts.model.DateRange; |
3208
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import de.intevation.flys.utils.FLYSUtils; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import gnu.trove.TDoubleArrayList; |
4152
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
12 import gnu.trove.TLongArrayList; |
3208
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import java.util.ArrayList; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import java.util.Date; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
16 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import org.apache.log4j.Logger; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
3209
03fc05655258
SQ: Added artifact access stub.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
3208
diff
changeset
|
19 public class Access |
3208
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 private static Logger log = Logger.getLogger(Access.class); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 protected FLYSArtifact artifact; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
24 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
25 public Access() { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
26 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 public Access(FLYSArtifact artifact) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 this.artifact = artifact; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 public FLYSArtifact getArtifact() { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 return artifact; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 public void setArtifact(FLYSArtifact artifact) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 this.artifact = artifact; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 protected String getString(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 log.warn("missing '" + key + "' value"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 return (String)sd.getValue(); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 protected Double getDouble(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 log.warn("missing '" + key + "' value"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 try { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 return Double.valueOf((String)sd.getValue()); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 catch (NumberFormatException nfe) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 log.warn(key + " '" + sd.getValue() + "' is not numeric."); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 protected Long getLong(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 log.warn("missing '" + key + "' value"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 try { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 return Long.valueOf((String)sd.getValue()); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 catch (NumberFormatException nfe) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 log.warn(key + " '" + sd.getValue() + "' is not a long integer."); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 protected Integer getInteger(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
80 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
81 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
82 log.warn("missing '" + key + "' value"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 try { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
86 return Integer.valueOf((String)sd.getValue()); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
87 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
88 catch (NumberFormatException nfe) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 log.warn(key + " '" + sd.getValue() + "' is not a integer."); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
90 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
92 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
93 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 protected int [] getIntArray(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
96 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
97 log.warn("missing '" + key +"' value"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 return FLYSUtils.intArrayFromString((String)sd.getValue()); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
101 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
102 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
103 protected DateRange [] getDateRange(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
104 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
105 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
106 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
107 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
108 log.warn("missing '" + key + "'"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
109 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
110 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
111 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
112 String data = (String)sd.getValue(); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
113 String[] pairs = data.split("\\s*;\\s*"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
114 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
115 ArrayList<DateRange> aPs = new ArrayList<DateRange>(pairs.length); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
116 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
117 for (int i = 0; i < pairs.length; i++) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
118 String[] fromTo = pairs[i].split("\\s*,\\s*"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
119 if (fromTo.length >= 2) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
120 try { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
121 Date from = new Date(Long.parseLong(fromTo[0])); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
122 Date to = new Date(Long.parseLong(fromTo[1])); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 DateRange aP = new DateRange(from, to); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 if (!aPs.contains(aP)) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 aPs.add(aP); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
127 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
128 catch (NumberFormatException nfe) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
129 log.warn(key + " contains no long values.", nfe); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
133 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
134 DateRange [] result = aPs.toArray(new DateRange[aPs.size()]); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 if (log.isDebugEnabled()) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 for (int i = 0; i < result.length; ++i) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 DateRange ap = result[i]; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
139 log.debug("period " + |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
140 ap.getFrom() + " - " + ap.getTo()); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
141 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
142 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
143 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 return result; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
145 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
146 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
147 protected Boolean getBoolean(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
148 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
149 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
150 log.warn("missing '" + key + "' value"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
151 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
152 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
153 return Boolean.valueOf((String)sd.getValue()); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
154 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
155 |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
156 protected double [] getDoubleArray(String key) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
157 StateData sd = artifact.getData(key); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
158 if (sd == null) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
159 log.warn("missing '" + key + "'"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
160 return null; |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
161 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
162 String [] parts = ((String)sd.getValue()).split("[\\s;]+"); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
163 TDoubleArrayList list = new TDoubleArrayList(parts.length); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
164 for (String part: parts) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
165 try { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
166 list.add(Double.parseDouble(part)); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
167 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
168 catch (NumberFormatException nfe) { |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
169 log.warn("'" + part + "' is not numeric."); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
170 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
171 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
172 return list.toNativeArray(); |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
173 } |
4152
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
174 |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
175 protected long [] getLongArray(String key) { |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
176 StateData sd = artifact.getData(key); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
177 if (sd == null) { |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
178 log.warn("missing '" + key + "'"); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
179 return null; |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
180 } |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
181 String [] parts = ((String)sd.getValue()).split("[\\s;]+"); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
182 TLongArrayList list = new TLongArrayList(parts.length); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
183 for (String part: parts) { |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
184 try { |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
185 list.add(Long.parseLong(part)); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
186 } |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
187 catch (NumberFormatException nfe) { |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
188 log.warn("'" + part + "' is not numeric."); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
189 } |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
190 } |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
191 return list.toNativeArray(); |
5ff3b2f5fb1c
Added evaluation timerange to subtitle of historical discharge curve charts.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3259
diff
changeset
|
192 } |
3208
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
193 } |
90c4ce100ce1
Added new base class for *Access
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
194 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |