Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/BedHeightValue.java @ 8559:6d8d7425a6b5
Bed heights are just bed heights since a while ('single' is obsolete).
author | "Tom Gottfried <tom@intevation.de>" |
---|---|
date | Mon, 16 Feb 2015 11:08:33 +0100 |
parents | backend/src/main/java/org/dive4elements/river/model/BedHeightSingleValue.java@3a0522f1a532 |
children | 1083cb887ffb |
comparison
equal
deleted
inserted
replaced
8558:d0ea092a32f5 | 8559:6d8d7425a6b5 |
---|---|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde | |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU AGPL (>=v3) | |
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the | |
6 * documentation coming with Dive4Elements River for details. | |
7 */ | |
8 | |
9 package org.dive4elements.river.model; | |
10 | |
11 import java.util.List; | |
12 | |
13 import java.io.Serializable; | |
14 | |
15 import javax.persistence.Entity; | |
16 import javax.persistence.Id; | |
17 import javax.persistence.Table; | |
18 import javax.persistence.GeneratedValue; | |
19 import javax.persistence.Column; | |
20 import javax.persistence.SequenceGenerator; | |
21 import javax.persistence.GenerationType; | |
22 import javax.persistence.JoinColumn; | |
23 import javax.persistence.OneToOne; | |
24 | |
25 import org.apache.log4j.Logger; | |
26 | |
27 import org.hibernate.Session; | |
28 import org.hibernate.Query; | |
29 | |
30 import org.dive4elements.river.backend.SessionHolder; | |
31 | |
32 | |
33 @Entity | |
34 @Table(name = "bed_height_values") | |
35 public class BedHeightValue | |
36 implements Serializable | |
37 { | |
38 private static Logger log = | |
39 Logger.getLogger(BedHeightValue.class); | |
40 | |
41 private Integer id; | |
42 | |
43 private BedHeight bedHeight; | |
44 | |
45 private Double station; | |
46 private Double height; | |
47 private Double uncertainty; | |
48 private Double dataGap; | |
49 private Double soundingWidth; | |
50 | |
51 | |
52 public BedHeightValue() { | |
53 } | |
54 | |
55 public BedHeightValue( | |
56 BedHeight bedHeight, | |
57 Double station, | |
58 Double height, | |
59 Double uncertainty, | |
60 Double dataGap, | |
61 Double soundingWidth | |
62 ) { | |
63 this.bedHeight = bedHeight; | |
64 this.station = station; | |
65 this.height = height; | |
66 this.uncertainty = uncertainty; | |
67 this.dataGap = dataGap; | |
68 this.soundingWidth = soundingWidth; | |
69 } | |
70 | |
71 @Id | |
72 @SequenceGenerator( | |
73 name = "SEQUENCE_BED_HEIGHT_VALUE_ID_SEQ", | |
74 sequenceName = "BED_HEIGHT_VALUES_ID_SEQ", | |
75 allocationSize = 1) | |
76 @GeneratedValue( | |
77 strategy = GenerationType.SEQUENCE, | |
78 generator = "SEQUENCE_BED_HEIGHT_VALUE_ID_SEQ") | |
79 @Column(name = "id") | |
80 public Integer getId() { | |
81 return id; | |
82 } | |
83 | |
84 public void setId(Integer id) { | |
85 this.id = id; | |
86 } | |
87 | |
88 @OneToOne | |
89 @JoinColumn(name = "bed_height_id" ) | |
90 public BedHeight getBedHeight() { | |
91 return bedHeight; | |
92 } | |
93 | |
94 public void setBedHeight(BedHeight bedHeight) { | |
95 this.bedHeight = bedHeight; | |
96 } | |
97 | |
98 @Column(name = "station") | |
99 public Double getStation() { | |
100 return station; | |
101 } | |
102 | |
103 public void setStation(Double station) { | |
104 this.station = station; | |
105 } | |
106 | |
107 @Column(name = "height") | |
108 public Double getHeight() { | |
109 return height; | |
110 } | |
111 | |
112 public void setHeight(Double height) { | |
113 this.height = height; | |
114 } | |
115 | |
116 @Column(name="uncertainty") | |
117 public Double getUncertainty() { | |
118 return uncertainty; | |
119 } | |
120 | |
121 public void setUncertainty(Double uncertainty) { | |
122 this.uncertainty = uncertainty; | |
123 } | |
124 | |
125 @Column(name="data_gap") | |
126 public Double getDataGap() { | |
127 return dataGap; | |
128 } | |
129 | |
130 public void setDataGap(Double dataGap) { | |
131 this.dataGap = dataGap; | |
132 } | |
133 | |
134 @Column(name="sounding_width") | |
135 public Double getSoundingWidth() { | |
136 return soundingWidth; | |
137 } | |
138 | |
139 public void setSoundingWidth(Double soundingWidth) { | |
140 this.soundingWidth = soundingWidth; | |
141 } | |
142 | |
143 | |
144 public static List<BedHeightValue> getBedHeightValues( | |
145 BedHeight single, | |
146 double kmLo, | |
147 double kmHi | |
148 ) { | |
149 Session session = SessionHolder.HOLDER.get(); | |
150 | |
151 Query query = session.createQuery( | |
152 "from BedHeightValue where bedHeight=:single " + | |
153 " and station >= :kmLo and station <= :kmHi"); | |
154 | |
155 query.setParameter("single", single); | |
156 query.setParameter("kmLo", new Double(kmLo)); | |
157 query.setParameter("kmHi", new Double(kmHi)); | |
158 | |
159 return query.list(); | |
160 } | |
161 } | |
162 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |