Class DbOperationManager
- java.lang.Object
-
- org.camunda.bpm.engine.impl.db.entitymanager.operation.DbOperationManager
-
public class DbOperationManager extends Object
Manages a set ofdatabase operations
.- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<DbBulkOperation>
BULK_OPERATION_COMPARATOR
SortedMap<Class<?>,SortedSet<DbBulkOperation>>
bulkOperations
bulk modifications (DELETE, UPDATE) on an entity collectionLinkedHashSet<DbBulkOperation>
bulkOperationsInsertionOrder
bulk modifications (DELETE, UPDATE) for which order of execution is importantSortedMap<Class<?>,SortedSet<DbEntityOperation>>
deletes
DELETEs of a single entitystatic Comparator<DbEntityOperation>
INSERT_OPERATION_COMPARATOR
static Comparator<Class<?>>
INSERT_TYPE_COMPARATOR
SortedMap<Class<?>,SortedSet<DbEntityOperation>>
inserts
INSERTsstatic Comparator<DbEntityOperation>
MODIFICATION_OPERATION_COMPARATOR
static Comparator<Class<?>>
MODIFICATION_TYPE_COMPARATOR
SortedMap<Class<?>,SortedSet<DbEntityOperation>>
updates
UPDATEs of a single entity
-
Constructor Summary
Constructors Constructor Description DbOperationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
addOperation(DbBulkOperation newOperation)
boolean
addOperation(DbEntityOperation newOperation)
boolean
addOperationPreserveOrder(DbBulkOperation newOperation)
protected void
addSortedInserts(List<DbOperation> flush)
Adds the insert operations to the flush (in correct order).protected void
addSortedModifications(List<DbOperation> flush)
Adds a correctly ordered list of UPDATE and DELETE operations to the flush.protected void
addSortedModificationsForType(Class<?> type, SortedSet<DbEntityOperation> preSortedOperations, List<DbOperation> flush)
List<DbOperation>
calculateFlush()
protected void
determineDependencies(List<DbOperation> flush)
protected SortedSet<DbEntityOperation>
getDeletesByType(Class<? extends DbEntity> type, boolean create)
protected SortedSet<DbEntityOperation>
getInsertsForType(Class<? extends DbEntity> type, boolean create)
protected SortedSet<DbEntityOperation>
getUpdatesByType(Class<? extends DbEntity> type, boolean create)
protected List<DbEntityOperation>
sortByReferences(SortedSet<DbEntityOperation> preSorted)
Assumptions: a) all operations in the set work on entities such that the entities implementHasDbReferences
.
-
-
-
Field Detail
-
INSERT_TYPE_COMPARATOR
public static Comparator<Class<?>> INSERT_TYPE_COMPARATOR
-
MODIFICATION_TYPE_COMPARATOR
public static Comparator<Class<?>> MODIFICATION_TYPE_COMPARATOR
-
INSERT_OPERATION_COMPARATOR
public static Comparator<DbEntityOperation> INSERT_OPERATION_COMPARATOR
-
MODIFICATION_OPERATION_COMPARATOR
public static Comparator<DbEntityOperation> MODIFICATION_OPERATION_COMPARATOR
-
BULK_OPERATION_COMPARATOR
public static Comparator<DbBulkOperation> BULK_OPERATION_COMPARATOR
-
inserts
public SortedMap<Class<?>,SortedSet<DbEntityOperation>> inserts
INSERTs
-
updates
public SortedMap<Class<?>,SortedSet<DbEntityOperation>> updates
UPDATEs of a single entity
-
deletes
public SortedMap<Class<?>,SortedSet<DbEntityOperation>> deletes
DELETEs of a single entity
-
bulkOperations
public SortedMap<Class<?>,SortedSet<DbBulkOperation>> bulkOperations
bulk modifications (DELETE, UPDATE) on an entity collection
-
bulkOperationsInsertionOrder
public LinkedHashSet<DbBulkOperation> bulkOperationsInsertionOrder
bulk modifications (DELETE, UPDATE) for which order of execution is important
-
-
Method Detail
-
addOperation
public boolean addOperation(DbEntityOperation newOperation)
-
getDeletesByType
protected SortedSet<DbEntityOperation> getDeletesByType(Class<? extends DbEntity> type, boolean create)
-
getUpdatesByType
protected SortedSet<DbEntityOperation> getUpdatesByType(Class<? extends DbEntity> type, boolean create)
-
getInsertsForType
protected SortedSet<DbEntityOperation> getInsertsForType(Class<? extends DbEntity> type, boolean create)
-
addOperation
public boolean addOperation(DbBulkOperation newOperation)
-
addOperationPreserveOrder
public boolean addOperationPreserveOrder(DbBulkOperation newOperation)
-
calculateFlush
public List<DbOperation> calculateFlush()
-
addSortedInserts
protected void addSortedInserts(List<DbOperation> flush)
Adds the insert operations to the flush (in correct order).- Parameters:
operationsForFlush
-
-
addSortedModifications
protected void addSortedModifications(List<DbOperation> flush)
Adds a correctly ordered list of UPDATE and DELETE operations to the flush.- Parameters:
flush
-
-
addSortedModificationsForType
protected void addSortedModificationsForType(Class<?> type, SortedSet<DbEntityOperation> preSortedOperations, List<DbOperation> flush)
-
sortByReferences
protected List<DbEntityOperation> sortByReferences(SortedSet<DbEntityOperation> preSorted)
Assumptions: a) all operations in the set work on entities such that the entities implementHasDbReferences
. b) all operations in the set work on the same type (ie. all operations are INSERTs or DELETEs).
-
determineDependencies
protected void determineDependencies(List<DbOperation> flush)
-
-