Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java @ 8691:bfca77cbf353
(issue1750) There can be only one SQ-relation of a parameter for a time range (given by sq_relation_id) per station and some other attributes might be null.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 17 Apr 2015 14:55:42 +0200 |
parents | 17db08570637 |
children | 5e38e2924c07 |
comparison
equal
deleted
inserted
replaced
8690:11c88a2f695a | 8691:bfca77cbf353 |
---|---|
75 | 75 |
76 | 76 |
77 public SQRelationValue getPeer(SQRelation owner) { | 77 public SQRelationValue getPeer(SQRelation owner) { |
78 if (peer == null) { | 78 if (peer == null) { |
79 Session session = ImporterSession.getInstance().getDatabaseSession(); | 79 Session session = ImporterSession.getInstance().getDatabaseSession(); |
80 Query query2 = session.createQuery( | 80 Query query = session.createQuery( |
81 "from SQRelationValue " + | 81 "from SQRelationValue " + |
82 " where sqRelation=:owner " + | 82 " where sqRelation=:owner " + |
83 " and parameter=:parameter" + | |
84 " and measurementStation=:measurementStation" + | 83 " and measurementStation=:measurementStation" + |
85 " and a=:a" + | 84 " and parameter=:parameter"); |
86 " and b=:b" + | |
87 " and qMax=:qMax" + | |
88 " and rSQ=:rSQ" + | |
89 " and cFerguson=:cFerguson" + | |
90 " and cDuan=:cDuan"); | |
91 | 85 |
92 query2.setParameter("owner", owner); | 86 query.setParameter("owner", owner); |
93 query2.setString("parameter", parameter); | 87 query.setParameter("measurementStation", station); |
94 query2.setParameter("measurementStation", station); | 88 query.setString("parameter", parameter); |
95 query2.setBigDecimal("a", toBigDecimal(a)); | |
96 query2.setBigDecimal("b", toBigDecimal(b)); | |
97 query2.setBigDecimal("qMax", toBigDecimal(qMax)); | |
98 query2.setBigDecimal("rSQ", toBigDecimal(rSQ)); | |
99 query2.setBigDecimal("cFerguson", toBigDecimal(cFerguson)); | |
100 query2.setBigDecimal("cDuan", toBigDecimal(cDuan)); | |
101 | 89 |
102 List<SQRelationValue> values = query2.list(); | 90 List<SQRelationValue> values = query.list(); |
103 | 91 |
104 if (values.isEmpty()) { | 92 if (values.isEmpty()) { |
105 peer = new SQRelationValue( | 93 peer = new SQRelationValue( |
106 owner, | 94 owner, |
107 parameter, | 95 parameter, |