Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/model/BedHeightSingleValue.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/BedHeightSingleValue.java@18619c1e7c2a |
children | 4dd33b86dc61 |
comparison
equal
deleted
inserted
replaced
5837:d9901a08d0a6 | 5838:5aa05a7a34b7 |
---|---|
1 package org.dive4elements.river.model; | |
2 | |
3 import java.util.List; | |
4 | |
5 import java.io.Serializable; | |
6 import java.math.BigDecimal; | |
7 | |
8 import javax.persistence.Entity; | |
9 import javax.persistence.Id; | |
10 import javax.persistence.Table; | |
11 import javax.persistence.GeneratedValue; | |
12 import javax.persistence.Column; | |
13 import javax.persistence.SequenceGenerator; | |
14 import javax.persistence.GenerationType; | |
15 import javax.persistence.JoinColumn; | |
16 import javax.persistence.OneToOne; | |
17 | |
18 import org.apache.log4j.Logger; | |
19 | |
20 import org.hibernate.Session; | |
21 import org.hibernate.Query; | |
22 | |
23 import org.dive4elements.river.backend.SessionHolder; | |
24 | |
25 | |
26 @Entity | |
27 @Table(name = "bed_height_single_values") | |
28 public class BedHeightSingleValue | |
29 implements Serializable | |
30 { | |
31 private static Logger logger = | |
32 Logger.getLogger(BedHeightSingleValue.class); | |
33 | |
34 private Integer id; | |
35 | |
36 private BedHeightSingle bedHeight; | |
37 | |
38 private BigDecimal station; | |
39 private BigDecimal height; | |
40 private BigDecimal uncertainty; | |
41 private BigDecimal dataGap; | |
42 private BigDecimal soundingWidth; | |
43 private BigDecimal width; | |
44 | |
45 | |
46 public BedHeightSingleValue() { | |
47 } | |
48 | |
49 public BedHeightSingleValue( | |
50 BedHeightSingle bedHeight, | |
51 BigDecimal station, | |
52 BigDecimal height, | |
53 BigDecimal uncertainty, | |
54 BigDecimal dataGap, | |
55 BigDecimal soundingWidth, | |
56 BigDecimal width | |
57 ) { | |
58 this.bedHeight = bedHeight; | |
59 this.station = station; | |
60 this.height = height; | |
61 this.uncertainty = uncertainty; | |
62 this.dataGap = dataGap; | |
63 this.soundingWidth = soundingWidth; | |
64 this.width = width; | |
65 } | |
66 | |
67 @Id | |
68 @SequenceGenerator( | |
69 name = "SEQUENCE_BED_SINGLE_VALUE_ID_SEQ", | |
70 sequenceName = "BED_SINGLE_VALUES_ID_SEQ", | |
71 allocationSize = 1) | |
72 @GeneratedValue( | |
73 strategy = GenerationType.SEQUENCE, | |
74 generator = "SEQUENCE_BED_SINGLE_VALUE_ID_SEQ") | |
75 @Column(name = "id") | |
76 public Integer getId() { | |
77 return id; | |
78 } | |
79 | |
80 public void setId(Integer id) { | |
81 this.id = id; | |
82 } | |
83 | |
84 @OneToOne | |
85 @JoinColumn(name = "bed_height_single_id" ) | |
86 public BedHeightSingle getBedHeight() { | |
87 return bedHeight; | |
88 } | |
89 | |
90 public void setBedHeight(BedHeightSingle bedHeight) { | |
91 this.bedHeight = bedHeight; | |
92 } | |
93 | |
94 @Column(name = "station") | |
95 public BigDecimal getStation() { | |
96 return station; | |
97 } | |
98 | |
99 public void setStation(BigDecimal station) { | |
100 this.station = station; | |
101 } | |
102 | |
103 @Column(name = "height") | |
104 public BigDecimal getHeight() { | |
105 return height; | |
106 } | |
107 | |
108 public void setHeight(BigDecimal height) { | |
109 this.height = height; | |
110 } | |
111 | |
112 @Column(name="uncertainty") | |
113 public BigDecimal getUncertainty() { | |
114 return uncertainty; | |
115 } | |
116 | |
117 public void setUncertainty(BigDecimal uncertainty) { | |
118 this.uncertainty = uncertainty; | |
119 } | |
120 | |
121 @Column(name="data_gap") | |
122 public BigDecimal getDataGap() { | |
123 return dataGap; | |
124 } | |
125 | |
126 public void setDataGap(BigDecimal dataGap) { | |
127 this.dataGap = dataGap; | |
128 } | |
129 | |
130 @Column(name="sounding_width") | |
131 public BigDecimal getSoundingWidth() { | |
132 return soundingWidth; | |
133 } | |
134 | |
135 public void setSoundingWidth(BigDecimal soundingWidth) { | |
136 this.soundingWidth = soundingWidth; | |
137 } | |
138 | |
139 @Column(name="width") | |
140 public BigDecimal getWidth() { | |
141 return width; | |
142 } | |
143 | |
144 public void setWidth(BigDecimal width) { | |
145 this.width = width; | |
146 } | |
147 | |
148 | |
149 public static List<BedHeightSingleValue> getBedHeightSingleValues( | |
150 BedHeightSingle single, | |
151 double kmLo, | |
152 double kmHi | |
153 ) { | |
154 Session session = SessionHolder.HOLDER.get(); | |
155 | |
156 Query query = session.createQuery( | |
157 "from BedHeightSingleValue where bedHeight=:single " + | |
158 " and station >= :kmLo and station <= :kmHi"); | |
159 | |
160 query.setParameter("single", single); | |
161 query.setParameter("kmLo", new BigDecimal(kmLo)); | |
162 query.setParameter("kmHi", new BigDecimal(kmHi)); | |
163 | |
164 return query.list(); | |
165 } | |
166 } | |
167 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |