Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/CrossSection.java @ 2346:f834b411ca57
Added db table, model class and importer stuff for units.
flys-backend/trunk@2877 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 04 Oct 2011 06:47:00 +0000 |
parents | 31d8638760b1 |
children | 8be27b950dbe |
rev | line source |
---|---|
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.model; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
2 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
4 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
6 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
7 import javax.persistence.Entity; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
8 import javax.persistence.Id; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
9 import javax.persistence.Table; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 import javax.persistence.GeneratedValue; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import javax.persistence.Column; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
12 import javax.persistence.SequenceGenerator; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
13 import javax.persistence.GenerationType; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 import javax.persistence.OneToOne; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 import javax.persistence.OneToMany; |
1210
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1204
diff
changeset
|
16 import javax.persistence.OrderBy; |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
17 import javax.persistence.JoinColumn; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
18 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
19 @Entity |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
20 @Table(name = "cross_sections") |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
21 public class CrossSection |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
22 implements Serializable |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
23 { |
1203
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
24 private Integer id; |
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
25 private River river; |
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
26 private TimeInterval timeInterval; |
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
27 private String description; |
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
28 private List<CrossSectionLine> lines; |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
30 public CrossSection() { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
1204
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
33 public CrossSection( |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
34 River river, |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
35 TimeInterval timeInterval, |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
36 String description |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
37 ) { |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
38 this.river = river; |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
39 this.timeInterval = timeInterval; |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
40 this.description = description; |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
41 } |
22858e7cca79
Integrated PRF parsing into importer. Needs testing!
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1203
diff
changeset
|
42 |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 @Id |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 @SequenceGenerator( |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 name = "SEQUENCE_CROSS_SECTIONS_ID_SEQ", |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 sequenceName = "CROSS_SECTIONS_ID_SEQ", |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 allocationSize = 1) |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 @GeneratedValue( |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 strategy = GenerationType.SEQUENCE, |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 generator = "SEQUENCE_CROSS_SECTIONS_ID_SEQ") |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 @Column(name = "id") |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
52 public Integer getId() { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
53 return id; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
54 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
55 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
56 public void setId(Integer id) { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
57 this.id = id; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
58 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
59 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
60 @OneToOne |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
61 @JoinColumn(name = "river_id") |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
62 public River getRiver() { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
63 return river; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
64 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
65 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
66 public void setRiver(River river) { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
67 this.river = river; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
68 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
69 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
70 @OneToOne |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
71 @JoinColumn(name = "time_interval_id") |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
72 public TimeInterval getTimeInterval() { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
73 return timeInterval; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
74 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
75 |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
76 public void setTimeInterval(TimeInterval timeInterval) { |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 this.timeInterval = timeInterval; |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
1202
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
80 @Column(name = "description") |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
81 public String getDescription() { |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
82 return description; |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
83 } |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
84 |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
85 public void setDescription(String description) { |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
86 this.description = description; |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
87 } |
44581b40b968
Schema: Added description column to the cross section table
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1194
diff
changeset
|
88 |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
89 @OneToMany |
1210
31d8638760b1
New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1204
diff
changeset
|
90 @OrderBy("km") |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
91 @JoinColumn(name="cross_section_id") |
1203
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
92 public List<CrossSectionLine> getLines() { |
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
93 return lines; |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
94 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
95 |
1203
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
96 public void setLines(List<CrossSectionLine> lines) { |
3c01bef43a98
Querprofile: Added a table to map the points to a given km.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
1202
diff
changeset
|
97 this.lines = lines; |
1194
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
98 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
99 } |
491892931761
Added Hibernate models for cross-sections and their points.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |