Class AbstractDataManager<EntityImpl extends Entity>
- java.lang.Object
-
- org.flowable.common.engine.impl.db.AbstractDataManager<EntityImpl>
-
- All Implemented Interfaces:
DataManager<EntityImpl>
- Direct Known Subclasses:
MybatisByteArrayDataManager,MybatisPropertyDataManager
public abstract class AbstractDataManager<EntityImpl extends Entity> extends Object implements DataManager<EntityImpl>
- Author:
- Joram Barrez, Tijs Rademakers
-
-
Field Summary
Fields Modifier and Type Field Description static intMAX_ENTRIES_IN_CLAUSE
-
Constructor Summary
Constructors Constructor Description AbstractDataManager()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidbulkDelete(String statement, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, Object parameter)Does a bulk delete, but also uses the providedCachedEntityMatcherto look in the cache to mark the cached entities as deleted.protected voidbulkDeleteEntities(String statement, List<EntityImpl> entities)protected voidbulkUpdateEntities(String statement, Map<String,Object> parameters, String collectionNameInSqlStatement, List<EntityImpl> entities)protected List<List<String>>createSafeInValuesList(Collection<String> values)voiddelete(EntityImpl entity)voiddelete(String id)protected voiddeleteCachedEntities(DbSqlSession dbSqlSession, Collection<CachedEntity> cachedObjects, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, Object parameter)protected voiddeleteCachedEntities(DbSqlSession dbSqlSession, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, Object parameter)protected voidexecuteChangeWithInClause(List<EntityImpl> entities, Consumer<List<EntityImpl>> consumer)EntityImplfindById(String entityId)protected EntityImplfindByQuery(String selectQuery, Object parameter)protected CommandContextgetCommandContext()protected DbSqlSessiongetDbSqlSession()protected EntityImplgetEntity(String selectQuery, Object parameter, SingleCachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkDatabase)protected EntityCachegetEntityCache()protected abstract IdGeneratorgetIdGenerator()protected List<EntityImpl>getList(String dbQueryName, Object parameter)protected List<EntityImpl>getList(String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher)protected List<EntityImpl>getList(String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache)Gets a list by querying the database and the cache usingCachedEntityMatcher.protected List<EntityImpl>getList(DbSqlSession dbSqlSession, String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache)protected List<EntityImpl>getList(DbSqlSession dbSqlSession, String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache, boolean includeDeleted)protected List<EntityImpl>getListFromCache(CachedEntityMatcher<EntityImpl> entityMatcher, Object parameter)protected List<EntityImpl>getListFromCache(CachedEntityMatcher<EntityImpl> entityMatcher, Object parameter, boolean includeDeletedEntities)abstract Class<? extends EntityImpl>getManagedEntityClass()List<Class<? extends EntityImpl>>getManagedEntitySubClasses()protected <T> TgetSession(Class<T> sessionClass)voidinsert(EntityImpl entity)protected booleanisEntityInserted(DbSqlSession dbSqlSession, String entityLogicalName, String entityId)EntityImplupdate(EntityImpl entity)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.flowable.common.engine.impl.persistence.entity.data.DataManager
create
-
-
-
-
Field Detail
-
MAX_ENTRIES_IN_CLAUSE
public static final int MAX_ENTRIES_IN_CLAUSE
- See Also:
- Constant Field Values
-
-
Method Detail
-
getManagedEntityClass
public abstract Class<? extends EntityImpl> getManagedEntityClass()
-
getManagedEntitySubClasses
public List<Class<? extends EntityImpl>> getManagedEntitySubClasses()
-
getCommandContext
protected CommandContext getCommandContext()
-
getSession
protected <T> T getSession(Class<T> sessionClass)
-
getDbSqlSession
protected DbSqlSession getDbSqlSession()
-
getEntityCache
protected EntityCache getEntityCache()
-
findById
public EntityImpl findById(String entityId)
- Specified by:
findByIdin interfaceDataManager<EntityImpl extends Entity>
-
insert
public void insert(EntityImpl entity)
- Specified by:
insertin interfaceDataManager<EntityImpl extends Entity>
-
update
public EntityImpl update(EntityImpl entity)
- Specified by:
updatein interfaceDataManager<EntityImpl extends Entity>
-
delete
public void delete(String id)
- Specified by:
deletein interfaceDataManager<EntityImpl extends Entity>
-
delete
public void delete(EntityImpl entity)
- Specified by:
deletein interfaceDataManager<EntityImpl extends Entity>
-
findByQuery
protected EntityImpl findByQuery(String selectQuery, Object parameter)
-
getList
protected List<EntityImpl> getList(String dbQueryName, Object parameter)
-
getEntity
protected EntityImpl getEntity(String selectQuery, Object parameter, SingleCachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkDatabase)
-
getList
protected List<EntityImpl> getList(String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher)
-
getList
protected List<EntityImpl> getList(String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache)
Gets a list by querying the database and the cache usingCachedEntityMatcher. First, the entities are fetched from the database using the provided query. The cache is then queried for the entities of the same type. If an entity matches theCachedEntityMatchercondition, it replaces the entity from the database (as it is newer).- Parameters:
dbQueryName- The query name that needs to be executed.parameter- The parameters for the query.cachedEntityMatcher- The matcher used to determine which entities from the cache needs to be retainedcheckCache- If false, no cache check will be done, and the returned list will simply be the list from the database.
-
getList
protected List<EntityImpl> getList(DbSqlSession dbSqlSession, String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache)
-
getList
protected List<EntityImpl> getList(DbSqlSession dbSqlSession, String dbQueryName, Object parameter, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache, boolean includeDeleted)
-
getListFromCache
protected List<EntityImpl> getListFromCache(CachedEntityMatcher<EntityImpl> entityMatcher, Object parameter)
-
getListFromCache
protected List<EntityImpl> getListFromCache(CachedEntityMatcher<EntityImpl> entityMatcher, Object parameter, boolean includeDeletedEntities)
-
bulkDelete
public void bulkDelete(String statement, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, Object parameter)
Does a bulk delete, but also uses the providedCachedEntityMatcherto look in the cache to mark the cached entities as deleted. (This is necessary if entities are inserted and deleted in the same operation).
-
deleteCachedEntities
protected void deleteCachedEntities(DbSqlSession dbSqlSession, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, Object parameter)
-
deleteCachedEntities
protected void deleteCachedEntities(DbSqlSession dbSqlSession, Collection<CachedEntity> cachedObjects, CachedEntityMatcher<EntityImpl> cachedEntityMatcher, Object parameter)
-
createSafeInValuesList
protected List<List<String>> createSafeInValuesList(Collection<String> values)
-
executeChangeWithInClause
protected void executeChangeWithInClause(List<EntityImpl> entities, Consumer<List<EntityImpl>> consumer)
-
bulkDeleteEntities
protected void bulkDeleteEntities(String statement, List<EntityImpl> entities)
-
bulkUpdateEntities
protected void bulkUpdateEntities(String statement, Map<String,Object> parameters, String collectionNameInSqlStatement, List<EntityImpl> entities)
-
isEntityInserted
protected boolean isEntityInserted(DbSqlSession dbSqlSession, String entityLogicalName, String entityId)
-
getIdGenerator
protected abstract IdGenerator getIdGenerator()
-
-