annotate flys-backend/src/main/java/de/intevation/flys/model/Waterlevel.java @ 4837:9e25c7523485

Fixed calculation of effective width in MINFO SQ relation. * Get all (including empty datasets) from db. * Filter empty datasets when processing data of the same date. * Added debug outputs.
author Raimund Renkert <rrenkert@intevation.de>
date Wed, 23 Jan 2013 11:14:41 +0100
parents 0d55b7722fae
children 99b452967737
rev   line source
2842
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.util.List;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
5
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6 import javax.persistence.Entity;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import javax.persistence.Id;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import javax.persistence.Table;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import javax.persistence.GeneratedValue;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import javax.persistence.Column;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.persistence.SequenceGenerator;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import javax.persistence.GenerationType;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import javax.persistence.JoinColumn;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import javax.persistence.OneToOne;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import javax.persistence.OneToMany;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
17 import org.apache.log4j.Logger;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
18
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
19
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
22 @Entity
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
23 @Table(name = "waterlevel")
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24 public class Waterlevel
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 implements Serializable
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 private static Logger logger = Logger.getLogger(Waterlevel.class);
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 private Integer id;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31 private River river;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private Unit unit;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 private String description;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
37 private List<WaterlevelQRange> qRanges;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
39
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40 public Waterlevel() {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
41 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
42
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43 public Waterlevel(River river, Unit unit) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44 this.river = river;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 this.unit = unit;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48 public Waterlevel(River river, Unit unit, String description) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 this(river, unit);
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
50 this.description = description;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
51 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
52
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
53 @Id
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
54 @SequenceGenerator(
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 name = "SEQUENCE_WATERLEVEL_ID_SEQ",
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
56 sequenceName = "WATERLEVEL_ID_SEQ",
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
57 allocationSize = 1)
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
58 @GeneratedValue(
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
59 strategy = GenerationType.SEQUENCE,
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
60 generator = "SEQUENCE_WATERLEVEL_ID_SEQ")
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 @Column(name = "id")
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62 public Integer getId() {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 return id;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 public void setId(Integer id) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 this.id = id;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 @OneToOne
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 @JoinColumn(name = "river_id" )
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 public River getRiver() {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 return river;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public void setRiver(River river) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 this.river = river;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 @OneToOne
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 @JoinColumn(name = "unit_id")
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 public Unit getUnit() {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 return unit;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 public void setUnit(Unit unit) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 this.unit = unit;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
90 @Column(name = "description")
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
91 public String getDescription() {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
92 return description;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
95 public void setDescription(String description) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
96 this.description = description;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 @OneToMany
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 @JoinColumn(name="waterlevel_id")
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 public List<WaterlevelQRange> getQRanges() {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 return qRanges;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 public void setQRanges(List<WaterlevelQRange> qRanges) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 this.qRanges = qRanges;
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
108
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
109 public void addQRange(WaterlevelQRange qRange) {
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
110 qRanges.add(qRange);
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112 }
0d55b7722fae Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
113 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org