Mercurial > dive4elements > river
comparison flys-backend/src/main/java/org/dive4elements/river/model/FlowVelocityModelValue.java @ 5828:dfb26b03b179
Moved directories to org.dive4elements.river
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Thu, 25 Apr 2013 11:53:11 +0200 |
parents | flys-backend/src/main/java/de/intevation/flys/model/FlowVelocityModelValue.java@5a89c2b05e6d |
children | 18619c1e7c2a |
comparison
equal
deleted
inserted
replaced
5827:e308d4ecd35a | 5828:dfb26b03b179 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 import java.math.BigDecimal; | |
5 import java.util.List; | |
6 | |
7 import javax.persistence.Entity; | |
8 import javax.persistence.Id; | |
9 import javax.persistence.Table; | |
10 import javax.persistence.GeneratedValue; | |
11 import javax.persistence.Column; | |
12 import javax.persistence.SequenceGenerator; | |
13 import javax.persistence.GenerationType; | |
14 import javax.persistence.JoinColumn; | |
15 import javax.persistence.OneToOne; | |
16 | |
17 import org.hibernate.Session; | |
18 import org.hibernate.Query; | |
19 | |
20 import org.apache.log4j.Logger; | |
21 | |
22 import de.intevation.flys.backend.SessionHolder; | |
23 | |
24 | |
25 @Entity | |
26 @Table(name = "flow_velocity_model_values") | |
27 public class FlowVelocityModelValue | |
28 implements Serializable | |
29 { | |
30 private static Logger logger = | |
31 Logger.getLogger(FlowVelocityModelValue.class); | |
32 | |
33 | |
34 private Integer id; | |
35 | |
36 private FlowVelocityModel flowVelocity; | |
37 | |
38 private BigDecimal station; | |
39 private BigDecimal q; | |
40 private BigDecimal totalChannel; | |
41 private BigDecimal mainChannel; | |
42 private BigDecimal shearStress; | |
43 | |
44 | |
45 public FlowVelocityModelValue() { | |
46 } | |
47 | |
48 | |
49 public FlowVelocityModelValue( | |
50 FlowVelocityModel flowVelocity, | |
51 BigDecimal station, | |
52 BigDecimal q, | |
53 BigDecimal totalChannel, | |
54 BigDecimal mainChannel, | |
55 BigDecimal shearStress | |
56 ) { | |
57 this.flowVelocity = flowVelocity; | |
58 this.station = station; | |
59 this.q = q; | |
60 this.totalChannel = totalChannel; | |
61 this.mainChannel = mainChannel; | |
62 this.shearStress = shearStress; | |
63 } | |
64 | |
65 @Id | |
66 @SequenceGenerator( | |
67 name = "SEQUENCE_FLOW_VELOCITY_M_VALUES_ID_SEQ", | |
68 sequenceName = "FLOW_VELOCITY_M_VALUES_ID_SEQ", | |
69 allocationSize = 1) | |
70 @GeneratedValue( | |
71 strategy = GenerationType.SEQUENCE, | |
72 generator = "SEQUENCE_FLOW_VELOCITY_M_VALUES_ID_SEQ") | |
73 @Column(name = "id") | |
74 public Integer getId() { | |
75 return id; | |
76 } | |
77 | |
78 public void setId(Integer id) { | |
79 this.id = id; | |
80 } | |
81 | |
82 @OneToOne | |
83 @JoinColumn(name = "flow_velocity_model_id") | |
84 public FlowVelocityModel getFlowVelocity() { | |
85 return flowVelocity; | |
86 } | |
87 | |
88 public void setFlowVelocity(FlowVelocityModel flowVelocity) { | |
89 this.flowVelocity = flowVelocity; | |
90 } | |
91 | |
92 @Column(name = "station") | |
93 public BigDecimal getStation() { | |
94 return station; | |
95 } | |
96 | |
97 public void setStation(BigDecimal station) { | |
98 this.station = station; | |
99 } | |
100 | |
101 @Column(name = "q") | |
102 public BigDecimal getQ() { | |
103 return q; | |
104 } | |
105 | |
106 public void setQ(BigDecimal q) { | |
107 this.q = q; | |
108 } | |
109 | |
110 @Column(name = "total_channel") | |
111 public BigDecimal getTotalChannel() { | |
112 return totalChannel; | |
113 } | |
114 | |
115 public void setTotalChannel(BigDecimal totalChannel) { | |
116 this.totalChannel = totalChannel; | |
117 } | |
118 | |
119 @Column(name = "main_channel") | |
120 public BigDecimal getMainChannel() { | |
121 return mainChannel; | |
122 } | |
123 | |
124 public void setMainChannel(BigDecimal mainChannel) { | |
125 this.mainChannel = mainChannel; | |
126 } | |
127 | |
128 @Column(name = "shear_stress") | |
129 public BigDecimal getShearStress() { | |
130 return shearStress; | |
131 } | |
132 | |
133 public void setShearStress(BigDecimal shearStress) { | |
134 this.shearStress = shearStress; | |
135 } | |
136 | |
137 | |
138 public static List<FlowVelocityModelValue> getValues( | |
139 FlowVelocityModel model, | |
140 double kmLo, | |
141 double kmHi | |
142 ) { | |
143 Session session = SessionHolder.HOLDER.get(); | |
144 | |
145 Query query = session.createQuery( | |
146 "from FlowVelocityModelValue where " + | |
147 " flowVelocity=:model and" + | |
148 " station >= :kmLo and " + | |
149 " station <= :kmHi"); | |
150 | |
151 query.setParameter("model", model); | |
152 query.setParameter("kmLo", new BigDecimal(kmLo)); | |
153 query.setParameter("kmHi", new BigDecimal(kmHi)); | |
154 | |
155 return query.list(); | |
156 } | |
157 } | |
158 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |