congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DbEntityOperation
Code IndexAdd Tabnine 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)

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

  • Making http post requests using okhttp
  • getExternalFilesDir (Context)
  • findViewById (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • IOException (java.io)
    Signals a general, I/O-related error. Error details may be specified when calling the constructor, a
  • PrintStream (java.io)
    Fake signature of an existing Java class.
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now