use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class PvmAtomicOperationCreateConcurrentExecution method execute.
public void execute(PvmExecutionImpl execution) {
// Invariant: execution is the Scope Execution for the activity's flow scope.
PvmActivity activityToStart = execution.getNextActivity();
execution.setNextActivity(null);
PvmExecutionImpl propagatingExecution = execution.createConcurrentExecution();
// set next activity on propagating execution
propagatingExecution.setActivity(activityToStart);
concurrentExecutionCreated(propagatingExecution);
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class RepositoryServiceTest method testProcessDefinitionIntrospection.
public void testProcessDefinitionIntrospection() {
String deploymentId = repositoryService.createDeployment().addClasspathResource("org/camunda/bpm/engine/test/api/repository/processOne.bpmn20.xml").deploy().getId();
String procDefId = repositoryService.createProcessDefinitionQuery().singleResult().getId();
ReadOnlyProcessDefinition processDefinition = ((RepositoryServiceImpl) repositoryService).getDeployedProcessDefinition(procDefId);
assertEquals(procDefId, processDefinition.getId());
assertEquals("Process One", processDefinition.getName());
assertEquals("the first process", processDefinition.getProperty("documentation"));
PvmActivity start = processDefinition.findActivity("start");
assertNotNull(start);
assertEquals("start", start.getId());
assertEquals("S t a r t", start.getProperty("name"));
assertEquals("the start event", start.getProperty("documentation"));
assertEquals(Collections.EMPTY_LIST, start.getActivities());
List<PvmTransition> outgoingTransitions = start.getOutgoingTransitions();
assertEquals(1, outgoingTransitions.size());
assertEquals("${a == b}", outgoingTransitions.get(0).getProperty(BpmnParse.PROPERTYNAME_CONDITION_TEXT));
PvmActivity end = processDefinition.findActivity("end");
assertNotNull(end);
assertEquals("end", end.getId());
PvmTransition transition = outgoingTransitions.get(0);
assertEquals("flow1", transition.getId());
assertEquals("Flow One", transition.getProperty("name"));
assertEquals("The only transitions in the process", transition.getProperty("documentation"));
assertSame(start, transition.getSource());
assertSame(end, transition.getDestination());
repositoryService.deleteDeployment(deploymentId);
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class ThrowEscalationEventActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
final PvmActivity currentActivity = execution.getActivity();
final EscalationEventDefinitionFinder escalationEventDefinitionFinder = new EscalationEventDefinitionFinder(escalation.getEscalationCode(), currentActivity);
ActivityExecutionMappingCollector activityExecutionMappingCollector = new ActivityExecutionMappingCollector(execution);
ActivityExecutionHierarchyWalker walker = new ActivityExecutionHierarchyWalker(execution);
walker.addScopePreVisitor(escalationEventDefinitionFinder);
walker.addExecutionPreVisitor(activityExecutionMappingCollector);
walker.addExecutionPreVisitor(new OutputVariablesPropagator());
walker.walkUntil(new ReferenceWalker.WalkCondition<ActivityExecutionTuple>() {
@Override
public boolean isFulfilled(ActivityExecutionTuple element) {
return escalationEventDefinitionFinder.getEscalationEventDefinition() != null || element == null;
}
});
EscalationEventDefinition escalationEventDefinition = escalationEventDefinitionFinder.getEscalationEventDefinition();
if (escalationEventDefinition != null) {
executeEscalationHandler(escalationEventDefinition, activityExecutionMappingCollector);
}
if (escalationEventDefinition == null || !escalationEventDefinition.isCancelActivity()) {
leaveExecution(execution, currentActivity, escalationEventDefinition);
}
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class SequentialMultiInstanceActivityBehavior method complete.
public void complete(ActivityExecution scopeExecution) {
int loopCounter = getLoopVariable(scopeExecution, LOOP_COUNTER) + 1;
int nrOfInstances = getLoopVariable(scopeExecution, NUMBER_OF_INSTANCES);
int nrOfCompletedInstances = getLoopVariable(scopeExecution, NUMBER_OF_COMPLETED_INSTANCES) + 1;
setLoopVariable(scopeExecution, NUMBER_OF_COMPLETED_INSTANCES, nrOfCompletedInstances);
if (loopCounter == nrOfInstances || completionConditionSatisfied(scopeExecution)) {
leave(scopeExecution);
} else {
PvmActivity innerActivity = getInnerActivity(scopeExecution.getActivity());
performInstance(scopeExecution, innerActivity, loopCounter);
}
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class BpmnParseTest method testParseNamespaceInConditionExpressionType.
@Deployment
public void testParseNamespaceInConditionExpressionType() {
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutorTxRequired();
ProcessDefinitionEntity processDefinitionEntity = commandExecutor.execute(new Command<ProcessDefinitionEntity>() {
@Override
public ProcessDefinitionEntity execute(CommandContext commandContext) {
return Context.getProcessEngineConfiguration().getDeploymentCache().findDeployedLatestProcessDefinitionByKey("resolvableNamespacesProcess");
}
});
// Test that the process definition has been deployed
assertNotNull(processDefinitionEntity);
PvmActivity activity = processDefinitionEntity.findActivity("ExclusiveGateway_1");
assertNotNull(activity);
// Test that the conditions has been resolved
for (PvmTransition transition : activity.getOutgoingTransitions()) {
if (transition.getDestination().getId().equals("Task_2")) {
assertTrue(transition.getProperty("conditionText").equals("#{approved}"));
} else if (transition.getDestination().getId().equals("Task_3")) {
assertTrue(transition.getProperty("conditionText").equals("#{!approved}"));
} else {
fail("Something went wrong");
}
}
}
Aggregations