Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/WaterlevelQRange.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 |
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.ArrayList; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import java.util.List; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import javax.persistence.Entity; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import javax.persistence.Id; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import javax.persistence.Table; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.persistence.GeneratedValue; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import javax.persistence.Column; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import javax.persistence.SequenceGenerator; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import javax.persistence.GenerationType; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 import javax.persistence.JoinColumn; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import javax.persistence.OneToOne; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 import javax.persistence.OneToMany; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 import org.apache.log4j.Logger; |
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 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 @Entity |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 @Table(name = "waterlevel_q_range") |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 public class WaterlevelQRange |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 implements Serializable |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 private static Logger logger = Logger.getLogger(WaterlevelQRange.class); |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 private Integer id; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 private Waterlevel waterlevel; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 private Double q; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 private List<WaterlevelValue> values; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
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 public WaterlevelQRange() { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 this.values = new ArrayList<WaterlevelValue>(); |
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 WaterlevelQRange(Waterlevel waterlevel, Double q) { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 this(); |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 this.q = q; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 this.waterlevel = waterlevel; |
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 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 @Id |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 @SequenceGenerator( |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 name = "SEQUENCE_WATERLEVEL_Q_RANGE_ID_SEQ", |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 sequenceName = "WATERLEVEL_Q_RANGES_ID_SEQ", |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 allocationSize = 1) |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 @GeneratedValue( |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 strategy = GenerationType.SEQUENCE, |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 generator = "SEQUENCE_WATERLEVEL_Q_RANGE_ID_SEQ") |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 @Column(name = "id") |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 public Integer getId() { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 return id; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 } |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 public void setId(Integer id) { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 this.id = id; |
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 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 @OneToOne |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 @JoinColumn(name = "waterlevel_id" ) |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 public Waterlevel getWaterlevel() { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 return waterlevel; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 } |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 public void setWaterlevel(Waterlevel waterlevel) { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 this.waterlevel = waterlevel; |
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 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 @Column(name = "q") |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 public Double getQ() { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 return q; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 } |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 public void setQ(Double q) { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 this.q = q; |
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 @OneToMany |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 @Column(name = "waterlevel_q_range_id") |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 public List<WaterlevelValue> getValues() { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 return values; |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
90 } |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 public void setValues(List<WaterlevelValue> values) { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 this.values = values; |
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 |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
96 public void addValue(WaterlevelValue value) { |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
97 values.add(value); |
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 } |
0d55b7722fae
Added new model classes for MINFO specific waterlevel data.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
100 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |