use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MigrationCompensationInstanceVisitor method instantiateScopes.
@Override
protected void instantiateScopes(MigratingScopeInstance ancestorScopeInstance, MigratingScopeInstanceBranch executionBranch, List<ScopeImpl> scopesToInstantiate) {
if (scopesToInstantiate.isEmpty()) {
return;
}
ExecutionEntity ancestorScopeExecution = ancestorScopeInstance.resolveRepresentativeExecution();
ExecutionEntity parentExecution = ancestorScopeExecution;
for (ScopeImpl scope : scopesToInstantiate) {
ExecutionEntity compensationScopeExecution = parentExecution.createExecution();
compensationScopeExecution.setScope(true);
compensationScopeExecution.setEventScope(true);
compensationScopeExecution.setActivity((PvmActivity) scope);
compensationScopeExecution.setActive(false);
compensationScopeExecution.activityInstanceStarting();
compensationScopeExecution.enterActivityInstance();
EventSubscriptionEntity eventSubscription = EventSubscriptionEntity.createAndInsert(parentExecution, EventType.COMPENSATE, (ActivityImpl) scope);
eventSubscription.setConfiguration(compensationScopeExecution.getId());
executionBranch.visited(new MigratingEventScopeInstance(eventSubscription, compensationScopeExecution, scope));
parentExecution = compensationScopeExecution;
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MigratingActivityInstanceVisitor method instantiateScopes.
protected void instantiateScopes(MigratingScopeInstance ancestorScopeInstance, MigratingScopeInstanceBranch executionBranch, List<ScopeImpl> scopesToInstantiate) {
if (scopesToInstantiate.isEmpty()) {
return;
}
// must always be an activity instance
MigratingActivityInstance ancestorActivityInstance = (MigratingActivityInstance) ancestorScopeInstance;
ExecutionEntity newParentExecution = ancestorActivityInstance.createAttachableExecution();
Map<PvmActivity, PvmExecutionImpl> createdExecutions = newParentExecution.instantiateScopes((List) scopesToInstantiate, skipCustomListeners, skipIoMappings);
for (ScopeImpl scope : scopesToInstantiate) {
ExecutionEntity createdExecution = (ExecutionEntity) createdExecutions.get(scope);
createdExecution.setActivity(null);
createdExecution.setActive(false);
executionBranch.visited(new MigratingActivityInstance(scope, createdExecution));
}
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class IncidentTest method testShouldDeleteIncidentAfterJobWasSuccessfully.
@Deployment(resources = { "org/camunda/bpm/engine/test/api/mgmt/IncidentTest.testShouldDeleteIncidentAfterJobWasSuccessfully.bpmn" })
public void testShouldDeleteIncidentAfterJobWasSuccessfully() {
// Start process instance
Map<String, Object> parameters = new HashMap<String, Object>();
parameters.put("fail", true);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("failingProcessWithUserTask", parameters);
executeAvailableJobs();
// job exists
Job job = managementService.createJobQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(job);
// incident was created
Incident incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
assertNotNull(incident);
// set execution variable from "true" to "false"
runtimeService.setVariable(processInstance.getId(), "fail", new Boolean(false));
// set retries of failed job to 1, with the change of the fail variable the job
// will be executed successfully
managementService.setJobRetries(job.getId(), 1);
executeAvailableJobs();
// Update process instance
processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult();
assertTrue(processInstance instanceof ExecutionEntity);
// should stay in the user task
ExecutionEntity exec = (ExecutionEntity) processInstance;
assertEquals("theUserTask", exec.getActivityId());
// there does not exist any incident anymore
incident = runtimeService.createIncidentQuery().processInstanceId(processInstance.getId()).singleResult();
assertNull(incident);
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MessageCorrelationTest method checkExecutionMessageCorrelationResult.
protected void checkExecutionMessageCorrelationResult(MessageCorrelationResult result, ProcessInstance processInstance, String activityId) {
assertNotNull(result);
assertEquals(MessageCorrelationResultType.Execution, result.getResultType());
assertEquals(processInstance.getId(), result.getExecution().getProcessInstanceId());
ExecutionEntity entity = (ExecutionEntity) result.getExecution();
assertEquals(activityId, entity.getActivityId());
}
use of org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity in project camunda-bpm-platform by camunda.
the class MessageCorrelationByLocalVariablesTest method checkExecutionMessageCorrelationResult.
protected void checkExecutionMessageCorrelationResult(MessageCorrelationResult result, ProcessInstance processInstance, String activityId) {
assertNotNull(result);
assertEquals(MessageCorrelationResultType.Execution, result.getResultType());
assertEquals(processInstance.getId(), result.getExecution().getProcessInstanceId());
ExecutionEntity entity = (ExecutionEntity) result.getExecution();
assertEquals(activityId, entity.getActivityId());
}
Aggregations