annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/access/FixAccess.java @ 5308:7712dacc27ab

Avoid NPE if data list is null.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 14 Mar 2013 17:16:15 +0100
parents a929d9a9fa1e
children
rev   line source
3418
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.artifacts.access;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
4866
acfd48384835 Changed data field names in fix analsis to ld_from, ld_to, ld step.
Raimund Renkert <rrenkert@intevation.de>
parents: 3777
diff changeset
3 import de.intevation.artifacts.CallContext;
3418
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4 import de.intevation.flys.artifacts.FLYSArtifact;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6 import java.util.Arrays;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import org.apache.log4j.Logger;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9
5107
a929d9a9fa1e Picky doc and whitespace fixes.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents: 4866
diff changeset
10 /** Access for Fixation related data. */
3418
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 public class FixAccess
4866
acfd48384835 Changed data field names in fix analsis to ld_from, ld_to, ld step.
Raimund Renkert <rrenkert@intevation.de>
parents: 3777
diff changeset
12 extends RangeAccess
3418
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 private static Logger log = Logger.getLogger(FixAccess.class);
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 protected Long start;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 protected Long end;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 protected Integer qSectorStart;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 protected Integer qSectorEnd;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 protected int [] events;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 protected Boolean preprocessing;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 protected String function;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
4866
acfd48384835 Changed data field names in fix analsis to ld_from, ld_to, ld step.
Raimund Renkert <rrenkert@intevation.de>
parents: 3777
diff changeset
28 public FixAccess(FLYSArtifact artifact, CallContext context) {
acfd48384835 Changed data field names in fix analsis to ld_from, ld_to, ld step.
Raimund Renkert <rrenkert@intevation.de>
parents: 3777
diff changeset
29 super(artifact, context);
3418
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32 public Long getStart() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
33
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 if (start == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 start = getLong("start");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 if (log.isDebugEnabled()) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 log.debug("start: '" + start + "'");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 return start;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 public Long getEnd() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 if (end == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 end = getLong("end");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 if (log.isDebugEnabled()) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 log.debug("end: '" + end + "'");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 return end;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 public Integer getQSectorStart() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60 if (qSectorStart == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 qSectorStart = getInteger("q1");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64 if (log.isDebugEnabled()) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
65 log.debug("q1: '" + qSectorStart + "'");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 return qSectorStart;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 public Integer getQSectorEnd() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73 if (qSectorEnd == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 qSectorEnd = getInteger("q2");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 if (log.isDebugEnabled()) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 log.debug("q2: '" + qSectorEnd + "'");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 return qSectorEnd;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 public int [] getEvents() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 if (events == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
86 events = getIntArray("events");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
87 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
88 if (log.isDebugEnabled() && events != null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
89 log.debug("events: " + Arrays.toString(events));
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
90 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
91 return events;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
92 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
93
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
94 public Boolean getPreprocessing() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
95 if (preprocessing == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
96 preprocessing = getBoolean("preprocessing");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
97 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
98 if (log.isDebugEnabled()) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
99 log.debug("preprocessing: " + preprocessing);
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
100 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
101 return preprocessing;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
102 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
103
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
104 public String getFunction() {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
105 if (function == null) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
106 function = getString("function");
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
107 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
108 if (log.isDebugEnabled()) {
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
109 log.debug("function: " + function);
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
110 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
111 return function;
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
112 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
113 }
21c1d1d25919 FixA: Moved common parameter access to common base class.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
114 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org