annotate flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifference.java @ 4930:28f992c0f937 dami

SCHEMA CHANGES: Add tables for Hochwasserschutzanlagen This adds the first draft of Hochwasserschutzanlagen tables hws_points and hws_lines which replace the old hws table and also lookup tables fed_states and hws_kinds.
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 28 Jan 2013 17:42:18 +0100
parents dfc5bc5660c2
children
rev   line source
2847
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.ArrayList;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5 import java.util.List;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import javax.persistence.Entity;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import javax.persistence.Id;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import javax.persistence.Table;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import javax.persistence.GeneratedValue;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.persistence.Column;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import javax.persistence.SequenceGenerator;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import javax.persistence.GenerationType;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import javax.persistence.JoinColumn;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import javax.persistence.OneToOne;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16 import javax.persistence.OneToMany;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18 import org.apache.log4j.Logger;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21 @Entity
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 @Table(name = "waterlevel_difference")
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 public class WaterlevelDifference
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 implements Serializable
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 private static Logger logger = Logger.getLogger(WaterlevelDifference.class);
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 private Integer id;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 private River river;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32 private Unit unit;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34 private List<WaterlevelDifferenceColumn> columns;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36 private String description;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39 public WaterlevelDifference() {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 columns = new ArrayList<WaterlevelDifferenceColumn>();
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 public WaterlevelDifference(River river, Unit unit) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 this();
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47 this.river = river;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 this.unit = unit;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52 public WaterlevelDifference(River river, Unit unit, String description) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 this(river, unit);
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 this.description = description;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 @Id
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 @SequenceGenerator(
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 name = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ",
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 sequenceName = "WATERLEVEL_DIFFERENCE_ID_SEQ",
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 allocationSize = 1)
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 @GeneratedValue(
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 strategy = GenerationType.SEQUENCE,
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 generator = "SEQUENCE_WATERLEVEL_DIFFERENCE_ID_SEQ")
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 @Column(name = "id")
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 public Integer getId() {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 return id;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 public void setId(Integer id) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 this.id = id;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 @OneToOne
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 @JoinColumn(name = "river_id" )
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 public River getRiver() {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79 return river;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 public void setRiver(River river) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 this.river = river;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 @OneToOne
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 @JoinColumn(name = "unit_id")
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 public Unit getUnit() {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89 return unit;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 public void setUnit(Unit unit) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 this.unit = unit;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 @Column(name = "description")
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 public String getDescription() {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98 return description;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 public void setDescription(String description) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 this.description = description;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 @OneToMany
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 @JoinColumn(name = "difference_id")
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 public List<WaterlevelDifferenceColumn> getColumns() {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108 return columns;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 public void setColumns(List<WaterlevelDifferenceColumn> columns) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 this.columns = columns;
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
114
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 public void addColumn(WaterlevelDifferenceColumn column) {
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116 this.columns.add(column);
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
117 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
118 }
dfc5bc5660c2 Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org