Mercurial > dive4elements > river
comparison artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/FlowVelocityMeasurementFactory.java @ 6944:602dac32a996
issue957: Better name for flowvelocity measured values facets.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Thu, 29 Aug 2013 16:33:43 +0200 |
parents | af13ceeba52a |
children | 735346b3e438 |
comparison
equal
deleted
inserted
replaced
6943:61128e4b6f46 | 6944:602dac32a996 |
---|---|
6 * documentation coming with Dive4Elements River for details. | 6 * documentation coming with Dive4Elements River for details. |
7 */ | 7 */ |
8 | 8 |
9 package org.dive4elements.river.artifacts.model.minfo; | 9 package org.dive4elements.river.artifacts.model.minfo; |
10 | 10 |
11 import java.util.Date; | |
11 import java.util.List; | 12 import java.util.List; |
12 | 13 |
13 import org.apache.log4j.Logger; | 14 import org.apache.log4j.Logger; |
14 import org.hibernate.SQLQuery; | 15 import org.hibernate.SQLQuery; |
15 import org.hibernate.Session; | 16 import org.hibernate.Session; |
17 | |
18 import org.hibernate.type.StandardBasicTypes; | |
16 | 19 |
17 import org.dive4elements.river.model.FlowVelocityMeasurementValue; | 20 import org.dive4elements.river.model.FlowVelocityMeasurementValue; |
18 import org.dive4elements.river.backend.SessionHolder; | 21 import org.dive4elements.river.backend.SessionHolder; |
19 | 22 |
20 | 23 |
38 getFlowVelocityMeasurement(int id) | 41 getFlowVelocityMeasurement(int id) |
39 { | 42 { |
40 log.debug("FlowVelocityMeasurementFactory.getFlowVelocityMeasurementValue"); | 43 log.debug("FlowVelocityMeasurementFactory.getFlowVelocityMeasurementValue"); |
41 Session session = SessionHolder.HOLDER.get(); | 44 Session session = SessionHolder.HOLDER.get(); |
42 SQLQuery sqlQuery = null; | 45 SQLQuery sqlQuery = null; |
43 sqlQuery = session.createSQLQuery(SQL_SELECT_ONE); | 46 sqlQuery = session.createSQLQuery(SQL_SELECT_ONE) |
47 .addScalar("station", StandardBasicTypes.DOUBLE) | |
48 .addScalar("datetime", StandardBasicTypes.DATE) | |
49 .addScalar("w", StandardBasicTypes.DOUBLE) | |
50 .addScalar("q", StandardBasicTypes.DOUBLE) | |
51 .addScalar("v", StandardBasicTypes.DOUBLE) | |
52 .addScalar("description", StandardBasicTypes.STRING); | |
44 sqlQuery.setParameter("id", id); | 53 sqlQuery.setParameter("id", id); |
45 | 54 |
46 List<Object []> results = sqlQuery.list(); | 55 List<Object []> results = sqlQuery.list(); |
47 if (results.size() > 0) { | 56 if (results.size() > 0) { |
48 Object[] row = results.get(0); | 57 Object[] row = results.get(0); |
51 } | 60 } |
52 return FlowVelocityMeasurementValue.getUnmapped( | 61 return FlowVelocityMeasurementValue.getUnmapped( |
53 Double.parseDouble(row[0].toString()), | 62 Double.parseDouble(row[0].toString()), |
54 Double.parseDouble(row[2].toString()), | 63 Double.parseDouble(row[2].toString()), |
55 Double.valueOf(row[3].toString()), | 64 Double.valueOf(row[3].toString()), |
56 Double.valueOf(row[4].toString()), null, row[5].toString()); | 65 Double.valueOf(row[4].toString()), (Date) row[1], row[5].toString()); |
57 } | 66 } |
58 return null; | 67 return null; |
59 } | 68 } |
60 } | 69 } |
61 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : | 70 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 : |