5208
|
1 package de.intevation.flys.model; |
|
2 |
|
3 import java.io.Serializable; |
|
4 import java.util.List; |
|
5 |
|
6 import javax.persistence.Entity; |
|
7 import javax.persistence.Id; |
|
8 import javax.persistence.Table; |
|
9 import javax.persistence.GeneratedValue; |
|
10 import javax.persistence.Column; |
|
11 import javax.persistence.SequenceGenerator; |
|
12 import javax.persistence.GenerationType; |
|
13 import javax.persistence.JoinColumn; |
|
14 import javax.persistence.OneToOne; |
|
15 import javax.persistence.OneToMany; |
|
16 |
|
17 import org.apache.log4j.Logger; |
|
18 |
|
19 |
|
20 |
|
21 /** Mapped Waterlevel. */ |
|
22 @Entity |
|
23 @Table(name = "waterlevel") |
|
24 public class Waterlevel |
|
25 implements Serializable |
|
26 { |
|
27 private static Logger logger = Logger.getLogger(Waterlevel.class); |
|
28 |
|
29 private Integer id; |
|
30 |
|
31 private River river; |
|
32 |
|
33 private Unit unit; |
|
34 |
|
35 private String description; |
|
36 |
|
37 private List<WaterlevelQRange> qRanges; |
|
38 |
|
39 |
|
40 public Waterlevel() { |
|
41 } |
|
42 |
|
43 public Waterlevel(River river, Unit unit) { |
|
44 this.river = river; |
|
45 this.unit = unit; |
|
46 } |
|
47 |
|
48 public Waterlevel(River river, Unit unit, String description) { |
|
49 this(river, unit); |
|
50 this.description = description; |
|
51 } |
|
52 |
|
53 @Id |
|
54 @SequenceGenerator( |
|
55 name = "SEQUENCE_WATERLEVEL_ID_SEQ", |
|
56 sequenceName = "WATERLEVEL_ID_SEQ", |
|
57 allocationSize = 1) |
|
58 @GeneratedValue( |
|
59 strategy = GenerationType.SEQUENCE, |
|
60 generator = "SEQUENCE_WATERLEVEL_ID_SEQ") |
|
61 @Column(name = "id") |
|
62 public Integer getId() { |
|
63 return id; |
|
64 } |
|
65 |
|
66 public void setId(Integer id) { |
|
67 this.id = id; |
|
68 } |
|
69 |
|
70 @OneToOne |
|
71 @JoinColumn(name = "river_id" ) |
|
72 public River getRiver() { |
|
73 return river; |
|
74 } |
|
75 |
|
76 public void setRiver(River river) { |
|
77 this.river = river; |
|
78 } |
|
79 |
|
80 @OneToOne |
|
81 @JoinColumn(name = "unit_id") |
|
82 public Unit getUnit() { |
|
83 return unit; |
|
84 } |
|
85 |
|
86 public void setUnit(Unit unit) { |
|
87 this.unit = unit; |
|
88 } |
|
89 |
|
90 @Column(name = "description") |
|
91 public String getDescription() { |
|
92 return description; |
|
93 } |
|
94 |
|
95 public void setDescription(String description) { |
|
96 this.description = description; |
|
97 } |
|
98 |
|
99 @OneToMany |
|
100 @JoinColumn(name="waterlevel_id") |
|
101 public List<WaterlevelQRange> getQRanges() { |
|
102 return qRanges; |
|
103 } |
|
104 |
|
105 public void setQRanges(List<WaterlevelQRange> qRanges) { |
|
106 this.qRanges = qRanges; |
|
107 } |
|
108 |
|
109 public void addQRange(WaterlevelQRange qRange) { |
|
110 qRanges.add(qRange); |
|
111 } |
|
112 } |
|
113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |