Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/model/DischargeTable.java @ 6203:a3fb76cf79b6 double-precision
backout backout as it is now safely in a branch
author | Tom Gottfried <tom.gottfried@intevation.de> |
---|---|
date | Wed, 05 Jun 2013 11:56:38 +0200 |
parents | 4c3ccf2b0304 |
children | ce691d22cee3 |
rev | line source |
---|---|
5844
4dd33b86dc61
Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4dd33b86dc61
Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4dd33b86dc61
Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5992
4c3ccf2b0304
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5844
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5844
4dd33b86dc61
Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5992
4c3ccf2b0304
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5844
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5844
4dd33b86dc61
Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4dd33b86dc61
Added header to river backend.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
5829
18619c1e7c2a
Repaired internal references.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5828
diff
changeset
|
9 package org.dive4elements.river.model; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
11 import java.io.Serializable; |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
12 import java.util.Date; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
13 import java.util.List; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
14 |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
15 import javax.persistence.Column; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
16 import javax.persistence.Entity; |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
17 import javax.persistence.GeneratedValue; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
18 import javax.persistence.GenerationType; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
19 import javax.persistence.Id; |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
20 import javax.persistence.JoinColumn; |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
21 import javax.persistence.OneToMany; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
22 import javax.persistence.OneToOne; |
2425
67f362883fe4
flys/issue499: Sort the values of the discharge table by Q.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
493
diff
changeset
|
23 import javax.persistence.OrderBy; |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
24 import javax.persistence.SequenceGenerator; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
25 import javax.persistence.Table; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
26 |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
27 @Entity |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
28 @Table(name = "discharge_tables") |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
29 public class DischargeTable |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
30 implements Serializable, Comparable<DischargeTable> |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
31 { |
172
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
32 private Integer id; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
33 private Gauge gauge; |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
34 private String description; |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
35 private String bfgId; |
467
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
36 private Integer kind; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 private TimeInterval timeInterval; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
39 private List<DischargeTableValue> dischargeTableValues; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
40 |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 public DischargeTable() { |
467
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
42 kind = 0; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
198
d980e545ccab
Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
174
diff
changeset
|
45 public DischargeTable(Gauge gauge) { |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
46 this(gauge, null, null, 0, null); |
467
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
47 } |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
48 |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
49 public DischargeTable( |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
50 Gauge gauge, |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
51 String description, |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
52 String bfgId, |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
53 Integer kind, |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
54 TimeInterval timeInterval |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
55 ) { |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
56 this.gauge = gauge; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
57 this.description = description; |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
58 this.bfgId = bfgId; |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
59 this.kind = kind; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
60 this.timeInterval = timeInterval; |
198
d980e545ccab
Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
174
diff
changeset
|
61 } |
d980e545ccab
Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
174
diff
changeset
|
62 |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
63 @Id |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
64 @SequenceGenerator( |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
65 name = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ", |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
66 sequenceName = "DISCHARGE_TABLES_ID_SEQ", |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
67 allocationSize = 1) |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
68 @GeneratedValue( |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
69 strategy = GenerationType.SEQUENCE, |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
70 generator = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ") |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
71 @Column(name = "id") |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
72 public Integer getId() { |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
73 return id; |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
74 } |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
75 |
168
86a1bd9cc50e
More Hibernate/JPA stuff
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
167
diff
changeset
|
76 public void setId(Integer id) { |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
77 this.id = id; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
78 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
79 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
80 @OneToOne |
467
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
81 @JoinColumn(name = "gauge_id" ) |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
82 public Gauge getGauge() { |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
83 return gauge; |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
84 } |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
85 |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
86 public void setGauge(Gauge gauge) { |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
87 this.gauge = gauge; |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
88 } |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
89 |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
90 @Column(name = "description") |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
91 public String getDescription() { |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
92 return description; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
93 } |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
94 |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
95 public void setDescription(String description) { |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
96 this.description = description; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
97 } |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
98 |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
99 @Column(name = "bfg_id") |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
100 public String getBfgId() { |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
101 return bfgId; |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
102 } |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
103 |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
104 public void setBfgId(String bfgId) { |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
105 this.bfgId = bfgId; |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
106 } |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
107 |
467
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
108 @Column(name = "kind") |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
109 public Integer getKind() { |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
110 return kind; |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
111 } |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
112 |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
113 public void setKind(Integer kind) { |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
114 this.kind = kind; |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
115 } |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
116 |
c8c09e31cdb8
Added new column 'kind' in discharge tables and wst to distinguish between different types.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
198
diff
changeset
|
117 @OneToOne |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
118 @JoinColumn(name = "time_interval_id" ) |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
119 public TimeInterval getTimeInterval() { |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
120 return timeInterval; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
121 } |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
122 |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
123 public void setTimeInterval(TimeInterval timeInterval) { |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
124 this.timeInterval = timeInterval; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
125 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
126 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
127 @OneToMany |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
128 @JoinColumn(name = "table_id") |
2425
67f362883fe4
flys/issue499: Sort the values of the discharge table by Q.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
493
diff
changeset
|
129 @OrderBy("q") |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
130 public List<DischargeTableValue> getDischargeTableValues() { |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
131 return dischargeTableValues; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
132 } |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
133 |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
134 public void setDischargeTableValues( |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
135 List<DischargeTableValue> dischargeTableValues |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
136 ) { |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
137 this.dischargeTableValues = dischargeTableValues; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
138 } |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
139 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
140 @Override |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
141 public int compareTo(DischargeTable o) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
142 if (getKind() == 0 && o.getKind() != 0) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
143 return 1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
144 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
145 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
146 TimeInterval other = o.getTimeInterval(); |
4227
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
147 if (other == null && timeInterval == null) { |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
148 return 1; |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
149 } |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
150 else if (other == null) { |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
151 return -1; |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
152 } |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
153 else if (timeInterval == null) { |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
154 return 1; |
8138a90a674a
Be more tolerant with empty time intervals in discharge tables while comparing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
4173
diff
changeset
|
155 } |
4173
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
156 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
157 Date otherStartTime = other.getStartTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
158 Date thisStartTime = timeInterval.getStartTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
159 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
160 if (otherStartTime == null) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
161 return -1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
162 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
163 else if (thisStartTime == null) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
164 return 1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
165 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
166 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
167 long otherStart = otherStartTime.getTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
168 long thisStart = thisStartTime.getTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
169 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
170 if (otherStart < thisStart) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
171 return 1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
172 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
173 else if (otherStart > thisStart) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
174 return -1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
175 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
176 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
177 Date otherStopTime = other.getStopTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
178 Date thisStopTime = timeInterval.getStopTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
179 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
180 if (otherStopTime == null) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
181 return -1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
182 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
183 else if (thisStopTime == null) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
184 return 1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
185 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
186 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
187 long otherEnd = otherStopTime.getTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
188 long thisEnd = thisStopTime.getTime(); |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
189 |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
190 if (otherEnd < thisEnd) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
191 return 1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
192 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
193 else if (otherEnd > thisEnd) { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
194 return -1; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
195 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
196 else { |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
197 return 0; |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
198 } |
7d4480c0e68e
Allow users to select the current relevant discharge table in historical discharge table calculattion.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
2425
diff
changeset
|
199 } |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
200 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
201 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |