本文整理汇总了Java中org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation类的典型用法代码示例。如果您正苦于以下问题:Java DbEntityOperation类的具体用法?Java DbEntityOperation怎么用?Java DbEntityOperation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DbEntityOperation类属于org.camunda.bpm.engine.impl.db.entitymanager.operation包,在下文中一共展示了DbEntityOperation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: insertEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
@Override
protected void insertEntity(DbEntityOperation operation) {
final DbEntity dbEntity = operation.getEntity();
// get statement
String insertStatement = dbSqlSessionFactory.getInsertStatement(dbEntity);
insertStatement = dbSqlSessionFactory.mapStatement(insertStatement);
ensureNotNull("no insert statement for " + dbEntity.getClass() + " in the ibatis mapping files", "insertStatement", insertStatement);
// execute the insert
executeInsertEntity(insertStatement, dbEntity);
// perform post insert actions on entity
entityInserted(dbEntity);
}
示例2: deleteEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
@Override
protected void deleteEntity(DbEntityOperation operation) {
final DbEntity dbEntity = operation.getEntity();
// get statement
String deleteStatement = dbSqlSessionFactory.getDeleteStatement(dbEntity.getClass());
ensureNotNull("no delete statement for " + dbEntity.getClass() + " in the ibatis mapping files", "deleteStatement", deleteStatement);
LOG.executeDatabaseOperation("DELETE", dbEntity);
// execute the delete
int nrOfRowsDeleted = executeDelete(deleteStatement, dbEntity);
// It only makes sense to check for optimistic locking exceptions for objects that actually have a revision
if (dbEntity instanceof HasDbRevision && nrOfRowsDeleted == 0) {
operation.setFailed(true);
return;
}
// perform post delete action
entityDeleted(dbEntity);
}
示例3: executeDbOperation
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
public void executeDbOperation(DbOperation operation) {
switch(operation.getOperationType()) {
case INSERT:
insertEntity((DbEntityOperation) operation);
break;
case DELETE:
deleteEntity((DbEntityOperation) operation);
break;
case DELETE_BULK:
deleteBulk((DbBulkOperation) operation);
break;
case UPDATE:
updateEntity((DbEntityOperation) operation);
break;
case UPDATE_BULK:
updateBulk((DbBulkOperation) operation);
break;
}
}
示例4: execute
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
public void execute(DelegateExecution execution) throws Exception {
String existingId = execution.getId();
// insert an execution referencing the current execution
ExecutionEntity newExecution = new ExecutionEntity();
newExecution.setId("someId");
newExecution.setParentId(existingId);
DbEntityOperation insertOperation = new DbEntityOperation();
insertOperation.setOperationType(DbOperationType.INSERT);
insertOperation.setEntity(newExecution);
Context.getCommandContext()
.getDbSqlSession()
.executeDbOperation(insertOperation);
}
示例5: insertEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void insertEntity(DbEntityOperation operation) {
LOG.log(Level.FINE, "insertEntity, operation: "+operation.toString());
EntityOperationHandler entityOperations = operations.get(operation.getEntityType());
if(entityOperations == null) {
LOG.log(Level.WARNING, "unhandled INSERT '"+operation+"'");
}
else {
entityOperations.insert(this, operation.getEntity());
}
}
示例6: deleteEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void deleteEntity(DbEntityOperation operation) {
LOG.log(Level.FINE, "deleteEntity, operation: "+operation.toString());
EntityOperationHandler entityOperations = operations.get(operation.getEntityType());
if(entityOperations == null) {
LOG.log(Level.WARNING, "unhandled DELETE '"+operation+"'");
}
else {
entityOperations.delete(this, operation.getEntity());
}
}
示例7: updateEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
@Override
@SuppressWarnings({ "rawtypes", "unchecked" })
protected void updateEntity(DbEntityOperation operation) {
LOG.log(Level.FINE, "updateEntity, operation: "+operation.toString());
EntityOperationHandler entityOperations = operations.get(operation.getEntityType());
if(entityOperations == null) {
LOG.log(Level.WARNING, "unhandled UPDATE '"+operation+"'");
}
else {
entityOperations.update(this, operation.getEntity());
}
}
示例8: compare
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
public int compare(DbEntityOperation firstOperation, DbEntityOperation secondOperation) {
if(firstOperation.equals(secondOperation)) {
return 0;
}
DbEntity firstEntity = firstOperation.getEntity();
DbEntity secondEntity = secondOperation.getEntity();
return firstEntity.getId().compareTo(secondEntity.getId());
}
示例9: checkFlushResults
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
protected void checkFlushResults(List<DbOperation> operationsToFlush, List<BatchResult> flushResult) {
int flushResultSize = 0;
if (flushResult != null && flushResult.size() > 0) {
LOG.printBatchResults(flushResult);
//process the batch results to handle Optimistic Lock Exceptions
Iterator<DbOperation> operationIt = operationsToFlush.iterator();
for (BatchResult batchResult : flushResult) {
for (int statementResult : batchResult.getUpdateCounts()) {
flushResultSize++;
DbOperation thisOperation = operationIt.next();
if (thisOperation instanceof DbEntityOperation && ((DbEntityOperation) thisOperation).getEntity() instanceof HasDbRevision
&& !thisOperation.getOperationType().equals(DbOperationType.INSERT)) {
final DbEntity dbEntity = ((DbEntityOperation) thisOperation).getEntity();
if (statementResult != 1) {
((DbEntityOperation) thisOperation).setFailed(true);
handleOptimisticLockingException(thisOperation);
} else {
//update revision number in cache
if (thisOperation.getOperationType().equals(DbOperationType.UPDATE)) {
HasDbRevision versionedObject = (HasDbRevision) dbEntity;
versionedObject.setRevision(versionedObject.getRevisionNext());
}
}
}
}
}
//this must not happen, but worth checking
if (operationsToFlush.size() != flushResultSize) {
LOG.wrongBatchResultsSizeException(operationsToFlush);
}
}
}
示例10: performEntityOperation
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
protected void performEntityOperation(CachedDbEntity cachedDbEntity, DbOperationType type) {
DbEntityOperation dbOperation = new DbEntityOperation();
dbOperation.setEntity(cachedDbEntity.getEntity());
dbOperation.setFlushRelevantEntityReferences(cachedDbEntity.getFlushRelevantEntityReferences());
dbOperation.setOperationType(type);
dbOperationManager.addOperation(dbOperation);
}
示例11: updateEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
@Override
protected void updateEntity(DbEntityOperation operation) {
final DbEntity dbEntity = operation.getEntity();
String updateStatement = dbSqlSessionFactory.getUpdateStatement(dbEntity);
ensureNotNull("no update statement for " + dbEntity.getClass() + " in the ibatis mapping files", "updateStatement", updateStatement);
LOG.executeDatabaseOperation("UPDATE", dbEntity);
if (Context.getProcessEngineConfiguration().isJdbcBatchProcessing()) {
// execute update
executeUpdate(updateStatement, dbEntity);
} else {
// execute update
int numOfRowsUpdated = executeUpdate(updateStatement, dbEntity);
if (dbEntity instanceof HasDbRevision) {
if (numOfRowsUpdated != 1) {
// failed with optimistic locking
operation.setFailed(true);
return;
} else {
// increment revision of our copy
HasDbRevision versionedObject = (HasDbRevision) dbEntity;
versionedObject.setRevision(versionedObject.getRevisionNext());
}
}
}
// perform post update action
entityUpdated(dbEntity);
}
示例12: filterOnOptimisticLockingFailure
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
protected void filterOnOptimisticLockingFailure(CommandContext commandContext, final List<LockedExternalTask> tasks) {
commandContext.getDbEntityManager().registerOptimisticLockingListener(new OptimisticLockingListener() {
public Class<? extends DbEntity> getEntityType() {
return ExternalTaskEntity.class;
}
public void failedOperation(DbOperation operation) {
if (operation instanceof DbEntityOperation) {
DbEntityOperation dbEntityOperation = (DbEntityOperation) operation;
DbEntity dbEntity = dbEntityOperation.getEntity();
boolean failedOperationEntityInList = false;
Iterator<LockedExternalTask> it = tasks.iterator();
while (it.hasNext()) {
LockedExternalTask resultTask = it.next();
if (resultTask.getId().equals(dbEntity.getId())) {
it.remove();
failedOperationEntityInList = true;
break;
}
}
if (!failedOperationEntityInList) {
throw LOG.concurrentUpdateDbEntityException(operation);
}
}
}
});
}
示例13: failedOperation
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
public void failedOperation(DbOperation operation) {
if (operation instanceof DbEntityOperation) {
DbEntityOperation entityOperation = (DbEntityOperation) operation;
if(JobEntity.class.isAssignableFrom(entityOperation.getEntityType())) {
// could not lock the job -> remove it from list of acquired jobs
acquiredJobs.removeJobId(entityOperation.getEntity().getId());
}
}
}
示例14: indexOfEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
protected int indexOfEntity(DbEntity entity, List<DbOperation> operations) {
for (int i = 0; i < operations.size(); i++) {
if(entity == ((DbEntityOperation) operations.get(i)).getEntity()) {
return i;
}
}
return -1;
}
示例15: insertEntity
import org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation; //导入依赖的package包/类
protected abstract void insertEntity(DbEntityOperation operation);