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).
|
Constructor and Description |
---|
DbEntityCache() |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(PersistentObject persistentObject)
Allows checking whether the provided entity is present in the cache
|
<T extends PersistentObject> |
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(PersistentObject persistentObject)
Looks up an entity in the cache.
|
<T extends PersistentObject> |
getEntitiesByType(Class<T> type) |
boolean |
isDeleted(PersistentObject persistentObject)
Allows checking whether the provided entity is present in the cache
and is marked to be deleted.
|
boolean |
isPersistent(PersistentObject persistentObject)
Allows checking whether the provided entity is present in the cache
and is
DbEntityState.PERSISTENT . |
boolean |
isTransient(PersistentObject persistentObject)
Allows checking whether the provided entity is present in the cache
and is
DbEntityState.TRANSIENT . |
protected void |
putInternal(CachedDbEntity entityToAdd) |
void |
putMerged(PersistentObject e)
Put a
DbEntityState.MERGED object into the cache. |
void |
putPersistent(PersistentObject e)
Put a
DbEntityState.PERSISTENT object into the cache. |
void |
putTransient(PersistentObject e)
Put a new,
DbEntityState.TRANSIENT object into the cache. |
void |
remove(CachedDbEntity cachedDbEntity) |
boolean |
remove(PersistentObject e)
Remove an entity from the cache
|
void |
setDeleted(PersistentObject persistentObject)
Sets an object to a deleted state.
|
protected Map<Class<?>,Map<String,CachedDbEntity>> cachedEntites
public <T extends PersistentObject> 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 <T extends PersistentObject> List<T> getEntitiesByType(Class<T> type)
public CachedDbEntity getCachedEntity(Class<?> type, String id)
type
- the type of the objectid
- the id of the CachedEntity to lookuppublic CachedDbEntity getCachedEntity(PersistentObject persistentObject)
persistentObject
- the entity for which the CachedEntity should be looked uppublic void putTransient(PersistentObject e)
DbEntityState.TRANSIENT
object into the cache.e
- the object to put into the cachepublic void putPersistent(PersistentObject e)
DbEntityState.PERSISTENT
object into the cache.e
- the object to put into the cachepublic void putMerged(PersistentObject e)
DbEntityState.MERGED
object into the cache.e
- the object to put into the cacheprotected void putInternal(CachedDbEntity entityToAdd)
public boolean remove(PersistentObject e)
e
- the entity to removepublic void remove(CachedDbEntity cachedDbEntity)
cachedDbEntity
- public boolean contains(PersistentObject persistentObject)
persistentObject
- the entity to checkpublic boolean isPersistent(PersistentObject persistentObject)
DbEntityState.PERSISTENT
.persistentObject
- the entity to checkDbEntityState.PERSISTENT
.public boolean isDeleted(PersistentObject persistentObject)
persistentObject
- the entity to checkpublic boolean isTransient(PersistentObject persistentObject)
DbEntityState.TRANSIENT
.persistentObject
- the entity to checkDbEntityState.TRANSIENT
.public List<CachedDbEntity> getCachedEntities()
public void setDeleted(PersistentObject persistentObject)
persistentObject
- the object to mark deleted.Copyright © 2015. All rights reserved.