org.camunda.bpm.engine.impl.db.entitymanager.operation
Class DbOperationManager

java.lang.Object
  extended by org.camunda.bpm.engine.impl.db.entitymanager.operation.DbOperationManager

public class DbOperationManager
extends Object

Manages a set of database operations.

Author:
Daniel Meyer

Field Summary
static Comparator<DbBulkOperation> BULK_OPERATION_COMPARATOR
           
 SortedMap<Class<?>,SortedSet<DbBulkOperation>> bulkOperations
          bulk modifications (DELETE, UPDATE) on an entity collection
 SortedMap<Class<?>,SortedSet<DbEntityOperation>> deletes
          DELETEs of a single entity
static Comparator<DbEntityOperation> INSERT_OPERATION_COMPARATOR
           
static Comparator<Class<?>> INSERT_TYPE_COMPARATOR
           
 SortedMap<Class<?>,SortedSet<DbEntityOperation>> inserts
          INSERTs
static Comparator<DbEntityOperation> MODIFICATION_OPERATION_COMPARATOR
           
static Comparator<Class<?>> MODIFICATION_TYPE_COMPARATOR
           
 SortedMap<Class<?>,SortedSet<DbEntityOperation>> updates
          UPDATEs of a single entity
 
Constructor Summary
DbOperationManager()
           
 
Method Summary
 boolean addOperation(DbBulkOperation newOperation)
           
 boolean addOperation(DbEntityOperation 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  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 implement HasDbReferences.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

Constructor Detail

DbOperationManager

public DbOperationManager()
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)

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 implement HasDbReferences. b) all operations in the set work on the same type (ie. all operations are INSERTs or DELETEs).



Copyright © 2016 camunda services GmbH. All rights reserved.