diff flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTableFactory.java @ 632:07640ab913fd

First part of storing qs in ranges flys-artifacts/trunk@1997 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 24 May 2011 14:46:45 +0000
parents e3ee131d5dd3
children d08f77e7f7e8
line wrap: on
line diff
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTableFactory.java	Tue May 24 13:24:24 2011 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WstValueTableFactory.java	Tue May 24 14:46:45 2011 +0000
@@ -28,8 +28,6 @@
 {
     private static Logger log = Logger.getLogger(WstValueTableFactory.class);
 
-    public static final String CACHE_NAME = "wst-value-table";
-
     // TODO: put this into a property file
     public static final String SQL_POS_WQ = 
         "SELECT position, w, q, column_pos" +
@@ -45,7 +43,7 @@
 
     public static WstValueTable getTable(River river, int kind) {
 
-        Cache cache = CacheFactory.getCache(CACHE_NAME);
+        Cache cache = CacheFactory.getCache(WstValueTableCacheKey.CACHE_NAME);
 
         WstValueTableCacheKey cacheKey;
 
@@ -63,7 +61,7 @@
 
         WstValueTable valueTable = getTableUncached(river, kind);
 
-        if (cacheKey != null) {
+        if (valueTable != null && cacheKey != null) {
             log.debug("store wst value table in cache");
             Element element = new Element(cacheKey, valueTable);
             cache.put(element);

http://dive4elements.wald.intevation.org