Class DbOperationManager
- java.lang.Object
-
- org.camunda.bpm.engine.impl.db.entitymanager.operation.DbOperationManager
-
public class DbOperationManager extends java.lang.ObjectManages a set ofdatabase operations.- Author:
- Daniel Meyer
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.Comparator<DbBulkOperation>BULK_OPERATION_COMPARATORjava.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbBulkOperation>>bulkOperationsbulk modifications (DELETE, UPDATE) on an entity collectionjava.util.LinkedHashSet<DbBulkOperation>bulkOperationsInsertionOrderbulk modifications (DELETE, UPDATE) for which order of execution is importantjava.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbEntityOperation>>deletesDELETEs of a single entitystatic java.util.Comparator<DbEntityOperation>INSERT_OPERATION_COMPARATORstatic java.util.Comparator<java.lang.Class<?>>INSERT_TYPE_COMPARATORjava.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbEntityOperation>>insertsINSERTsstatic java.util.Comparator<DbEntityOperation>MODIFICATION_OPERATION_COMPARATORstatic java.util.Comparator<java.lang.Class<?>>MODIFICATION_TYPE_COMPARATORjava.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbEntityOperation>>updatesUPDATEs of a single entity
-
Constructor Summary
Constructors Constructor Description DbOperationManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanaddOperation(DbBulkOperation newOperation)booleanaddOperation(DbEntityOperation newOperation)booleanaddOperationPreserveOrder(DbBulkOperation newOperation)protected voidaddSortedInserts(java.util.List<DbOperation> flush)Adds the insert operations to the flush (in correct order).protected voidaddSortedModifications(java.util.List<DbOperation> flush)Adds a correctly ordered list of UPDATE and DELETE operations to the flush.protected voidaddSortedModificationsForType(java.lang.Class<?> type, java.util.SortedSet<DbEntityOperation> preSortedOperations, java.util.List<DbOperation> flush)java.util.List<DbOperation>calculateFlush()protected voiddetermineDependencies(java.util.List<DbOperation> flush)protected java.util.SortedSet<DbEntityOperation>getDeletesByType(java.lang.Class<? extends DbEntity> type, boolean create)protected java.util.SortedSet<DbEntityOperation>getInsertsForType(java.lang.Class<? extends DbEntity> type, boolean create)protected java.util.SortedSet<DbEntityOperation>getUpdatesByType(java.lang.Class<? extends DbEntity> type, boolean create)protected java.util.List<DbEntityOperation>sortByReferences(java.util.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 java.util.Comparator<java.lang.Class<?>> INSERT_TYPE_COMPARATOR
-
MODIFICATION_TYPE_COMPARATOR
public static java.util.Comparator<java.lang.Class<?>> MODIFICATION_TYPE_COMPARATOR
-
INSERT_OPERATION_COMPARATOR
public static java.util.Comparator<DbEntityOperation> INSERT_OPERATION_COMPARATOR
-
MODIFICATION_OPERATION_COMPARATOR
public static java.util.Comparator<DbEntityOperation> MODIFICATION_OPERATION_COMPARATOR
-
BULK_OPERATION_COMPARATOR
public static java.util.Comparator<DbBulkOperation> BULK_OPERATION_COMPARATOR
-
inserts
public java.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbEntityOperation>> inserts
INSERTs
-
updates
public java.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbEntityOperation>> updates
UPDATEs of a single entity
-
deletes
public java.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbEntityOperation>> deletes
DELETEs of a single entity
-
bulkOperations
public java.util.SortedMap<java.lang.Class<?>,java.util.SortedSet<DbBulkOperation>> bulkOperations
bulk modifications (DELETE, UPDATE) on an entity collection
-
bulkOperationsInsertionOrder
public java.util.LinkedHashSet<DbBulkOperation> bulkOperationsInsertionOrder
bulk modifications (DELETE, UPDATE) for which order of execution is important
-
-
Method Detail
-
addOperation
public boolean addOperation(DbEntityOperation newOperation)
-
getDeletesByType
protected java.util.SortedSet<DbEntityOperation> getDeletesByType(java.lang.Class<? extends DbEntity> type, boolean create)
-
getUpdatesByType
protected java.util.SortedSet<DbEntityOperation> getUpdatesByType(java.lang.Class<? extends DbEntity> type, boolean create)
-
getInsertsForType
protected java.util.SortedSet<DbEntityOperation> getInsertsForType(java.lang.Class<? extends DbEntity> type, boolean create)
-
addOperation
public boolean addOperation(DbBulkOperation newOperation)
-
addOperationPreserveOrder
public boolean addOperationPreserveOrder(DbBulkOperation newOperation)
-
calculateFlush
public java.util.List<DbOperation> calculateFlush()
-
addSortedInserts
protected void addSortedInserts(java.util.List<DbOperation> flush)
Adds the insert operations to the flush (in correct order).- Parameters:
operationsForFlush-
-
addSortedModifications
protected void addSortedModifications(java.util.List<DbOperation> flush)
Adds a correctly ordered list of UPDATE and DELETE operations to the flush.- Parameters:
flush-
-
addSortedModificationsForType
protected void addSortedModificationsForType(java.lang.Class<?> type, java.util.SortedSet<DbEntityOperation> preSortedOperations, java.util.List<DbOperation> flush)
-
sortByReferences
protected java.util.List<DbEntityOperation> sortByReferences(java.util.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(java.util.List<DbOperation> flush)
-
-