Mercurial > dive4elements > river
annotate artifacts/src/main/java/org/dive4elements/river/artifacts/model/fixings/FixingsColumnFactory.java @ 9415:9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
The facets also put the valid station range into their xml-metadata
author | gernotbelger |
---|---|
date | Thu, 16 Aug 2018 16:27:53 +0200 |
parents | artifacts/src/main/java/org/dive4elements/river/artifacts/model/FixingsColumnFactory.java@af13ceeba52a |
children |
rev | line source |
---|---|
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
1 /* Copyright (C) 2011, 2012, 2013 by Bundesanstalt für Gewässerkunde |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
2 * Software engineering by Intevation GmbH |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
3 * |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
4 * This file is Free Software under the GNU AGPL (>=v3) |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
5 * and comes with ABSOLUTELY NO WARRANTY! Check out the |
5994
af13ceeba52a
Removed trailing whitespace.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5863
diff
changeset
|
6 * documentation coming with Dive4Elements River for details. |
5863
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
7 */ |
4897a58c8746
River artifacts: Added new copyright headers.
Sascha L. Teichmann <teichmann@intevation.de>
parents:
5838
diff
changeset
|
8 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
9 package org.dive4elements.river.artifacts.model.fixings; |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
10 |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2729
diff
changeset
|
11 import org.dive4elements.river.artifacts.cache.CacheFactory; |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
12 import org.dive4elements.river.artifacts.model.QRangeTree; |
5831
bd047b71ab37
Repaired internal references
Sascha L. Teichmann <teichmann@intevation.de>
parents:
2729
diff
changeset
|
13 import org.dive4elements.river.backend.SessionHolder; |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
14 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
15 import java.util.List; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
16 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
17 import net.sf.ehcache.Cache; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
18 import net.sf.ehcache.Element; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
19 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
20 import org.hibernate.Session; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
21 import org.hibernate.SQLQuery; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
22 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
23 import org.hibernate.type.StandardBasicTypes; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
24 |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
25 import org.apache.log4j.Logger; |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
26 |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
27 public class FixingsColumnFactory |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
28 { |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
29 private static Logger log = Logger.getLogger(FixingsColumnFactory.class); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
30 |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
31 public static final String CACHE_NAME = "fixings-columns"; |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
32 |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
33 public static final String SQL_COLUMN_WS = |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
34 "SELECT wcv.position AS km, wcv.w AS w " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
35 "FROM wst_column_values wcv " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
36 "WHERE wst_column_id = :column_id " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
37 "ORDER by wcv.position"; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
38 |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
39 public static final String SQL_COLUMN_QS = |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
40 "SELECT wqr.q AS q, r.a AS a, r.b AS b " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
41 "FROM wst_column_q_ranges wcqr " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
42 "JOIN wst_q_ranges wqr ON wcqr.wst_q_range_id = wqr.id " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
43 "JOIN ranges r ON wqr.range_id = r.id " + |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
44 "WHERE wcqr.wst_column_id = :column_id ORDER by r.a"; |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
45 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
46 public static final FixingsColumnFactory INSTANCE = |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
47 new FixingsColumnFactory(); |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
48 |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
49 private FixingsColumnFactory() { |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
50 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
51 |
2729
a441be7f1589
Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2622
diff
changeset
|
52 public static FixingsColumnFactory getInstance() { |
a441be7f1589
Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2622
diff
changeset
|
53 return INSTANCE; |
a441be7f1589
Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2622
diff
changeset
|
54 } |
a441be7f1589
Added Fix calculation.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2622
diff
changeset
|
55 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
56 public FixingColumnData getColumnData(FixingColumn column) { |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
57 |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
58 boolean debug = log.isDebugEnabled(); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
59 |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
60 if (debug) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
61 log.debug("FixingsColumnFactory.getColumnData"); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
62 } |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
63 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
64 Cache cache = CacheFactory.getCache(CACHE_NAME); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
65 |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
66 if (cache == null) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
67 if (debug) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
68 log.debug("Cache unconfigured."); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
69 } |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
70 return getUncached(column); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
71 } |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
72 |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
73 Integer cacheKey = Integer.valueOf(column.getId()); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
74 Element element = cache.get(cacheKey); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
75 |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
76 if (element != null) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
77 if (debug) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
78 log.debug("Column " + cacheKey + " found in cache."); |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
79 } |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
80 return (FixingColumnData)element.getValue(); |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
81 } |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
82 else { |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
83 FixingColumnData result = getUncached(column); |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
84 if (result != null) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
85 if (debug) { |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
86 log.debug("Store column " + cacheKey + " into cache."); |
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
87 } |
2620
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
88 cache.put(new Element(cacheKey, result)); |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
89 } |
2622
8bc1e1cb7f7b
Fixed the fixings columns caching problem.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2620
diff
changeset
|
90 return result; |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
91 } |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
92 } |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
93 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
94 protected FixingColumnData getUncached(FixingColumn column) { |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
95 Session session = SessionHolder.HOLDER.get(); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
96 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
97 SQLQuery sqlQuery = session.createSQLQuery(SQL_COLUMN_WS) |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
98 .addScalar("km", StandardBasicTypes.DOUBLE) |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
99 .addScalar("w", StandardBasicTypes.DOUBLE); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
100 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
101 sqlQuery.setInteger("column_id", column.getId()); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
102 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
103 List<Object []> results = sqlQuery.list(); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
104 |
2620
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
105 if (results.isEmpty()) { |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
106 return null; |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
107 } |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
108 |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
109 double [] kms = new double[results.size()]; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
110 double [] ws = new double[kms.length]; |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
111 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
112 for (int i = 0; i < kms.length; ++i) { |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
113 Object [] row = results.get(i); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
114 kms[i] = ((Double)row[0]).doubleValue(); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
115 ws [i] = ((Double)row[1]).doubleValue(); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
116 } |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
117 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
118 sqlQuery = session.createSQLQuery(SQL_COLUMN_QS) |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
119 .addScalar("q", StandardBasicTypes.DOUBLE) |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
120 .addScalar("a", StandardBasicTypes.DOUBLE) |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
121 .addScalar("b", StandardBasicTypes.DOUBLE); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
122 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
123 sqlQuery.setInteger("column_id", column.getId()); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
124 |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
125 results = sqlQuery.list(); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
126 |
2620
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
127 if (results.isEmpty()) { |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
128 return null; |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
129 } |
cc0fa1798a3c
FixingsKMChartService: Generate chart and deliver the image as the response of the service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2619
diff
changeset
|
130 |
2619
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
131 QRangeTree qs = new QRangeTree( |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
132 results, QRangeTree.WITHOUT_COLUMN, 0, results.size()); |
6ed24efc80de
Loaded columns of fixings from database and store them into the cache.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
2615
diff
changeset
|
133 |
9415
9744ce3c3853
Rework of fixanalysis computation and dWt and WQ facets. Got rid of strange remapping and bitshifting code by explicitely saving the column information and using it in the facets.
gernotbelger
parents:
5994
diff
changeset
|
134 return new FixingColumnData(kms, ws, qs); |
2615
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
135 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
136 } |
b0597a63fe70
More code for the fixings km chart service.
Sascha L. Teichmann <sascha.teichmann@intevation.de>
parents:
diff
changeset
|
137 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |