use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class CreateIncidentCmd method execute.
@Override
public Incident execute(CommandContext commandContext) {
EnsureUtil.ensureNotNull(BadUserRequestException.class, "Execution id cannot be null", "executionId", executionId);
EnsureUtil.ensureNotNull(BadUserRequestException.class, "incidentType", incidentType);
ExecutionEntity execution = commandContext.getExecutionManager().findExecutionById(executionId);
EnsureUtil.ensureNotNull(BadUserRequestException.class, "Cannot find an execution with executionId '" + executionId + "'", "execution", execution);
EnsureUtil.ensureNotNull(BadUserRequestException.class, "Execution must be related to an activity", "activity", execution.getActivity());
for (CommandChecker checker : commandContext.getProcessEngineConfiguration().getCommandCheckers()) {
checker.checkUpdateProcessInstance(execution);
}
return execution.createIncident(incidentType, configuration, message);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ActivityCancellationCmd method createActivityInstanceCancellations.
public List<AbstractInstanceCancellationCmd> createActivityInstanceCancellations(ActivityInstance activityInstanceTree, CommandContext commandContext) {
List<AbstractInstanceCancellationCmd> commands = new ArrayList<AbstractInstanceCancellationCmd>();
ExecutionEntity processInstance = commandContext.getExecutionManager().findExecutionById(processInstanceId);
ProcessDefinitionImpl processDefinition = processInstance.getProcessDefinition();
Set<String> parentScopeIds = collectParentScopeIdsForActivity(processDefinition, activityId);
List<ActivityInstance> childrenForActivity = getActivityInstancesForActivity(activityInstanceTree, parentScopeIds);
for (ActivityInstance instance : childrenForActivity) {
commands.add(new ActivityInstanceCancellationCmd(processInstanceId, instance.getId()));
}
List<TransitionInstance> transitionInstancesForActivity = getTransitionInstancesForActivity(activityInstanceTree, parentScopeIds);
for (TransitionInstance instance : transitionInstancesForActivity) {
commands.add(new TransitionInstanceCancellationCmd(processInstanceId, instance.getId()));
}
return commands;
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class FindActiveActivityIdsCmd method execute.
public List<String> execute(CommandContext commandContext) {
ensureNotNull("executionId", executionId);
// fetch execution
ExecutionManager executionManager = commandContext.getExecutionManager();
ExecutionEntity execution = executionManager.findExecutionById(executionId);
ensureNotNull("execution " + executionId + " doesn't exist", "execution", execution);
checkGetActivityIds(execution, commandContext);
// fetch active activities
return execution.findActiveActivityIds();
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ActivityExecutionTreeMapping method mergeScopeExecutions.
protected void mergeScopeExecutions(ExecutionEntity leaf) {
Map<ScopeImpl, PvmExecutionImpl> mapping = leaf.createActivityExecutionMapping();
for (Map.Entry<ScopeImpl, PvmExecutionImpl> mappingEntry : mapping.entrySet()) {
ScopeImpl scope = mappingEntry.getKey();
ExecutionEntity scopeExecution = (ExecutionEntity) mappingEntry.getValue();
submitExecution(scopeExecution, scope);
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class ActivityExecutionTreeMapping method initialize.
protected void initialize() {
ExecutionEntity processInstance = commandContext.getExecutionManager().findExecutionById(processInstanceId);
this.processDefinition = processInstance.getProcessDefinition();
List<ExecutionEntity> executions = fetchExecutionsForProcessInstance(processInstance);
executions.add(processInstance);
List<ExecutionEntity> leaves = findLeaves(executions);
assignExecutionsToActivities(leaves);
}
Aggregations