#5161 Initialize listeners on cdm entities before put in cache
authorCherian Mathew <c.mathew@bgbm.org>
Thu, 27 Aug 2015 14:11:39 +0000 (16:11 +0200)
committerCherian Mathew <c.mathew@bgbm.org>
Thu, 27 Aug 2015 14:12:42 +0000 (16:12 +0200)
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CacheLoader.java
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java

index ba31ba338cd0478f7148b4e04272517e1e17c5d7..526e990e46779b5b09ec00a261e668b6225acc69 100644 (file)
@@ -22,6 +22,7 @@ import net.sf.ehcache.Element;
 import org.apache.log4j.Logger;
 import org.springframework.util.ReflectionUtils;
 
 import org.apache.log4j.Logger;
 import org.springframework.util.ReflectionUtils;
 
+import eu.etaxonomy.cdm.api.service.pager.Pager;
 import eu.etaxonomy.cdm.model.ICdmCacher;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 
 import eu.etaxonomy.cdm.model.ICdmCacher;
 import eu.etaxonomy.cdm.model.common.CdmBase;
 
@@ -68,6 +69,9 @@ public class CacheLoader {
             return (T) load((Map<T,T>)obj, recursive, update);
         } else if (obj instanceof Collection) {
             return (T) load((Collection<T>)obj, recursive, update);
             return (T) load((Map<T,T>)obj, recursive, update);
         } else if (obj instanceof Collection) {
             return (T) load((Collection<T>)obj, recursive, update);
+        } else if(obj instanceof Pager) {
+             load(((Pager)obj).getRecords(), recursive, update);
+             return obj;
         }
 
         return obj;
         }
 
         return obj;
index 9bc131ea3743f996b57f55fe16dc9c2358e9797e..167300f3d81e23a110717d1fb7a125cc8e539f06 100644 (file)
@@ -201,6 +201,7 @@ public class CdmTransientEntityCacher implements ICdmCacher {
         cachedCdmEntity = getFromCache(id);
         if(cachedCdmEntity == null) {
             getCache().put(new Element(id, cdmEntity));
         cachedCdmEntity = getFromCache(id);
         if(cachedCdmEntity == null) {
             getCache().put(new Element(id, cdmEntity));
+            cdmEntity.initListener();
             logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " put in cache");
             return;
         }
             logger.info(" - object of type " + cdmEntity.getClass().getName() + " with id " + cdmEntity.getId() + " put in cache");
             return;
         }