comparison flys-backend/src/main/java/de/intevation/flys/model/Gauge.java @ 1233:5a3109b8475f

Mapping and Accessors for MainValues of Gauge, by Sascha L. Teichmann. flys-backend/trunk@2572 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Felix Wolfsteller <felix.wolfsteller@intevation.de>
date Thu, 25 Aug 2011 10:19:21 +0000
parents 46bb2b9e0bdc
children fe89d6cf55fb
comparison
equal deleted inserted replaced
1232:3383e042a655 1233:5a3109b8475f
19 19
20 import org.hibernate.Session; 20 import org.hibernate.Session;
21 import org.hibernate.Query; 21 import org.hibernate.Query;
22 22
23 import de.intevation.flys.backend.SessionHolder; 23 import de.intevation.flys.backend.SessionHolder;
24 24 import de.intevation.flys.model.MainValue;
25 25
26 @Entity 26 @Entity
27 @Table(name = "gauges") 27 @Table(name = "gauges")
28 public class Gauge 28 public class Gauge
29 implements Serializable 29 implements Serializable
37 private BigDecimal aeo; 37 private BigDecimal aeo;
38 private BigDecimal datum; 38 private BigDecimal datum;
39 private Range range; 39 private Range range;
40 40
41 private List<DischargeTable> dischargeTables; 41 private List<DischargeTable> dischargeTables;
42
43 /** MainValues at this Gauge. */
44 protected List<MainValue> mainValues;
42 45
43 public Gauge() { 46 public Gauge() {
44 } 47 }
45 48
46 public Gauge( 49 public Gauge(
154 157
155 158
156 /** 159 /**
157 * Returns min and max W values of this gauge. 160 * Returns min and max W values of this gauge.
158 * 161 *
159 * @return the min and max W value of this gauge [min,max]. 162 * @return the min and max W value of this gauge [min,max].
160 */ 163 */
161 public double[] determineMinMaxW(int scale) { 164 public double[] determineMinMaxW(int scale) {
162 Session session = SessionHolder.HOLDER.get(); 165 Session session = SessionHolder.HOLDER.get();
163 166
164 List<DischargeTable> tables = getDischargeTables(); 167 List<DischargeTable> tables = getDischargeTables();
187 ? new double[] { 190 ? new double[] {
188 ((BigDecimal) result[0]).doubleValue() * scale, 191 ((BigDecimal) result[0]).doubleValue() * scale,
189 ((BigDecimal) result[1]).doubleValue() * scale} 192 ((BigDecimal) result[1]).doubleValue() * scale}
190 : null; 193 : null;
191 } 194 }
195
196 @OneToMany
197 @JoinColumn(name = "gauge_id")
198 public List<MainValue> getMainValues() {
199 return mainValues;
200 }
201
202 public void setMainValues(List<MainValue> mainValues) {
203 this.mainValues = mainValues;
204 }
192 } 205 }
193 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 206 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org