diff artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java @ 8033:5e3f4b4fcb28

New way to loaded sediment loads from database and cache it. The data structure a way more straight forward. TODO: Implement calculation on this basis.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 15 Jul 2014 12:47:52 +0200
parents 963ede7b32bb
children 5f28aa1be795
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Mon Jul 14 15:36:44 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentLoadFactory.java	Tue Jul 15 12:47:52 2014 +0200
@@ -243,7 +243,7 @@
         SedimentLoadLSData[] values =
             getSedimentLoadsUncached(river, type, startKm, endKm);
 
-        if (values != null && key != null) {
+        if (values != null) {
             log.debug("Store static sediment load values in cache.");
             element = new Element(key, values);
             cache.put(element);
@@ -296,7 +296,7 @@
             syear,
             eyear);
 
-        if (values != null && key != null) {
+        if (values != null) {
             log.debug("Store sediment loads in cache.");
             element = new Element(key, values);
             cache.put(element);
@@ -316,7 +316,7 @@
         SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_SINGLE_TIMES_BY_ID)
                 .addScalar("starttime", StandardBasicTypes.DATE)
                 .addScalar("stoptime", StandardBasicTypes.DATE);
-        sqlQuery.setDouble("id", id);
+        sqlQuery.setInteger("id", id);
 
         List<Object[]> results = sqlQuery.list();
         Object[] row = results.get(0);

http://dive4elements.wald.intevation.org