Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/HWSLine.java @ 5379:61bf64b102bc mapgenfix
Merge with default branch
author | Christian Lins <christian.lins@intevation.de> |
---|---|
date | Fri, 22 Mar 2013 11:25:54 +0100 |
parents | 0a83a796f7cf |
children |
comparison
equal
deleted
inserted
replaced
5175:cfc5540a4eec | 5379:61bf64b102bc |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import com.vividsolutions.jts.geom.Geometry; | |
4 | |
5 import de.intevation.flys.model.HWSKind; | |
6 | |
7 import java.io.Serializable; | |
8 import java.util.List; | |
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.Session; | |
21 import org.hibernate.Query; | |
22 import org.hibernate.annotations.Type; | |
23 | |
24 import de.intevation.flys.backend.SessionHolder; | |
25 | |
26 @Entity | |
27 @Table(name = "hws_lines") | |
28 public class HWSLine 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 status_date; | |
44 private String description; | |
45 private Geometry geom; | |
46 | |
47 @Id | |
48 @SequenceGenerator( | |
49 name = "SEQUENCE_HWS_LINES_ID_SEQ", | |
50 sequenceName = "HWS_LINES_ID_SEQ", | |
51 allocationSize = 1) | |
52 @GeneratedValue( | |
53 strategy = GenerationType.SEQUENCE, | |
54 generator = "SEQUENCE_HWS_LINES_ID_SEQ") | |
55 @Column(name = "id") | |
56 public Integer getId() { | |
57 return id; | |
58 } | |
59 | |
60 public void setId(Integer id) { | |
61 this.id = id; | |
62 } | |
63 | |
64 @Column(name = "geom") | |
65 @Type(type = "org.hibernatespatial.GeometryUserType") | |
66 public Geometry getGeom() { | |
67 return geom; | |
68 } | |
69 | |
70 | |
71 public void setGeom(Geometry geom) { | |
72 this.geom = geom; | |
73 } | |
74 | |
75 /** | |
76 * Get ogrFid. | |
77 * | |
78 * @return ogrFid as Integer. | |
79 */ | |
80 @Column(name = "ogr_fid") | |
81 public Integer getOgrFid() { | |
82 return ogrFid; | |
83 } | |
84 | |
85 /** | |
86 * Set ogrFid. | |
87 * | |
88 * @param ogrFid the value to set. | |
89 */ | |
90 public void setOgrFid(Integer ogrFid) { | |
91 this.ogrFid = ogrFid; | |
92 } | |
93 | |
94 | |
95 /** | |
96 * Get official. | |
97 * | |
98 * @return official as Integer. | |
99 */ | |
100 @Column(name = "official") | |
101 public Integer getofficial() { | |
102 return official; | |
103 } | |
104 | |
105 /** | |
106 * Set official. | |
107 * | |
108 * @param official the value to set. | |
109 */ | |
110 public void setofficial(Integer official) { | |
111 this.official = official; | |
112 } | |
113 | |
114 /** | |
115 * Get shoreSide. | |
116 * | |
117 * @return shoreSide as Integer. | |
118 */ | |
119 @Column(name = "shore_side") | |
120 public Integer getShoreSide() { | |
121 return shoreSide; | |
122 } | |
123 | |
124 /** | |
125 * Set shoreSide. | |
126 * | |
127 * @param shoreSide the value to set. | |
128 */ | |
129 public void setShoreSide(Integer shoreSide) { | |
130 this.shoreSide = shoreSide; | |
131 } | |
132 | |
133 /** | |
134 * Get name. | |
135 * | |
136 * @return name as String. | |
137 */ | |
138 @Column(name = "name") | |
139 public String getName() { | |
140 return name; | |
141 } | |
142 | |
143 /** | |
144 * Set name. | |
145 * | |
146 * @param name the value to set. | |
147 */ | |
148 public void setName(String name) { | |
149 this.name = name; | |
150 } | |
151 | |
152 /** | |
153 * Get path. | |
154 * | |
155 * @return path as String. | |
156 */ | |
157 @Column(name = "path") | |
158 public String getPath() { | |
159 return path; | |
160 } | |
161 | |
162 /** | |
163 * Set path. | |
164 * | |
165 * @param path the value to set. | |
166 */ | |
167 public void setPath(String path) { | |
168 this.path = path; | |
169 } | |
170 | |
171 /** | |
172 * Get agency. | |
173 * | |
174 * @return agency as String. | |
175 */ | |
176 @Column(name = "agency") | |
177 public String getAgency() { | |
178 return agency; | |
179 } | |
180 | |
181 /** | |
182 * Set agency. | |
183 * | |
184 * @param agency the value to set. | |
185 */ | |
186 public void setAgency(String agency) { | |
187 this.agency = agency; | |
188 } | |
189 | |
190 /** | |
191 * Get range. | |
192 * | |
193 * @return range as String. | |
194 */ | |
195 @Column(name = "range") | |
196 public String getRange() { | |
197 return range; | |
198 } | |
199 | |
200 /** | |
201 * Set range. | |
202 * | |
203 * @param range the value to set. | |
204 */ | |
205 public void setRange(String range) { | |
206 this.range = range; | |
207 } | |
208 | |
209 /** | |
210 * Get source. | |
211 * | |
212 * @return source as String. | |
213 */ | |
214 @Column(name = "source") | |
215 public String getSource() { | |
216 return source; | |
217 } | |
218 | |
219 /** | |
220 * Set source. | |
221 * | |
222 * @param source the value to set. | |
223 */ | |
224 public void setSource(String source) { | |
225 this.source = source; | |
226 } | |
227 | |
228 /** | |
229 * Get status_date. | |
230 * | |
231 * @return status_date as String. | |
232 */ | |
233 @Column(name = "status_date") | |
234 public String getStatusDate() { | |
235 return status_date; | |
236 } | |
237 | |
238 /** | |
239 * Set status_date. | |
240 * | |
241 * @param status_date the value to set. | |
242 */ | |
243 public void setStatusDate(String status_date) { | |
244 this.status_date = status_date; | |
245 } | |
246 | |
247 /** | |
248 * Get description. | |
249 * | |
250 * @return description as String. | |
251 */ | |
252 @Column(name = "description") | |
253 public String getDescription() { | |
254 return description; | |
255 } | |
256 | |
257 /** | |
258 * Set description. | |
259 * | |
260 * @param description the value to set. | |
261 */ | |
262 public void setDescription(String description) { | |
263 this.description = description; | |
264 } | |
265 | |
266 /** | |
267 * Get kind. | |
268 * | |
269 * @return kind as HWSKind. | |
270 */ | |
271 @OneToOne | |
272 @JoinColumn(name = "kind_id") | |
273 public HWSKind getKind() { | |
274 return kind; | |
275 } | |
276 | |
277 /** | |
278 * Set kind. | |
279 * | |
280 * @param kind the value to set. | |
281 */ | |
282 public void setKind(HWSKind kind) { | |
283 this.kind = kind; | |
284 } | |
285 | |
286 /** | |
287 * Get fedState. | |
288 * | |
289 * @return fedState as FedState. | |
290 */ | |
291 @OneToOne | |
292 @JoinColumn(name = "fed_state_id") | |
293 public FedState getFedState() { | |
294 return fedState; | |
295 } | |
296 | |
297 /** | |
298 * Set fedState. | |
299 * | |
300 * @param fedState the value to set. | |
301 */ | |
302 public void setFedState(FedState fedState) { | |
303 this.fedState = fedState; | |
304 } | |
305 | |
306 /** | |
307 * Get river. | |
308 * | |
309 * @return river as River. | |
310 */ | |
311 @OneToOne | |
312 @JoinColumn(name = "river_id") | |
313 public River getRiver() { | |
314 return river; | |
315 } | |
316 | |
317 /** | |
318 * Set river. | |
319 * | |
320 * @param river the value to set. | |
321 */ | |
322 public void setRiver(River river) { | |
323 this.river = river; | |
324 } | |
325 | |
326 public static List<HWSLine> getLines(int riverId, String name) { | |
327 Session session = SessionHolder.HOLDER.get(); | |
328 | |
329 Query query = session.createQuery( | |
330 "from HWSLine where river.id =:river_id and name=:name"); | |
331 query.setParameter("river_id", riverId); | |
332 query.setParameter("name", name); | |
333 | |
334 return query.list(); | |
335 } | |
336 } |