Modifier and Type | Field and Description |
---|---|
protected Map<Class<?>,Map<String,CachedDbEntity>> |
cachedEntites
The cache itself: maps entity types (classes) to maps indexed by id (primary key).
|
protected DbEntityCacheKeyMapping |
cacheKeyMapping |
Constructor and Description |
---|
DbEntityCache() |
DbEntityCache(DbEntityCacheKeyMapping cacheKeyMapping) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(DbEntity dbEntity)
Allows checking whether the provided entity is present in the cache
|
<T extends DbEntity> |
get(Class<T> type,
String id)
get an object from the cache
|
List<CachedDbEntity> |
getCachedEntities() |
CachedDbEntity |
getCachedEntity(Class<?> type,
String id)
Looks up an entity in the cache.
|
CachedDbEntity |
getCachedEntity(DbEntity dbEntity)
Looks up an entity in the cache.
|
<T extends DbEntity> |
getEntitiesByType(Class<T> type) |
boolean |
isDeleted(DbEntity dbEntity)
Allows checking whether the provided entity is present in the cache
and is marked to be deleted.
|
boolean |
isPersistent(DbEntity dbEntity)
Allows checking whether the provided entity is present in the cache
and is
DbEntityState.PERSISTENT . |
boolean |
isTransient(DbEntity dbEntity)
Allows checking whether the provided entity is present in the cache
and is
DbEntityState.TRANSIENT . |
protected void |
putInternal(CachedDbEntity entityToAdd) |
void |
putMerged(DbEntity e)
Put a
DbEntityState.MERGED object into the cache. |
void |
putPersistent(DbEntity e)
Put a
DbEntityState.PERSISTENT object into the cache. |
void |
putTransient(DbEntity e)
Put a new,
DbEntityState.TRANSIENT object into the cache. |
void |
remove(CachedDbEntity cachedDbEntity) |
boolean |
remove(DbEntity e)
Remove an entity from the cache
|
void |
setDeleted(DbEntity dbEntity)
Sets an object to a deleted state.
|
protected Map<Class<?>,Map<String,CachedDbEntity>> cachedEntites
protected DbEntityCacheKeyMapping cacheKeyMapping
public DbEntityCache()
public DbEntityCache(DbEntityCacheKeyMapping cacheKeyMapping)
public <T extends DbEntity> T get(Class<T> type, String id)
type
- the type of the objectid
- the id of the objectProcessEngineException
- if an object for the given id can be found but is of the wrong type.public CachedDbEntity getCachedEntity(Class<?> type, String id)
type
- the type of the objectid
- the id of the CachedEntity to lookuppublic CachedDbEntity getCachedEntity(DbEntity dbEntity)
dbEntity
- the entity for which the CachedEntity should be looked uppublic void putTransient(DbEntity e)
DbEntityState.TRANSIENT
object into the cache.e
- the object to put into the cachepublic void putPersistent(DbEntity e)
DbEntityState.PERSISTENT
object into the cache.e
- the object to put into the cachepublic void putMerged(DbEntity e)
DbEntityState.MERGED
object into the cache.e
- the object to put into the cacheprotected void putInternal(CachedDbEntity entityToAdd)
public boolean remove(DbEntity e)
e
- the entity to removepublic void remove(CachedDbEntity cachedDbEntity)
cachedDbEntity
- public boolean contains(DbEntity dbEntity)
dbEntity
- the entity to checkpublic boolean isPersistent(DbEntity dbEntity)
DbEntityState.PERSISTENT
.dbEntity
- the entity to checkDbEntityState.PERSISTENT
.public boolean isDeleted(DbEntity dbEntity)
dbEntity
- the entity to checkpublic boolean isTransient(DbEntity dbEntity)
DbEntityState.TRANSIENT
.dbEntity
- the entity to checkDbEntityState.TRANSIENT
.public List<CachedDbEntity> getCachedEntities()
public void setDeleted(DbEntity dbEntity)
dbEntity
- the object to mark deleted.Copyright © 2018. All rights reserved.