annotate flys-backend/src/main/java/de/intevation/flys/model/HYK.java @ 3946:948c7289fc42

Backend: Added 'official_number' column to rivers table to model the 'Bundeswasserstrassen Identnummer'. flys-backend/trunk@5571 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Sat, 22 Sep 2012 13:45:51 +0000
parents ca7d461a53f1
children
rev   line source
1210
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
2
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
4
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
5 import java.util.List;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
6
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
7 import javax.persistence.Entity;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
8 import javax.persistence.Id;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
9 import javax.persistence.Table;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
10 import javax.persistence.GeneratedValue;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
11 import javax.persistence.Column;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
12 import javax.persistence.SequenceGenerator;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
13 import javax.persistence.GenerationType;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
14 import javax.persistence.OneToOne;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
15 import javax.persistence.OneToMany;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
16 import javax.persistence.OrderBy;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
17 import javax.persistence.JoinColumn;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
18
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
19 @Entity
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
20 @Table(name = "hyks")
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
21 public class HYK
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
22 implements Serializable
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
23 {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
24 private Integer id;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
25 private River river;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
26 private String description;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
27
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
28 private List<HYKEntry> entries;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
29
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
30 public HYK() {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
31 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
32
1217
d5e39c16fd2a Schema: Fixed location of 'Peilungsjahre' in HYKs
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1212
diff changeset
33 public HYK(River river, String description) {
1210
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
34 this.river = river;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
35 this.description = description;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
36 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
37
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
38 @Id
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
39 @SequenceGenerator(
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
40 name = "SEQUENCE_HYKS_ID_SEQ",
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
41 sequenceName = "HYKS_ID_SEQ",
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
42 allocationSize = 1)
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
43 @GeneratedValue(
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
44 strategy = GenerationType.SEQUENCE,
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
45 generator = "SEQUENCE_HYKS_ID_SEQ")
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
46 @Column(name = "id")
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
47 public Integer getId() {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
48 return id;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
49 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
50
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
51 public void setId(Integer id) {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
52 this.id = id;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
53 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
54
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
55 @OneToOne
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
56 @JoinColumn(name = "river_id")
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
57 public River getRiver() {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
58 return river;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
59 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
60
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
61 public void setRiver(River river) {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
62 this.river = river;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
63 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
64
1224
ca7d461a53f1 HYK importer: Various small fixes and some extra logging.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents: 1217
diff changeset
65 @Column(name = "description")
1210
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
66 public String getDescription() {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
67 return description;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
68 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
69
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
70 public void setDescription(String description) {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
71 this.description = description;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
72 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
73
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
74 @OneToMany
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
75 @OrderBy("km")
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
76 @JoinColumn(name="hyk_id")
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
77 public List<HYKEntry> getEntries() {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
78 return entries;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
79 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
80
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
81 public void setEntries(List<HYKEntry> entries) {
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
82 this.entries = entries;
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
83 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
84 }
31d8638760b1 New. The hibernate models
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff changeset
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org