use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl 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.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class PvmActivityInstanceCompleteTest method testBoundaryEvent.
/**
* +----------+
* | userTask |
* | |
* +-----+ | | +------+
* |start|-->| |--->| end1 |
* +-----+ | +-----+ |
* +-|timer|--+
* +-----+
* | +------+
* +--------->| end2 |
* +------+
*/
public void testBoundaryEvent() {
ActivityInstanceVerification verifier = new ActivityInstanceVerification();
PvmProcessDefinition processDefinition = new ProcessDefinitionBuilder().createActivity("start").initial().behavior(new Automatic()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("userTask").endActivity().createActivity("userTask").scope().behavior(new EmbeddedSubProcess()).executionListener(ExecutionListener.EVENTNAME_END, verifier).transition("end1").endActivity().createActivity("timer").behavior(new WaitState()).executionListener(ExecutionListener.EVENTNAME_END, verifier).attachedTo("userTask", true).transition("end2").endActivity().createActivity("end1").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().createActivity("end2").behavior(new End()).executionListener(ExecutionListener.EVENTNAME_END, verifier).endActivity().buildProcessDefinition();
PvmProcessInstance processInstance = processDefinition.createProcessInstance();
processInstance.start();
PvmExecution userTaskExecution = processInstance.findExecution("userTask");
((PvmExecutionImpl) userTaskExecution).executeActivity(processDefinition.findActivity("timer"));
PvmExecution timerExecution = processInstance.findExecution("timer");
timerExecution.signal(null, null);
verifier.assertNonCompletingActivityInstance("start", 1);
verifier.assertNonCompletingActivityInstance("userTask", 1);
verifier.assertIsCompletingActivityInstance("end2", 1);
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class EventCollector method notify.
public void notify(DelegateExecution execution) throws Exception {
PvmExecutionImpl executionImpl = (PvmExecutionImpl) execution;
LOG.debug("collecting event: " + execution.getEventName() + " on " + executionImpl.getEventSource());
events.add(execution.getEventName() + " on " + executionImpl.getEventSource());
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class IntermediateConditionalEventBehavior method leaveOnSatisfiedCondition.
@Override
public void leaveOnSatisfiedCondition(final EventSubscriptionEntity eventSubscription, final VariableEvent variableEvent) {
PvmExecutionImpl execution = eventSubscription.getExecution();
if (execution != null && !execution.isEnded() && variableEvent != null && conditionalEvent.tryEvaluate(variableEvent, execution) && execution.isActive() && execution.isScope()) {
if (isAfterEventBasedGateway) {
final ActivityImpl activity = eventSubscription.getActivity();
execution.executeEventHandlerActivity(activity);
} else {
leave(execution);
}
}
}
use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.
the class CompensationUtil method collectCompensateEventSubscriptionsForScope.
/**
* Collect all compensate event subscriptions for scope of given execution.
*/
public static List<EventSubscriptionEntity> collectCompensateEventSubscriptionsForScope(ActivityExecution execution) {
final Map<ScopeImpl, PvmExecutionImpl> scopeExecutionMapping = execution.createActivityExecutionMapping();
ScopeImpl activity = (ScopeImpl) execution.getActivity();
// <LEGACY>: different flow scopes may have the same scope execution =>
// collect subscriptions in a set
final Set<EventSubscriptionEntity> subscriptions = new HashSet<EventSubscriptionEntity>();
TreeVisitor<ScopeImpl> eventSubscriptionCollector = new TreeVisitor<ScopeImpl>() {
@Override
public void visit(ScopeImpl obj) {
PvmExecutionImpl execution = scopeExecutionMapping.get(obj);
subscriptions.addAll(((ExecutionEntity) execution).getCompensateEventSubscriptions());
}
};
new FlowScopeWalker(activity).addPostVisitor(eventSubscriptionCollector).walkUntil(new ReferenceWalker.WalkCondition<ScopeImpl>() {
@Override
public boolean isFulfilled(ScopeImpl element) {
Boolean consumesCompensationProperty = (Boolean) element.getProperty(BpmnParse.PROPERTYNAME_CONSUMES_COMPENSATION);
return consumesCompensationProperty == null || consumesCompensationProperty == Boolean.TRUE;
}
});
return new ArrayList<EventSubscriptionEntity>(subscriptions);
}
Aggregations