annotate flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java @ 4174:eaf83d4ae6b1

Sorted gauges for reference gauge selection in historical discharge calculation based on their name. Now, Gauge implements the Java Comparable interface and takes its name into account.
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Thu, 18 Oct 2012 13:12:24 +0200
parents 5a89c2b05e6d
children cc6323401643
rev   line source
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
1 package de.intevation.flys.model;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
2
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
3 import java.io.Serializable;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
4 import java.math.BigDecimal;
2870
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
5 import java.util.List;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
6
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
7 import javax.persistence.Entity;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
8 import javax.persistence.Id;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
9 import javax.persistence.Table;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
10 import javax.persistence.GeneratedValue;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
11 import javax.persistence.Column;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
12 import javax.persistence.SequenceGenerator;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
13 import javax.persistence.GenerationType;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
14 import javax.persistence.JoinColumn;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
15 import javax.persistence.OneToOne;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
16
2870
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
17 import org.hibernate.Session;
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
18 import org.hibernate.Query;
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
19
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
20 import org.apache.log4j.Logger;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
21
2870
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
22 import de.intevation.flys.backend.SessionHolder;
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
23
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
24
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
25 @Entity
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
26 @Table(name = "discharge_zone")
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
27 public class DischargeZone
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
28 implements Serializable
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
29 {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
30 private static Logger logger = Logger.getLogger(DischargeZone.class);
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
31
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
32
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
33 private Integer id;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
34
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
35 private River river;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
36
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
37 private String gaugeName;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
38
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
39 private BigDecimal value;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
40
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
41 private String lowerDischarge;
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
42 private String upperDischarge;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
43
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
44
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
45 public DischargeZone() {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
46 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
47
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
48
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
49 public DischargeZone(
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
50 River river,
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
51 String gaugeName,
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
52 BigDecimal value,
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
53 String lowerDischarge,
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
54 String upperDischarge
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
55 ) {
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
56 this.river = river;
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
57 this.gaugeName = gaugeName;
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
58 this.value = value;
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
59 this.lowerDischarge = lowerDischarge;
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
60 this.upperDischarge = upperDischarge;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
61 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
62
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
63 @Id
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
64 @SequenceGenerator(
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
65 name = "SEQUENCE_DISCHARGE_ZONE_ID_SEQ",
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
66 sequenceName = "DISCHARGE_ZONE_ID_SEQ",
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
67 allocationSize = 1)
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
68 @GeneratedValue(
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
69 strategy = GenerationType.SEQUENCE,
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
70 generator = "SEQUENCE_DISCHARGE_ZONE_ID_SEQ")
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
71 @Column(name = "id")
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
72 public Integer getId() {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
73 return id;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
74 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
75
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
76 public void setId(Integer id) {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
77 this.id = id;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
78 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
79
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
80 @OneToOne
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
81 @JoinColumn(name = "river_id" )
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
82 public River getRiver() {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
83 return river;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
84 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
85
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
86 public void setRiver(River river) {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
87 this.river = river;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
88 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
89
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
90 @Column(name = "value")
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
91 public BigDecimal getValue() {
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
92 return value;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
93 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
94
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
95 public void setValue(BigDecimal value) {
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
96 this.value = value;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
97 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
98
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
99 @Column(name = "gauge_name")
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
100 public String getGaugeName() {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
101 return gaugeName;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
102 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
103
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
104 public void setGaugeName(String gaugeName) {
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
105 this.gaugeName = gaugeName;
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
106 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
107
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
108 @Column(name = "lower_discharge")
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
109 public String getLowerDischarge() {
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
110 return lowerDischarge;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
111 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
112
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
113 public void setLowerDischarge(String lowerDischarge) {
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
114 this.lowerDischarge = lowerDischarge;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
115 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
116
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
117 @Column(name = "upper_discharge")
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
118 public String getUpperDischarge() {
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
119 return upperDischarge;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
120 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
121
2833
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
122 public void setUpperDischarge(String upperDischarge) {
5b54a648f702 Finished flow velocity data import: finished parsing meta data of model files and repaired broken HQL statements.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2825
diff changeset
123 this.upperDischarge = upperDischarge;
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
124 }
2870
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
125
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
126
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
127 public static List<DischargeZone> getDischargeZones(River river) {
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
128 Session session = SessionHolder.HOLDER.get();
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
129
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
130 Query query = session.createQuery(
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
131 "from DischargeZone where river=:river");
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
132
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
133 query.setParameter("river", river);
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
134
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
135 return query.list();
28526b0b0a90 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2833
diff changeset
136 }
2871
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
137
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
138
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
139 public static DischargeZone getDischargeZoneById(int id) {
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
140 Session session = SessionHolder.HOLDER.get();
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
141
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
142 Query query = session.createQuery(
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
143 "from DischargeZone where id=:id");
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
144
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
145 query.setParameter("id", id);
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
146
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
147 List<DischargeZone> zones = query.list();
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
148
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
149 return zones.isEmpty() ? null : zones.get(0);
5a89c2b05e6d Added functions to retrieve data from database.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents: 2870
diff changeset
150 }
2825
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
151 }
a948366d8ac5 Added new model classes for MINFO specific flow velocity.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff changeset
152 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org