changeset 305:91c37bf28c0e

Remove chart from cache when data which is displayed in chart has changed. gnv-artifacts/trunk@363 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Mon, 23 Nov 2009 17:20:14 +0000
parents a16d337c5678
children e7f1c79bf9cd
files gnv-artifacts/ChangeLog gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java
diffstat 2 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/gnv-artifacts/ChangeLog	Mon Nov 23 17:01:28 2009 +0000
+++ b/gnv-artifacts/ChangeLog	Mon Nov 23 17:20:14 2009 +0000
@@ -1,3 +1,8 @@
+2009-11-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
+
+	* src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java:
+	  Remove chart from cache when data which is displayed has changed.
+
 2009-11-23  Ingo Weinzierl <ingo.weinzierl@intevation.de>
 
 	* doc/conf/charttemplate.xml: Added configuration file for chart themes.
--- a/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java	Mon Nov 23 17:01:28 2009 +0000
+++ b/gnv-artifacts/src/main/java/de/intevation/gnv/transition/OutputTransitionBase.java	Mon Nov 23 17:20:14 2009 +0000
@@ -197,6 +197,18 @@
         }
     }
 
+    protected void removeChart(String uuid) {
+        log.debug("OutputTransitionBase.removeChart from cache");
+
+        CacheFactory cacheFactory = CacheFactory.getInstance();
+        if (cacheFactory.isInitialized()) {
+            String key = "chart_" + uuid + super.getID();
+            net.sf.ehcache.Element object = cacheFactory.getCache().get(key);
+            if (object != null)
+                cacheFactory.getCache().remove(key);
+        }
+    }
+
     /**
      * @see de.intevation.gnv.transition.TransitionBase#purifyResult(java.util.Collection,
      *      java.lang.String)
@@ -230,6 +242,7 @@
                                          throws TransitionException {
         log.debug("OutputTransitionBase.putInputData");
         this.removeChartResult(uuid);
+        this.removeChart(uuid);
         super.putInputData(inputData, uuid);
     }
 

http://dive4elements.wald.intevation.org