Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifference.java @ 2877:f0a67bc0e777 2.7
merged flys-backend/2.7
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:31 +0200 |
parents | dfc5bc5660c2 |
children |
comparison
equal
deleted
inserted
replaced
2793:6310b1582f2d | 2877:f0a67bc0e777 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 import java.util.ArrayList; | |
5 import java.util.List; | |
6 | |
7 import javax.persistence.Entity; | |
8 import javax.persistence.Id; | |
9 import javax.persistence.Table; | |
10 import javax.persistence.GeneratedValue; | |
11 import javax.persistence.Column; | |
12 import javax.persistence.SequenceGenerator; | |
13 import javax.persistence.GenerationType; | |
14 import javax.persistence.JoinColumn; | |
15 import javax.persistence.OneToOne; | |
16 import javax.persistence.OneToMany; | |
17 | |
18 import org.apache.log4j.Logger; | |
19 | |
20 | |
21 @Entity | |
22 @Table(name = "waterlevel_difference") | |
23 public class WaterlevelDifference | |
24 implements Serializable | |
25 { | |
26 private static Logger logger = Logger.getLogger(WaterlevelDifference.class); | |
27 | |
28 private Integer id; | |
29 | |
30 private River river; | |
31 | |
32 private Unit unit; | |
33 | |
34 private List<WaterlevelDifferenceColumn> columns; | |
35 | |
36 private String description; | |
37 | |
38 | |
39 public WaterlevelDifference() { | |
40 columns = new ArrayList<WaterlevelDifferenceColumn>(); | |
41 } | |
42 | |
43 | |
44 public WaterlevelDifference(River river, Unit unit) { | |
45 this(); | |
46 | |
47 this.river = river; | |
48 this.unit = unit; | |
49 } | |
50 | |
51 | |
52 public WaterlevelDifference(River river, Unit unit, String description) { | |
53 this(river, unit); | |
54 | |
55 this.description = description; | |
56 } | |
57 | |
58 | |
59 @Id | |
60 @SequenceGenerator( | |
61 name = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ", | |
62 sequenceName = "WATERLEVEL_DIFFERENCE_ID_SEQ", | |
63 allocationSize = 1) | |
64 @GeneratedValue( | |
65 strategy = GenerationType.SEQUENCE, | |
66 generator = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ") | |
67 @Column(name = "id") | |
68 public Integer getId() { | |
69 return id; | |
70 } | |
71 | |
72 public void setId(Integer id) { | |
73 this.id = id; | |
74 } | |
75 | |
76 @OneToOne | |
77 @JoinColumn(name = "river_id" ) | |
78 public River getRiver() { | |
79 return river; | |
80 } | |
81 | |
82 public void setRiver(River river) { | |
83 this.river = river; | |
84 } | |
85 | |
86 @OneToOne | |
87 @JoinColumn(name = "unit_id") | |
88 public Unit getUnit() { | |
89 return unit; | |
90 } | |
91 | |
92 public void setUnit(Unit unit) { | |
93 this.unit = unit; | |
94 } | |
95 | |
96 @Column(name = "description") | |
97 public String getDescription() { | |
98 return description; | |
99 } | |
100 | |
101 public void setDescription(String description) { | |
102 this.description = description; | |
103 } | |
104 | |
105 @OneToMany | |
106 @JoinColumn(name = "difference_id") | |
107 public List<WaterlevelDifferenceColumn> getColumns() { | |
108 return columns; | |
109 } | |
110 | |
111 public void setColumns(List<WaterlevelDifferenceColumn> columns) { | |
112 this.columns = columns; | |
113 } | |
114 | |
115 public void addColumn(WaterlevelDifferenceColumn column) { | |
116 this.columns.add(column); | |
117 } | |
118 } | |
119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |