[Dive4elements-commits] [PATCH] Backend: Fixed indentation
Wald Commits
scm-commit at wald.intevation.org
Thu May 2 17:58:21 CEST 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1367510296 -7200
# Node ID a763fb7aa2e526e9a74e77a2ae52df10557809bc
# Parent 88fca576e9e62536c4995ce79393837516cddcaa
Backend: Fixed indentation.
diff -r 88fca576e9e6 -r a763fb7aa2e5 backend/src/main/java/org/dive4elements/river/importer/ImportDischargeTable.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportDischargeTable.java Thu May 02 17:55:01 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportDischargeTable.java Thu May 02 17:58:16 2013 +0200
@@ -76,41 +76,39 @@
this.timeInterval = timeInterval;
}
-
public DischargeTable getPeer(Gauge gauge) {
- if (peer == null) {
- TimeInterval ti = timeInterval != null
- ? timeInterval.getPeer()
- : null;
- Session session = ImporterSession.getInstance().getDatabaseSession();
-
- String timeIntervalQuery = ti != null
- ? "timeInterval=:interval"
- : "timeInterval is null";
-
- Query query = session.createQuery(
+ if (peer == null) {
+ TimeInterval ti = timeInterval != null
+ ? timeInterval.getPeer()
+ : null;
+ Session session = ImporterSession.getInstance().getDatabaseSession();
+
+ String timeIntervalQuery = ti != null
+ ? "timeInterval=:interval"
+ : "timeInterval is null";
+
+ Query query = session.createQuery(
"from DischargeTable where " +
"gauge.id=:gauge and kind=:kind and " +
"description=:description and " + timeIntervalQuery);
- query.setParameter("gauge", gauge.getId());
- query.setParameter("description", description);
- query.setParameter("kind", kind);
- if (ti != null) {
- query.setParameter("interval", ti);
- }
-
- List<DischargeTable> dischargeTables = query.list();
- if (dischargeTables.isEmpty()) {
- peer = new DischargeTable(gauge, description, null, kind, ti);
- session.save(peer);
- }
- else {
- peer = dischargeTables.get(0);
- }
- }
-
- return peer;
+ query.setParameter("gauge", gauge.getId());
+ query.setParameter("description", description);
+ query.setParameter("kind", kind);
+ if (ti != null) {
+ query.setParameter("interval", ti);
+ }
+
+ List<DischargeTable> dischargeTables = query.list();
+ if (dischargeTables.isEmpty()) {
+ peer = new DischargeTable(gauge, description, null, kind, ti);
+ session.save(peer);
+ }
+ else {
+ peer = dischargeTables.get(0);
+ }
+ }
+ return peer;
}
More information about the Dive4elements-commits
mailing list