Mercurial > dive4elements > river
annotate flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/minfo/QualityMeasurementFactory.java @ 4357:11cf29eb002c
FacetTypes: New type: exreme_wq_curve_base (for the Stuetz-Q-Poits).
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Fri, 02 Nov 2012 11:58:11 +0100 |
parents | a5f65e8983be |
children | dbae69a57927 |
rev | line source |
---|---|
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.artifacts.model.minfo; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
2 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
3 import java.util.Date; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
4 import java.util.HashMap; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
5 import java.util.Map; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
6 |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
7 import org.apache.log4j.Logger; |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
8 import org.hibernate.SQLQuery; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
9 import org.hibernate.Session; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
10 import org.hibernate.transform.BasicTransformerAdapter; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
11 import org.hibernate.type.StandardBasicTypes; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
12 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
13 import de.intevation.flys.backend.SedDBSessionHolder; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
14 |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
15 |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
16 public class QualityMeasurementFactory { |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
17 |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
18 private static Logger logger = Logger.getLogger(QualityMeasurementFactory.class); |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
19 |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
20 private static final String SQL_BED_MEASUREMENT = |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
21 "SELECT st.km as km," + |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
22 " st.datum as datum," + |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
23 " sp.tiefevon as depth1," + |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
24 " sp.tiefebis as depth2," + |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
25 " sa.d10 as d10," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
26 " sa.d16 as d16," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
27 " sa.d20 as d20," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
28 " sa.d25 as d25," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
29 " sa.d30 as d30," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
30 " sa.d40 as d40," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
31 " sa.d50 as d50," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
32 " sa.d60 as d60," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
33 " sa.d70 as d70," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
34 " sa.d75 as d75," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
35 " sa.d80 as d80," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
36 " sa.d84 as d84," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
37 " sa.d90 as d90," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
38 " sa.dmin as dmin," + |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
39 " sa.dmax as dmax " + |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
40 "FROM sohltest st " + |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
41 " JOIN station sn ON sn.stationid = st.stationid " + |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
42 " JOIN gewaesser gw ON gw.gewaesserid = sn.gewaesserid " + |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
43 " JOIN sohlprobe sp ON sp.sohltestid = st.sohltestid " + |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
44 " JOIN siebanalyse sa ON sa.sohlprobeid = sp.sohlprobeid " + |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
45 "WHERE gw.name = :name AND " + |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
46 " st.km IS NOT NULL AND " + |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
47 " sp.tiefevon IS NOT NULL AND " + |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3769
diff
changeset
|
48 " sp.tiefebis IS NOT NULL AND " + // TODO: Test if char diameter ist null. |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
49 " st.km BETWEEN :from - 0.001 AND :to + 0.001 AND " + |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
50 " st.datum BETWEEN :start AND :end"; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
51 |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
52 private static final String SQL_BEDLOAD_MEASUREMENT = |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
53 "SELECT m.km as km," + |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
54 " m.datum as datum," + |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
55 " m.d10 as d10," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
56 " m.d16 as d16," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
57 " m.d20 as d20," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
58 " m.d25 as d25," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
59 " m.d30 as d30," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
60 " m.d40 as d40," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
61 " m.d50 as d50," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
62 " m.d60 as d60," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
63 " m.d70 as d70," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
64 " m.d75 as d75," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
65 " m.d80 as d80," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
66 " m.d84 as d84," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
67 " m.d90 as d90," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
68 " m.dmin as dmin," + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
69 " m.dmax as dmax " + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
70 "FROM messung m" + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
71 " JOIN station sn ON sn.stationid = m.stationid" + |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
72 " JOIN gewaesser gw ON gw.gewaesserid = sn.gewaesserid " + |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
73 "WHERE gw.name = :name AND " + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
74 " m.km IS NOT NULL AND " + |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3769
diff
changeset
|
75 " m.d10 IS NOT NULL AND" + //TODO: Add all other char. diameter. |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
76 " m.km BETWEEN :from - 0.001 AND :to + 0.001 AND" + |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
77 " m.datum BETWEEN :start AND :end"; |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
78 |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
79 public static final class QualityMeasurementResultTransformer |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
80 extends BasicTransformerAdapter { |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
81 |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
82 public static QualityMeasurementResultTransformer INSTANCE = new QualityMeasurementResultTransformer(); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
83 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
84 public QualityMeasurementResultTransformer() { |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
85 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
86 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
87 @Override |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
88 public Object transformTuple(Object[] tuple, String[] aliases) { |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
89 Map<String, Double> map = new HashMap<String, Double>(); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
90 double km = 0; |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
91 Date d = null; |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
92 double depth1 = Double.NaN; |
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
93 double depth2 = Double.NaN; |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
94 for (int i = 0; i < tuple.length; ++i) { |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
95 if (tuple[i] != null) { |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
96 if (aliases[i].equals("km")) { |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
97 km = ((Number) tuple[i]).doubleValue(); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
98 } |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
99 else if (aliases[i].equals("datum")) { |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
100 d = (Date) tuple[i]; |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
101 } |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
102 else if (aliases[i].equals("depth1")) { |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
103 depth1 = ((Number) tuple[i]).doubleValue(); |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
104 } |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
105 else if (aliases[i].equals("depth2")) { |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
106 depth2 = ((Number) tuple[i]).doubleValue(); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
107 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
108 else { |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
109 map.put(aliases[i], ((Double) tuple[i])/1000); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
110 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
111 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
112 } |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
113 return new QualityMeasurement(km, d, depth1, depth2, map); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
114 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
115 } // class BasicTransformerAdapter |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
116 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
117 private QualityMeasurementFactory() { |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
118 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
119 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
120 protected static QualityMeasurements load( |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
121 Session session, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
122 String river, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
123 double from, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
124 double to, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
125 Date start, |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
126 Date end, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
127 String statement |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
128 ) { |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
129 SQLQuery query = session.createSQLQuery(statement) |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
130 .addScalar("km", StandardBasicTypes.DOUBLE) |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
131 .addScalar("datum", StandardBasicTypes.DATE) |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
132 .addScalar("d10", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
133 .addScalar("d16", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
134 .addScalar("d20", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
135 .addScalar("d25", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
136 .addScalar("d30", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
137 .addScalar("d40", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
138 .addScalar("d50", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
139 .addScalar("d60", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
140 .addScalar("d70", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
141 .addScalar("d75", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
142 .addScalar("d80", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
143 .addScalar("d84", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
144 .addScalar("d90", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
145 .addScalar("dmin", StandardBasicTypes.DOUBLE) |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
146 .addScalar("dmax", StandardBasicTypes.DOUBLE); |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
147 |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
148 if (statement.equals(SQL_BED_MEASUREMENT)) { |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
149 query.addScalar("depth1", StandardBasicTypes.DOUBLE); |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
150 query.addScalar("depth2", StandardBasicTypes.DOUBLE); |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
151 } |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
152 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
153 query.setString("name", river); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
154 query.setDouble("from", from); |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
155 query.setDouble("to", to); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
156 query.setDate("start", start); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
157 query.setDate("end", end); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
158 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
159 query.setResultTransformer( |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
160 QualityMeasurementResultTransformer.INSTANCE); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
161 |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
162 return new QualityMeasurements(query.list()); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
163 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
164 |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
165 public static QualityMeasurements getBedMeasurements( |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
166 String river, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
167 double from, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
168 double to, |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
169 Date start, |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
170 Date end) { |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
171 Session session = SedDBSessionHolder.HOLDER.get(); |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
172 try { |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
173 return load(session, river, from, to, start, end, |
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
174 SQL_BED_MEASUREMENT); |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
175 } |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
176 finally { |
3769
728ecd2afa20
Implemented bed quality calculation in minfo module.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3758
diff
changeset
|
177 //session.close(); |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
178 } |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
179 } |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
180 |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
181 public static QualityMeasurements getBedloadMeasurements( |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
182 String river, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
183 double from, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
184 double to, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
185 Date start, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
186 Date end |
3758
75bc96dd9d82
Added depth parameter to bed quality data.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3756
diff
changeset
|
187 ) { |
3756
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
188 Session session = SedDBSessionHolder.HOLDER.get(); |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
189 try { |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
190 return load( |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
191 session, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
192 river, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
193 from, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
194 to, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
195 start, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
196 end, |
912a398968b6
The factory for minfo bed quality calculation can load bedload and bed data from seddb now.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
3755
diff
changeset
|
197 SQL_BEDLOAD_MEASUREMENT); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
198 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
199 finally { |
3785
a5f65e8983be
Merged revisions 5501-5502,5504-5508,5511-5513,5516-5519 via svnmerge from
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
3769
diff
changeset
|
200 //session.close(); |
3755
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
201 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
202 } |
9c555ce5ca50
Data objects and factory for minfo bedquality calculation.
Raimund Renkert <raimund.renkert@intevation.de>
parents:
diff
changeset
|
203 } |