Mercurial > dive4elements > river
annotate backend/src/main/java/org/dive4elements/river/model/DischargeTable.java @ 9613:f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
author | mschaefer |
---|---|
date | Tue, 08 Oct 2019 15:03:24 +0200 |
parents | 491e1a434457 |
children |
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; |
9613
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
12 import java.util.ArrayList; |
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
|
13 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
|
14 import java.util.List; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
15 |
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
|
16 import javax.persistence.Column; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
17 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
|
18 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
|
19 import javax.persistence.GenerationType; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
20 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
|
21 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
|
22 import javax.persistence.OneToMany; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
23 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
|
24 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
|
25 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
|
26 import javax.persistence.Table; |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
27 import javax.persistence.Transient; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
28 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
29 import org.dive4elements.river.backend.SessionHolder; |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
30 import org.hibernate.Query; |
6692
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
31 import org.hibernate.Session; |
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
32 |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
33 @Entity |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
34 @Table(name = "discharge_tables") |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 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
|
36 implements Serializable, Comparable<DischargeTable> |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 { |
172
605320b7df94
Added column annotations for simple fields. TODO: foreign keys.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
171
diff
changeset
|
38 private Integer id; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
39 private Gauge gauge; |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
40 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
|
41 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
|
42 private Integer kind; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 private TimeInterval timeInterval; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
45 private List<DischargeTableValue> dischargeTableValues; |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
46 |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 public DischargeTable() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
48 this.kind = 0; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
51 public DischargeTable(final 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
|
52 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
|
53 } |
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
|
54 |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
55 public DischargeTable( |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
56 final Gauge gauge, |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
57 final String description, |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
58 final String bfgId, |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
59 final Integer kind, |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
60 final TimeInterval timeInterval |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
61 ) { |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
62 this.gauge = gauge; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
63 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
|
64 this.bfgId = bfgId; |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
65 this.kind = kind; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
66 this.timeInterval = timeInterval; |
198
d980e545ccab
Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
174
diff
changeset
|
67 } |
d980e545ccab
Added import code for importing discharge tables.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
174
diff
changeset
|
68 |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
69 @Id |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
70 @SequenceGenerator( |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
71 name = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ", |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
72 sequenceName = "DISCHARGE_TABLES_ID_SEQ", |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
73 allocationSize = 1) |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
74 @GeneratedValue( |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
75 strategy = GenerationType.SEQUENCE, |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
76 generator = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ") |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
77 @Column(name = "id") |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
78 public Integer getId() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
79 return this.id; |
171
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
80 } |
4a83e14f40f9
Added entity and id annotations.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
168
diff
changeset
|
81 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
82 public void setId(final Integer id) { |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
83 this.id = id; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
84 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
85 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
86 @OneToOne |
8842 | 87 @JoinColumn(name = "gauge_id") |
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
|
88 public Gauge getGauge() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
89 return this.gauge; |
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
|
90 } |
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
|
91 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
92 public void setGauge(final Gauge gauge) { |
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
|
93 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
|
94 } |
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
|
95 |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
96 @Column(name = "description") |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
97 public String getDescription() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
98 return this.description; |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
99 } |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
100 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
101 public void setDescription(final String description) { |
493
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
102 this.description = description; |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
103 } |
b35c5dc0f8b7
Importer: Make import of historical discharge tables work.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
467
diff
changeset
|
104 |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
105 @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
|
106 public String getBfgId() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
107 return this.bfgId; |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
108 } |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
109 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
110 public void setBfgId(final String bfgId) { |
4776
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
111 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
|
112 } |
20b6ebf23916
!!! FLYS backend schema change !!! Add column bfg_id column to discharge_tables.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
4227
diff
changeset
|
113 |
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
|
114 @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
|
115 public Integer getKind() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
116 return this.kind; |
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
|
117 } |
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
|
118 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
119 public void setKind(final Integer kind) { |
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
|
120 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
|
121 } |
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
|
122 |
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
|
123 @OneToOne |
8842 | 124 @JoinColumn(name = "time_interval_id") |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
125 public TimeInterval getTimeInterval() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
126 return this.timeInterval; |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
127 } |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
128 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
129 public void setTimeInterval(final TimeInterval timeInterval) { |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
130 this.timeInterval = timeInterval; |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
131 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
132 |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
133 @OneToMany |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
134 @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
|
135 @OrderBy("q") |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
136 public List<DischargeTableValue> getDischargeTableValues() { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
137 return this.dischargeTableValues; |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
138 } |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
139 |
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
140 public void setDischargeTableValues( |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
141 final List<DischargeTableValue> dischargeTableValues |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
142 ) { |
174
249390dd24e7
Added foreign key constraint annotations to model classes.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
172
diff
changeset
|
143 this.dischargeTableValues = dischargeTableValues; |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
144 } |
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
|
145 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
146 @Transient |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
147 public double[] getWs() { |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
148 final double[] ws = new double[this.dischargeTableValues.size()]; |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
149 for (int i=0; i<=this.dischargeTableValues.size()-1; i++) |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
150 ws[i] = this.dischargeTableValues.get(i).getW().doubleValue(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
151 |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
152 return ws; |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
153 } |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
154 |
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
|
155 @Override |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
156 public int compareTo(final DischargeTable o) { |
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
|
157 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
|
158 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
|
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 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
161 final TimeInterval other = o.getTimeInterval(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
162 if (other == null && this.timeInterval == null) { |
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
|
163 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
|
164 } |
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
|
165 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
|
166 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
|
167 } |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
168 else if (this.timeInterval == null) { |
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
|
169 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
|
170 } |
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
|
171 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
172 final Date otherStartTime = other.getStartTime(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
173 final Date thisStartTime = this.timeInterval.getStartTime(); |
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
|
174 |
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 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
|
176 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
|
177 } |
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 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
|
179 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
|
180 } |
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 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
182 final long otherStart = otherStartTime.getTime(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
183 final long thisStart = thisStartTime.getTime(); |
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
|
184 |
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 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
|
186 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
|
187 } |
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 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
|
189 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
|
190 } |
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 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
192 final Date otherStopTime = other.getStopTime(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
193 final Date thisStopTime = this.timeInterval.getStopTime(); |
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
|
194 |
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 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
|
196 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
|
197 } |
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 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
|
199 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
|
200 } |
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
|
201 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
202 final long otherEnd = otherStopTime.getTime(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
203 final long thisEnd = thisStopTime.getTime(); |
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
|
204 |
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
|
205 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
|
206 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
|
207 } |
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
|
208 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
|
209 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
|
210 } |
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
|
211 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
|
212 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
|
213 } |
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
|
214 } |
6692
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
215 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
216 public static DischargeTable getDischargeTableById(final int dtId) |
6692
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
217 { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
218 final Session session = SessionHolder.HOLDER.get(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
219 final Query query = session.createQuery("from DischargeTable where id =:dtId"); |
6692
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
220 query.setParameter("dtId", dtId); |
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
221 |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
222 final List<DischargeTable> list = query.list(); |
6692
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
223 return list.isEmpty() ? null : list.get(0); |
ce691d22cee3
issue1891: Add method to get a discharge table by it's id
Andre Heinecke <aheinecke@intevation.de>
parents:
5992
diff
changeset
|
224 } |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
225 |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
226 /** |
9613
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
227 * Fetches from the database a gauge's historical discharge tables of a time range in chronological order. |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
228 */ |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
229 public static List<DischargeTable> fetchHistoricalDischargeTables(final Gauge gauge, final Date from, final Date to) { |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
230 |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
231 final Session session = SessionHolder.HOLDER.get(); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
232 |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
233 final Query query = session.createQuery("FROM DischargeTable" |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
234 + " WHERE (kind = 1) AND (gauge.id = :gauge_id)" |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
235 + " AND (timeInterval.startTime <= :to)" |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
236 + " AND ((timeInterval.stopTime IS NULL) OR (timeInterval.stopTime >= :from))" |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
237 + " ORDER BY timeInterval.startTime"); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
238 |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
239 query.setParameter("gauge_id", gauge.getId()); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
240 query.setParameter("from", from); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
241 query.setParameter("to", to); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
242 final List<DischargeTable> qtables = new ArrayList<>(); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
243 for (final Object qtable : query.list()) |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
244 qtables.add((DischargeTable) qtable); |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
245 return qtables; |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
246 } |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
247 |
f2473dc34535
Nachtrag Pos. 19: Q calculation with historical discharge tables instead of master discharge table
mschaefer
parents:
9201
diff
changeset
|
248 /** |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
249 * Selects from the database the values of a discharge table sorted by W |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
250 */ |
9201 | 251 public static List<DischargeTableValue> fetchValuesSortedByW(final DischargeTable dischargeTable) { |
9159
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
252 final Session session = SessionHolder.HOLDER.get(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
253 final Query query = session.createQuery("FROM DischargeTableValue WHERE table_id=:parentid ORDER BY w"); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
254 query.setParameter("parentid", dischargeTable.getId()); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
255 return query.list(); |
64e56a51db3f
Added methods to select a gauge's discharge table and main value list; added a main value type key enum
mschaefer
parents:
8842
diff
changeset
|
256 } |
167
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
257 } |
15d515fe15f5
Added POJOs to be mapped to schema.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
258 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |