use of org.camunda.bpm.engine.impl.pvm.PvmTransition in project camunda-bpm-platform by camunda.
the class While method execute.
public void execute(ActivityExecution execution) throws Exception {
PvmTransition more = execution.getActivity().findOutgoingTransition("more");
PvmTransition done = execution.getActivity().findOutgoingTransition("done");
Integer value = (Integer) execution.getVariable(variableName);
if (value == null) {
execution.setVariable(variableName, from);
execution.leaveActivityViaTransition(more);
} else {
value = value + 1;
if (value < to) {
execution.setVariable(variableName, value);
execution.leaveActivityViaTransition(more);
} else {
execution.leaveActivityViaTransition(done);
}
}
}
use of org.camunda.bpm.engine.impl.pvm.PvmTransition in project camunda-bpm-platform by camunda.
the class ParallelGateway method execute.
public void execute(ActivityExecution execution) {
PvmActivity activity = execution.getActivity();
List<PvmTransition> outgoingTransitions = execution.getActivity().getOutgoingTransitions();
execution.inactivate();
List<ActivityExecution> joinedExecutions = execution.findInactiveConcurrentExecutions(activity);
int nbrOfExecutionsToJoin = execution.getActivity().getIncomingTransitions().size();
int nbrOfExecutionsJoined = joinedExecutions.size();
if (nbrOfExecutionsJoined == nbrOfExecutionsToJoin) {
LOG.debug("parallel gateway '" + activity.getId() + "' activates: " + nbrOfExecutionsJoined + " of " + nbrOfExecutionsToJoin + " joined");
execution.leaveActivityViaTransitions(outgoingTransitions, joinedExecutions);
} else {
LOG.debug("parallel gateway '" + activity.getId() + "' does not activate: " + nbrOfExecutionsJoined + " of " + nbrOfExecutionsToJoin + " joined");
}
}
use of org.camunda.bpm.engine.impl.pvm.PvmTransition in project camunda-bpm-platform by camunda.
the class PvmAtomicOperationActivityInitStackNotifyListenerStart method eventNotificationsCompleted.
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
super.eventNotificationsCompleted(execution);
execution.activityInstanceStarted();
ExecutionStartContext startContext = execution.getExecutionStartContext();
InstantiationStack instantiationStack = startContext.getInstantiationStack();
PvmExecutionImpl propagatingExecution = execution;
ActivityImpl activity = execution.getActivity();
if (activity.getActivityBehavior() instanceof ModificationObserverBehavior) {
ModificationObserverBehavior behavior = (ModificationObserverBehavior) activity.getActivityBehavior();
List<ActivityExecution> concurrentExecutions = behavior.initializeScope(propagatingExecution, 1);
propagatingExecution = (PvmExecutionImpl) concurrentExecutions.get(0);
}
// if the stack has been instantiated
if (instantiationStack.getActivities().isEmpty() && instantiationStack.getTargetActivity() != null) {
// as if we are entering the target activity instance id via a transition
propagatingExecution.setActivityInstanceId(null);
// execute the target activity with this execution
startContext.applyVariables(propagatingExecution);
propagatingExecution.setActivity(instantiationStack.getTargetActivity());
propagatingExecution.performOperation(ACTIVITY_START_CREATE_SCOPE);
} else if (instantiationStack.getActivities().isEmpty() && instantiationStack.getTargetTransition() != null) {
// as if we are entering the target activity instance id via a transition
propagatingExecution.setActivityInstanceId(null);
// execute the target transition with this execution
PvmTransition transition = instantiationStack.getTargetTransition();
startContext.applyVariables(propagatingExecution);
propagatingExecution.setActivity(transition.getSource());
propagatingExecution.setTransition((TransitionImpl) transition);
propagatingExecution.performOperation(TRANSITION_START_NOTIFY_LISTENER_TAKE);
} else {
// else instantiate the activity stack further
propagatingExecution.setActivity(null);
propagatingExecution.performOperation(ACTIVITY_INIT_STACK);
}
}
use of org.camunda.bpm.engine.impl.pvm.PvmTransition in project camunda-bpm-platform by camunda.
the class ThrowsExceptionBehavior method execute.
public void execute(ActivityExecution execution) throws Exception {
String var = (String) execution.getVariable("var");
PvmTransition transition = null;
try {
executeLogic(var);
transition = execution.getActivity().findOutgoingTransition("no-exception");
} catch (Exception e) {
transition = execution.getActivity().findOutgoingTransition("exception");
}
execution.leaveActivityViaTransition(transition);
}
Aggregations