Class EntityCacheImpl
- java.lang.Object
-
- org.activiti.engine.impl.persistence.cache.EntityCacheImpl
-
- All Implemented Interfaces:
Session,EntityCache
public class EntityCacheImpl extends java.lang.Object implements EntityCache
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,CachedEntity>>cachedObjects
-
Constructor Summary
Constructors Constructor Description EntityCacheImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcacheRemove(java.lang.Class<?> entityClass, java.lang.String entityId)Removes theEntityof the given type with the given id from the cache.voidclose()protected java.util.Map<java.lang.String,CachedEntity>findClassCacheByCheckingSubclasses(java.lang.Class<?> entityClass)<T> java.util.List<T>findInCache(java.lang.Class<T> entityClass)Returns all cachedEntityinstances of a given type.<T> TfindInCache(java.lang.Class<T> entityClass, java.lang.String id)Returns the cachedEntityinstance of the given class with the provided id.<T> java.util.Collection<CachedEntity>findInCacheAsCachedObjects(java.lang.Class<T> entityClass)Returns allCachedEntityinstances for the given type.voidflush()java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,CachedEntity>>getAllCachedEntities()Returns all cachedEntityinstances as a map with following structure: { entityClassName, {entityId, entity} }CachedEntityput(Entity entity, boolean storeState)Adds the givesEntityto the cache.
-
-
-
Field Detail
-
cachedObjects
protected java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,CachedEntity>> cachedObjects
-
-
Method Detail
-
put
public CachedEntity put(Entity entity, boolean storeState)
Description copied from interface:EntityCacheAdds the givesEntityto the cache.- Specified by:
putin interfaceEntityCache- Parameters:
entity- TheEntityinstancestoreState- If true, the current stateEntity.getPersistentState()will be stored for future diffing. Note that, if false, theEntitywill always be seen as changed.- Returns:
- Returns a
CachedEntityinstance, which can be enriched later on.
-
findInCache
public <T> T findInCache(java.lang.Class<T> entityClass, java.lang.String id)Description copied from interface:EntityCacheReturns the cachedEntityinstance of the given class with the provided id. Returns null if such aEntitycannot be found.- Specified by:
findInCachein interfaceEntityCache
-
findClassCacheByCheckingSubclasses
protected java.util.Map<java.lang.String,CachedEntity> findClassCacheByCheckingSubclasses(java.lang.Class<?> entityClass)
-
cacheRemove
public void cacheRemove(java.lang.Class<?> entityClass, java.lang.String entityId)Description copied from interface:EntityCacheRemoves theEntityof the given type with the given id from the cache.- Specified by:
cacheRemovein interfaceEntityCache
-
findInCacheAsCachedObjects
public <T> java.util.Collection<CachedEntity> findInCacheAsCachedObjects(java.lang.Class<T> entityClass)
Description copied from interface:EntityCacheReturns allCachedEntityinstances for the given type. The difference withEntityCache.findInCache(Class)is that here the wholeCachedEntityis returned, which gives access to the persistent state at the moment of putting it in the cache.- Specified by:
findInCacheAsCachedObjectsin interfaceEntityCache
-
findInCache
public <T> java.util.List<T> findInCache(java.lang.Class<T> entityClass)
Description copied from interface:EntityCacheReturns all cachedEntityinstances of a given type. Returns an empty list if no instances of the given type exist.- Specified by:
findInCachein interfaceEntityCache
-
getAllCachedEntities
public java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.String,CachedEntity>> getAllCachedEntities()
Description copied from interface:EntityCacheReturns all cachedEntityinstances as a map with following structure: { entityClassName, {entityId, entity} }- Specified by:
getAllCachedEntitiesin interfaceEntityCache
-
-