comparison flys-artifacts/src/main/java/de/intevation/flys/artifacts/FixationArtifactAccess.java @ 3121:0b86b005bb9a

FixA: Respect the selected events and reference period correctly. flys-artifacts/trunk@4722 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Wed, 20 Jun 2012 11:25:21 +0000
parents 0b5a7a2c3724
children
comparison
equal deleted inserted replaced
3120:e52a3b62fc20 3121:0b86b005bb9a
32 protected Long end; 32 protected Long end;
33 33
34 protected Integer qSectorStart; 34 protected Integer qSectorStart;
35 protected Integer qSectorEnd; 35 protected Integer qSectorEnd;
36 36
37 protected Long referenceStart; 37 protected DateRange referencePeriod;
38 protected Long referenceEnd;
39
40 protected DateRange [] analysisPeriods; 38 protected DateRange [] analysisPeriods;
41 39
42 protected int [] events; 40 protected int [] events;
43 41
44 protected Boolean preprocessing; 42 protected Boolean preprocessing;
252 events = FLYSUtils.intArrayFromString((String)sd.getValue()); 250 events = FLYSUtils.intArrayFromString((String)sd.getValue());
253 } 251 }
254 return events; 252 return events;
255 } 253 }
256 254
257 public Long getReferenceStart() { 255 public DateRange getReferencePeriod() {
258 if (referenceStart == null) { 256 if (referencePeriod == null) {
259 StateData sd = artifact.getData("ref_start"); 257 StateData refStart = artifact.getData("ref_start");
260 if (sd == null) { 258 StateData refEnd = artifact.getData("ref_end");
261 log.warn("missing 'ref_start' value"); 259
262 return null; 260 if (refStart == null || refEnd == null) {
263 } 261 log.warn("missing 'ref_start' or 'ref_start' value");
264 try { 262 return null;
265 referenceStart = Long.valueOf((String)sd.getValue()); 263 }
266 } 264
267 catch (NumberFormatException nfe) { 265 try {
268 log.warn("ref_start '" 266 long rs = Long.parseLong((String)refStart.getValue());
269 + sd.getValue() + "' is not an integer."); 267 long re = Long.parseLong((String)refEnd .getValue());
270 } 268
271 } 269 if (rs > re) { long t = rs; rs = re; re = t; }
272 270
273 if (log.isDebugEnabled()) { 271 Date from = new Date(rs);
274 log.debug("referenceStart: '" + referenceStart + "'"); 272 Date to = new Date(re);
275 } 273 referencePeriod = new DateRange(from, to);
276 274 }
277 return referenceStart; 275 catch (NumberFormatException nfe) {
278 } 276 log.warn("ref_start or ref_end is not an integer.");
279 277 }
280 public Long getReferenceEnd() { 278 }
281 if (referenceEnd == null) { 279
282 StateData sd = artifact.getData("ref_end"); 280 return referencePeriod;
283 if (sd == null) {
284 log.warn("missing 'ref_end' value");
285 return null;
286 }
287 try {
288 referenceEnd = Long.valueOf((String)sd.getValue());
289 }
290 catch (NumberFormatException nfe) {
291 log.warn("ref_end '"
292 + sd.getValue() + "' is not an integer.");
293 }
294 }
295
296 if (log.isDebugEnabled()) {
297 log.debug("referenceEnd: '" + referenceEnd + "'");
298 }
299
300 return referenceEnd;
301 } 281 }
302 282
303 public DateRange [] getAnalysisPeriods() { 283 public DateRange [] getAnalysisPeriods() {
304 if (analysisPeriods == null) { 284 if (analysisPeriods == null) {
305 StateData sd = artifact.getData("ana_data"); 285 StateData sd = artifact.getData("ana_data");

http://dive4elements.wald.intevation.org