Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/access/SQRelationAccess.java @ 6859:3ccbc278f2e6
(issue1347) Add SQ Relation fields for measurement station information
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Mon, 19 Aug 2013 11:41:09 +0200 |
parents | af13ceeba52a |
children | a56fe3bc6700 |
comparison
equal
deleted
inserted
replaced
6858:b5e2d18cc341 | 6859:3ccbc278f2e6 |
---|---|
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts.access; | 9 package org.dive4elements.river.artifacts.access; |
10 | 10 |
11 import java.util.Date; | 11 import java.util.Date; |
12 import java.util.List; | |
12 | 13 |
13 import org.apache.log4j.Logger; | 14 import org.apache.log4j.Logger; |
14 | 15 |
15 import org.dive4elements.river.artifacts.D4EArtifact; | 16 import org.dive4elements.river.artifacts.D4EArtifact; |
16 import org.dive4elements.river.artifacts.model.DateRange; | 17 import org.dive4elements.river.artifacts.model.DateRange; |
18 import org.dive4elements.river.model.MeasurementStation; | |
17 | 19 |
18 public class SQRelationAccess | 20 public class SQRelationAccess |
19 extends RiverAccess | 21 extends RiverAccess |
20 { | 22 { |
21 private static Logger log = Logger.getLogger(SQRelationAccess.class); | 23 private static Logger log = Logger.getLogger(SQRelationAccess.class); |
25 protected DateRange period; | 27 protected DateRange period; |
26 | 28 |
27 protected Double outliers; | 29 protected Double outliers; |
28 | 30 |
29 private String method; | 31 private String method; |
32 | |
33 protected MeasurementStation measurementStation; | |
30 | 34 |
31 public SQRelationAccess() { | 35 public SQRelationAccess() { |
32 } | 36 } |
33 | 37 |
34 public SQRelationAccess(D4EArtifact artifact) { | 38 public SQRelationAccess(D4EArtifact artifact) { |
78 if (log.isDebugEnabled()) { | 82 if (log.isDebugEnabled()) { |
79 log.debug("outlier-method: " + method); | 83 log.debug("outlier-method: " + method); |
80 } | 84 } |
81 return method; | 85 return method; |
82 } | 86 } |
87 | |
88 public String getMeasurementStationName() { | |
89 MeasurementStation station = getMeasurementStation(); | |
90 return station == null ? null : station.getName(); | |
91 } | |
92 | |
93 public String getMeasurementStationGaugeName() { | |
94 MeasurementStation station = getMeasurementStation(); | |
95 return station == null ? null : station.getGaugeName(); | |
96 } | |
97 | |
98 public MeasurementStation getMeasurementStation() { | |
99 if (measurementStation != null) { | |
100 return measurementStation; | |
101 } | |
102 List<MeasurementStation> candidates = MeasurementStation.getStationsAtKM( | |
103 getRiver(), getLocation()); | |
104 if (candidates != null) { | |
105 // Just take the first one as we only use the name | |
106 // and that "should" be unique at the location | |
107 measurementStation = candidates.get(0); | |
108 } | |
109 | |
110 return measurementStation; | |
111 } | |
83 } | 112 } |
84 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |