Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java @ 8412:17db08570637
SCHEMA CHANGE: removed superfluous columns station and river_id from measurement_stations and adapted other components accordingly.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 15 Oct 2014 19:20:26 +0200 |
parents | 4c3ccf2b0304 |
children | bfca77cbf353 |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java Wed Oct 15 14:58:46 2014 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java Wed Oct 15 19:20:26 2014 +0200 @@ -31,8 +31,7 @@ private SQRelationValue peer; private String parameter; - - private Double km; + private MeasurementStation station; private Double a; private Double b; private Double qMax; @@ -45,7 +44,7 @@ public ImportSQRelationValue( String parameter, - Double km, + MeasurementStation station, Double a, Double b, Double qMax, @@ -56,7 +55,7 @@ Double cDuan ) { this.parameter = parameter; - this.km = km; + this.station = station; this.a = a; this.b = b; this.qMax = qMax; @@ -78,20 +77,6 @@ public SQRelationValue getPeer(SQRelation owner) { if (peer == null) { Session session = ImporterSession.getInstance().getDatabaseSession(); - - Query query = session.createQuery( - "from MeasurementStation " + - " where station between :kml and :kmh"); - query.setDouble("kml", km - 1e-4); - query.setDouble("kmh", km + 1e-4); - - List<MeasurementStation> result = query.list(); - - if (result.isEmpty()) { - log.error("No measurement stations found at km " + km); - return null; - } - Query query2 = session.createQuery( "from SQRelationValue " + " where sqRelation=:owner " + @@ -106,7 +91,7 @@ query2.setParameter("owner", owner); query2.setString("parameter", parameter); - query2.setParameter("measurementStation", result.get(0)); + query2.setParameter("measurementStation", station); query2.setBigDecimal("a", toBigDecimal(a)); query2.setBigDecimal("b", toBigDecimal(b)); query2.setBigDecimal("qMax", toBigDecimal(qMax)); @@ -120,7 +105,7 @@ peer = new SQRelationValue( owner, parameter, - result.get(0), + station, a, b, qMax,