Codota Logo
DbEntityOperation
Code IndexAdd Codota to your IDE (free)

How to use
DbEntityOperation
in
org.camunda.bpm.engine.impl.db.entitymanager.operation

Best Java code snippets using org.camunda.bpm.engine.impl.db.entitymanager.operation.DbEntityOperation (Showing top 20 results out of 315)

  • Common ways to obtain DbEntityOperation
private void myMethod () {
DbEntityOperation d =
  • Codota Iconnew DbEntityOperation()
  • Smart code suggestions by Codota
}
origin: camunda/camunda-bpm-platform

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());
  }
 }
}
origin: camunda/camunda-bpm-platform

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);
}
origin: camunda/camunda-bpm-platform

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());
}
origin: camunda/camunda-bpm-platform

public boolean addOperation(DbEntityOperation newOperation) {
 if(newOperation.getOperationType() == INSERT) {
  return getInsertsForType(newOperation.getEntityType(), true)
    .add(newOperation);
 } else if(newOperation.getOperationType() == DELETE) {
  return getDeletesByType(newOperation.getEntityType(), true)
    .add(newOperation);
 } else { // UPDATE
  return getUpdatesByType(newOperation.getEntityType(), true)
    .add(newOperation);
 }
}
origin: camunda/camunda-bpm-platform

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;
}
origin: camunda/camunda-bpm-platform

DbOperation thisOperation = operationIt.next();
thisOperation.setRowsAffected(statementResult);
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 {
origin: camunda/camunda-bpm-platform

@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);
 operation.setRowsAffected(nrOfRowsDeleted);
 // 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);
}
origin: camunda/camunda-bpm-platform

DbEntity currentEntity = currentOperation.getEntity();
Set<String> currentReferences = currentOperation.getFlushRelevantEntityReferences();
for(int k = i+1; k < opList.size(); k++) {
 DbEntityOperation otherOperation = opList.get(k);
 DbEntity otherEntity = otherOperation.getEntity();
 Set<String> otherReferences = otherOperation.getFlushRelevantEntityReferences();
 if(currentOperation.getOperationType() == INSERT) {
origin: camunda/camunda-bpm-platform

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);
}
origin: camunda/camunda-bpm-platform

 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);
   }
  }
 }
});
origin: camunda/camunda-bpm-platform

DbOperation thisOperation = operationIt.next();
thisOperation.setRowsAffected(statementResult);
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 {
origin: camunda/camunda-bpm-platform

@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);
 operation.setRowsAffected(nrOfRowsDeleted);
 // 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);
}
origin: camunda/camunda-bpm-platform

DbEntity currentEntity = currentOperation.getEntity();
Set<String> currentReferences = currentOperation.getFlushRelevantEntityReferences();
for(int k = i+1; k < opList.size(); k++) {
 DbEntityOperation otherOperation = opList.get(k);
 DbEntity otherEntity = otherOperation.getEntity();
 Set<String> otherReferences = otherOperation.getFlushRelevantEntityReferences();
 if(currentOperation.getOperationType() == INSERT) {
origin: org.camunda.bpm/camunda-engine

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);
}
origin: camunda/camunda-bpm-platform

public boolean addOperation(DbEntityOperation newOperation) {
 if(newOperation.getOperationType() == INSERT) {
  return getInsertsForType(newOperation.getEntityType(), true)
    .add(newOperation);
 } else if(newOperation.getOperationType() == DELETE) {
  return getDeletesByType(newOperation.getEntityType(), true)
    .add(newOperation);
 } else { // UPDATE
  return getUpdatesByType(newOperation.getEntityType(), true)
    .add(newOperation);
 }
}
origin: camunda/camunda-bpm-platform

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);
}
origin: camunda/camunda-bpm-platform

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());
  }
 }
}
origin: camunda/camunda-bpm-platform

 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);
   }
  }
 }
});
origin: camunda/camunda-bpm-platform

@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);
}
origin: org.camunda.bpm/camunda-engine

@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);
 operation.setRowsAffected(nrOfRowsDeleted);
 // 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);
}
org.camunda.bpm.engine.impl.db.entitymanager.operationDbEntityOperation

Javadoc

An operation on a single DbEntity

Most used methods

  • getEntity
  • <init>
  • getEntityType
  • setEntity
  • setOperationType
  • equals
  • getFlushRelevantEntityReferences
  • getOperationType
  • setFailed
  • setFlushRelevantEntityReferences
  • setRowsAffected
  • setRowsAffected

Popular in Java

  • Creating JSON documents from java classes using gson
  • getResourceAsStream (ClassLoader)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • notifyDataSetChanged (ArrayAdapter)
  • GridBagLayout (java.awt)
    The GridBagLayout class is a flexible layout manager that aligns components vertically and horizonta
  • FileInputStream (java.io)
    A FileInputStream obtains input bytes from a file in a file system. What files are available depends
  • IOException (java.io)
    Signals that an I/O exception of some sort has occurred. This class is the general class of exceptio
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • JTextField (javax.swing)
  • Logger (org.slf4j)
    The main user interface to logging. It is expected that logging takes place through concrete impleme
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now