# HG changeset patch # User Felix Wolfsteller # Date 1366807740 -7200 # Node ID 67e07c29dd29ef55fdeee73bbfab403c43689376 # Parent dba9e1fa233e7153ea7a57ed689e370b8ce418fe ImportTimeInterval: Verbosity increased and fixed bug in getPeer when stoptime is null. diff -r dba9e1fa233e -r 67e07c29dd29 flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java Wed Apr 24 12:07:03 2013 +0200 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportTimeInterval.java Wed Apr 24 14:49:00 2013 +0200 @@ -24,6 +24,7 @@ public ImportTimeInterval(Date startTime) { this.startTime = startTime; + this.stopTime = null; } public ImportTimeInterval(Date startTime, Date stopTime) { @@ -67,8 +68,19 @@ public TimeInterval getPeer() { if (peer == null) { Session session = ImporterSession.getInstance().getDatabaseSession(); - Query query = session.createQuery( - "from TimeInterval where startTime=:a and stopTime=:b"); + if (startTime == null) { + log.error("Null Start time will be ignored."); + } + Query query; + if (stopTime == null) { + query = session.createQuery( + "from TimeInterval where startTime=:a and stopTime is null"); + } + else { + query = session.createQuery( + "from TimeInterval where startTime=:a and stopTime=:b"); + query.setParameter("b", stopTime); + } query.setParameter("a", startTime); query.setParameter("b", stopTime); List intervals = query.list();