Search in sources :

Example 1 with VariableInstanceEntityManager

use of org.activiti.engine.impl.persistence.entity.VariableInstanceEntityManager in project Activiti by Activiti.

the class DestroyScopeOperation method run.

@Override
public void run() {
    // Find the actual scope that needs to be destroyed.
    // This could be the incoming execution, or the first parent execution where isScope = true
    // Find parent scope execution
    ExecutionEntity scopeExecution = execution.isScope() ? execution : findFirstParentScopeExecution(execution);
    if (scopeExecution == null) {
        throw new ActivitiException("Programmatic error: no parent scope execution found for boundary event");
    }
    ExecutionEntityManager executionEntityManager = commandContext.getExecutionEntityManager();
    deleteAllChildExecutions(executionEntityManager, scopeExecution);
    // Delete all scope tasks
    TaskEntityManager taskEntityManager = commandContext.getTaskEntityManager();
    deleteAllScopeTasks(scopeExecution, taskEntityManager);
    // Delete all scope jobs
    TimerJobEntityManager timerJobEntityManager = commandContext.getTimerJobEntityManager();
    deleteAllScopeJobs(scopeExecution, timerJobEntityManager);
    // Remove variables associated with this scope
    VariableInstanceEntityManager variableInstanceEntityManager = commandContext.getVariableInstanceEntityManager();
    removeAllVariablesFromScope(scopeExecution, variableInstanceEntityManager);
    commandContext.getHistoryManager().recordActivityEnd(scopeExecution, scopeExecution.getDeleteReason());
    executionEntityManager.delete(scopeExecution);
}
Also used : ActivitiException(org.activiti.engine.ActivitiException) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) TaskEntityManager(org.activiti.engine.impl.persistence.entity.TaskEntityManager) ExecutionEntityManager(org.activiti.engine.impl.persistence.entity.ExecutionEntityManager) TimerJobEntityManager(org.activiti.engine.impl.persistence.entity.TimerJobEntityManager) VariableInstanceEntityManager(org.activiti.engine.impl.persistence.entity.VariableInstanceEntityManager)

Aggregations

ActivitiException (org.activiti.engine.ActivitiException)1 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)1 ExecutionEntityManager (org.activiti.engine.impl.persistence.entity.ExecutionEntityManager)1 TaskEntityManager (org.activiti.engine.impl.persistence.entity.TaskEntityManager)1 TimerJobEntityManager (org.activiti.engine.impl.persistence.entity.TimerJobEntityManager)1 VariableInstanceEntityManager (org.activiti.engine.impl.persistence.entity.VariableInstanceEntityManager)1