Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/CrossSection.java @ 3813:6aeee2250418 pre2.6-2011-12-05
merged flys-backend/pre2.6-2011-12-05
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:54 +0200 |
parents | 31d8638760b1 |
children | 8be27b950dbe |
comparison
equal
deleted
inserted
replaced
3812:f788d2d901d6 | 3813:6aeee2250418 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 | |
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.OneToOne; | |
15 import javax.persistence.OneToMany; | |
16 import javax.persistence.OrderBy; | |
17 import javax.persistence.JoinColumn; | |
18 | |
19 @Entity | |
20 @Table(name = "cross_sections") | |
21 public class CrossSection | |
22 implements Serializable | |
23 { | |
24 private Integer id; | |
25 private River river; | |
26 private TimeInterval timeInterval; | |
27 private String description; | |
28 private List<CrossSectionLine> lines; | |
29 | |
30 public CrossSection() { | |
31 } | |
32 | |
33 public CrossSection( | |
34 River river, | |
35 TimeInterval timeInterval, | |
36 String description | |
37 ) { | |
38 this.river = river; | |
39 this.timeInterval = timeInterval; | |
40 this.description = description; | |
41 } | |
42 | |
43 @Id | |
44 @SequenceGenerator( | |
45 name = "SEQUENCE_CROSS_SECTIONS_ID_SEQ", | |
46 sequenceName = "CROSS_SECTIONS_ID_SEQ", | |
47 allocationSize = 1) | |
48 @GeneratedValue( | |
49 strategy = GenerationType.SEQUENCE, | |
50 generator = "SEQUENCE_CROSS_SECTIONS_ID_SEQ") | |
51 @Column(name = "id") | |
52 public Integer getId() { | |
53 return id; | |
54 } | |
55 | |
56 public void setId(Integer id) { | |
57 this.id = id; | |
58 } | |
59 | |
60 @OneToOne | |
61 @JoinColumn(name = "river_id") | |
62 public River getRiver() { | |
63 return river; | |
64 } | |
65 | |
66 public void setRiver(River river) { | |
67 this.river = river; | |
68 } | |
69 | |
70 @OneToOne | |
71 @JoinColumn(name = "time_interval_id") | |
72 public TimeInterval getTimeInterval() { | |
73 return timeInterval; | |
74 } | |
75 | |
76 public void setTimeInterval(TimeInterval timeInterval) { | |
77 this.timeInterval = timeInterval; | |
78 } | |
79 | |
80 @Column(name = "description") | |
81 public String getDescription() { | |
82 return description; | |
83 } | |
84 | |
85 public void setDescription(String description) { | |
86 this.description = description; | |
87 } | |
88 | |
89 @OneToMany | |
90 @OrderBy("km") | |
91 @JoinColumn(name="cross_section_id") | |
92 public List<CrossSectionLine> getLines() { | |
93 return lines; | |
94 } | |
95 | |
96 public void setLines(List<CrossSectionLine> lines) { | |
97 this.lines = lines; | |
98 } | |
99 } | |
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |