Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/HWSPoint.java @ 5838:5aa05a7a34b7
Rename modules to more fitting names.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 15:23:37 +0200 |
parents | flys-backend/src/main/java/org/dive4elements/river/model/HWSPoint.java@18619c1e7c2a |
children | 4dd33b86dc61 |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.model; | |
2 | |
3 import com.vividsolutions.jts.geom.Geometry; | |
4 | |
5 import java.io.Serializable; | |
6 import java.util.List; | |
7 | |
8 import java.math.BigDecimal; | |
9 | |
10 import javax.persistence.Column; | |
11 import javax.persistence.Entity; | |
12 import javax.persistence.GeneratedValue; | |
13 import javax.persistence.GenerationType; | |
14 import javax.persistence.Id; | |
15 import javax.persistence.JoinColumn; | |
16 import javax.persistence.OneToOne; | |
17 import javax.persistence.Table; | |
18 import javax.persistence.SequenceGenerator; | |
19 | |
20 import org.hibernate.annotations.Type; | |
21 import org.hibernate.Session; | |
22 import org.hibernate.Query; | |
23 | |
24 import org.dive4elements.river.backend.SessionHolder; | |
25 | |
26 @Entity | |
27 @Table(name = "hws_points") | |
28 public class HWSPoint implements Serializable { | |
29 | |
30 private Integer id; | |
31 | |
32 private Integer ogrFid; | |
33 private HWSKind kind; | |
34 private FedState fedState; | |
35 private River river; | |
36 private Integer official; | |
37 private Integer shoreSide; | |
38 private String name; | |
39 private String path; | |
40 private String agency; | |
41 private String range; | |
42 private String source; | |
43 private String statusDate; | |
44 private String description; | |
45 private BigDecimal freeboard; | |
46 private BigDecimal dikeKm; | |
47 private BigDecimal z; | |
48 private BigDecimal zTarget; | |
49 private BigDecimal ratedLevel; | |
50 private Geometry geom; | |
51 | |
52 @Id | |
53 @SequenceGenerator( | |
54 name = "SEQUENCE_HWS_POINTS_ID_SEQ", | |
55 sequenceName = "HWS_POINTS_ID_SEQ", | |
56 allocationSize = 1) | |
57 @GeneratedValue( | |
58 strategy = GenerationType.SEQUENCE, | |
59 generator = "SEQUENCE_HWS_POINTS_ID_SEQ") | |
60 @Column(name = "id") | |
61 public Integer getId() { | |
62 return id; | |
63 } | |
64 | |
65 public void setId(Integer id) { | |
66 this.id = id; | |
67 } | |
68 | |
69 | |
70 @Column(name = "geom") | |
71 @Type(type = "org.hibernatespatial.GeometryUserType") | |
72 public Geometry getGeom() { | |
73 return geom; | |
74 } | |
75 | |
76 | |
77 public void setGeom(Geometry geom) { | |
78 this.geom = geom; | |
79 } | |
80 | |
81 /** | |
82 * Get ogrFid. | |
83 * | |
84 * @return ogrFid as Integer. | |
85 */ | |
86 @Column(name = "ogr_fid") | |
87 public Integer getOgrFid() { | |
88 return ogrFid; | |
89 } | |
90 | |
91 /** | |
92 * Set ogrFid. | |
93 * | |
94 * @param ogrFid the value to set. | |
95 */ | |
96 public void setOgrFid(Integer ogrFid) { | |
97 this.ogrFid = ogrFid; | |
98 } | |
99 | |
100 | |
101 /** | |
102 * Get official. | |
103 * | |
104 * @return official as Integer. | |
105 */ | |
106 @Column(name = "official") | |
107 public Integer getofficial() { | |
108 return official; | |
109 } | |
110 | |
111 /** | |
112 * Set official. | |
113 * | |
114 * @param official the value to set. | |
115 */ | |
116 public void setofficial(Integer official) { | |
117 this.official = official; | |
118 } | |
119 | |
120 /** | |
121 * Get shoreSide. | |
122 * | |
123 * @return shoreSide as Integer. | |
124 */ | |
125 @Column(name = "shore_side") | |
126 public Integer getShoreSide() { | |
127 return shoreSide; | |
128 } | |
129 | |
130 /** | |
131 * Set shoreSide. | |
132 * | |
133 * @param shoreSide the value to set. | |
134 */ | |
135 public void setShoreSide(Integer shoreSide) { | |
136 this.shoreSide = shoreSide; | |
137 } | |
138 | |
139 /** | |
140 * Get name. | |
141 * | |
142 * @return name as String. | |
143 */ | |
144 @Column(name = "name") | |
145 public String getName() { | |
146 return name; | |
147 } | |
148 | |
149 /** | |
150 * Set name. | |
151 * | |
152 * @param name the value to set. | |
153 */ | |
154 public void setName(String name) { | |
155 this.name = name; | |
156 } | |
157 | |
158 /** | |
159 * Get path. | |
160 * | |
161 * @return path as String. | |
162 */ | |
163 @Column(name = "path") | |
164 public String getPath() { | |
165 return path; | |
166 } | |
167 | |
168 /** | |
169 * Set path. | |
170 * | |
171 * @param path the value to set. | |
172 */ | |
173 public void setPath(String path) { | |
174 this.path = path; | |
175 } | |
176 | |
177 /** | |
178 * Get agency. | |
179 * | |
180 * @return agency as String. | |
181 */ | |
182 @Column(name = "agency") | |
183 public String getAgency() { | |
184 return agency; | |
185 } | |
186 | |
187 /** | |
188 * Set agency. | |
189 * | |
190 * @param agency the value to set. | |
191 */ | |
192 public void setAgency(String agency) { | |
193 this.agency = agency; | |
194 } | |
195 | |
196 /** | |
197 * Get range. | |
198 * | |
199 * @return range as String. | |
200 */ | |
201 @Column(name = "range") | |
202 public String getRange() { | |
203 return range; | |
204 } | |
205 | |
206 /** | |
207 * Set range. | |
208 * | |
209 * @param range the value to set. | |
210 */ | |
211 public void setRange(String range) { | |
212 this.range = range; | |
213 } | |
214 | |
215 /** | |
216 * Get source. | |
217 * | |
218 * @return source as String. | |
219 */ | |
220 @Column(name = "source") | |
221 public String getSource() { | |
222 return source; | |
223 } | |
224 | |
225 /** | |
226 * Set source. | |
227 * | |
228 * @param source the value to set. | |
229 */ | |
230 public void setSource(String source) { | |
231 this.source = source; | |
232 } | |
233 | |
234 /** | |
235 * Get statusDate. | |
236 * | |
237 * @return statusDate as String. | |
238 */ | |
239 @Column(name = "status_date") | |
240 public String getStatusDate() { | |
241 return statusDate; | |
242 } | |
243 | |
244 /** | |
245 * Set statusDate. | |
246 * | |
247 * @param statusDate the value to set. | |
248 */ | |
249 public void setStatusDate(String statusDate) | |
250 { | |
251 this.statusDate = statusDate; | |
252 } | |
253 | |
254 /** | |
255 * Get description. | |
256 * | |
257 * @return description as String. | |
258 */ | |
259 @Column(name = "description") | |
260 public String getDescription() | |
261 { | |
262 return description; | |
263 } | |
264 | |
265 /** | |
266 * Set description. | |
267 * | |
268 * @param description the value to set. | |
269 */ | |
270 public void setDescription(String description) | |
271 { | |
272 this.description = description; | |
273 } | |
274 | |
275 /** | |
276 * Get freeboard. | |
277 * | |
278 * @return freeboard as BigDecimal. | |
279 */ | |
280 @Column(name = "freeboard") | |
281 public BigDecimal getFreeboard() | |
282 { | |
283 return freeboard; | |
284 } | |
285 | |
286 /** | |
287 * Set freeboard. | |
288 * | |
289 * @param freeboard the value to set. | |
290 */ | |
291 public void setFreeboard(BigDecimal freeboard) | |
292 { | |
293 this.freeboard = freeboard; | |
294 } | |
295 | |
296 /** | |
297 * Get dikeKm. | |
298 * | |
299 * @return dikeKm as BigDecimal. | |
300 */ | |
301 @Column(name = "dike_km") | |
302 public BigDecimal getDikeKm() | |
303 { | |
304 return dikeKm; | |
305 } | |
306 | |
307 /** | |
308 * Set dikeKm. | |
309 * | |
310 * @param dikeKm the value to set. | |
311 */ | |
312 public void setDikeKm(BigDecimal dikeKm) | |
313 { | |
314 this.dikeKm = dikeKm; | |
315 } | |
316 | |
317 /** | |
318 * Get z. | |
319 * | |
320 * @return z as BigDecimal. | |
321 */ | |
322 @Column(name = "z") | |
323 public BigDecimal getZ() | |
324 { | |
325 return z; | |
326 } | |
327 | |
328 /** | |
329 * Set z. | |
330 * | |
331 * @param z the value to set. | |
332 */ | |
333 public void setZ(BigDecimal z) | |
334 { | |
335 this.z = z; | |
336 } | |
337 | |
338 /** | |
339 * Get zTarget. | |
340 * | |
341 * @return zTarget as BigDecimal. | |
342 */ | |
343 @Column(name = "z_target") | |
344 public BigDecimal getZTarget() | |
345 { | |
346 return zTarget; | |
347 } | |
348 | |
349 /** | |
350 * Set zTarget. | |
351 * | |
352 * @param zTarget the value to set. | |
353 */ | |
354 public void setZTarget(BigDecimal zTarget) | |
355 { | |
356 this.zTarget = zTarget; | |
357 } | |
358 | |
359 /** | |
360 * Get ratedLevel. | |
361 * | |
362 * @return ratedLevel as BigDecimal. | |
363 */ | |
364 @Column(name = "rated_level") | |
365 public BigDecimal getRatedLevel() | |
366 { | |
367 return ratedLevel; | |
368 } | |
369 | |
370 /** | |
371 * Set ratedLevel. | |
372 * | |
373 * @param ratedLevel the value to set. | |
374 */ | |
375 public void setRatedLevel(BigDecimal ratedLevel) | |
376 { | |
377 this.ratedLevel = ratedLevel; | |
378 } | |
379 | |
380 /** | |
381 * Get kind. | |
382 * | |
383 * @return kind as HWSKind. | |
384 */ | |
385 @OneToOne | |
386 @JoinColumn(name = "kind_id") | |
387 public HWSKind getKind() | |
388 { | |
389 return kind; | |
390 } | |
391 | |
392 /** | |
393 * Set kind. | |
394 * | |
395 * @param kind the value to set. | |
396 */ | |
397 public void setKind(HWSKind kind) | |
398 { | |
399 this.kind = kind; | |
400 } | |
401 | |
402 /** | |
403 * Get fedState. | |
404 * | |
405 * @return fedState as FedState. | |
406 */ | |
407 @OneToOne | |
408 @JoinColumn(name = "fed_state_id") | |
409 public FedState getFedState() | |
410 { | |
411 return fedState; | |
412 } | |
413 | |
414 /** | |
415 * Set fedState. | |
416 * | |
417 * @param fedState the value to set. | |
418 */ | |
419 public void setFedState(FedState fedState) | |
420 { | |
421 this.fedState = fedState; | |
422 } | |
423 | |
424 /** | |
425 * Get river. | |
426 * | |
427 * @return river as River. | |
428 */ | |
429 @OneToOne | |
430 @JoinColumn(name = "river_id") | |
431 public River getRiver() | |
432 { | |
433 return river; | |
434 } | |
435 | |
436 /** | |
437 * Set river. | |
438 * | |
439 * @param river the value to set. | |
440 */ | |
441 public void setRiver(River river) | |
442 { | |
443 this.river = river; | |
444 } | |
445 | |
446 public static List<HWSPoint> getPoints(int riverId, String name) { | |
447 Session session = SessionHolder.HOLDER.get(); | |
448 | |
449 Query query = session.createQuery( | |
450 "from HWSPoint where river.id =:river_id and name=:name"); | |
451 query.setParameter("river_id", riverId); | |
452 query.setParameter("name", name); | |
453 | |
454 return query.list(); | |
455 } | |
456 } | |
457 |