use of org.camunda.bpm.engine.impl.pvm.PvmActivity 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.PvmActivity in project camunda-bpm-platform by camunda.
the class AsyncContinuationJobHandler method execute.
@Override
public void execute(AsyncContinuationConfiguration configuration, ExecutionEntity execution, CommandContext commandContext, String tenantId) {
LegacyBehavior.repairMultiInstanceAsyncJob(execution);
PvmAtomicOperation atomicOperation = findMatchingAtomicOperation(configuration.getAtomicOperation());
ensureNotNull("Cannot process job with configuration " + configuration, "atomicOperation", atomicOperation);
// reset transition id.
String transitionId = configuration.getTransitionId();
if (transitionId != null) {
PvmActivity activity = execution.getActivity();
TransitionImpl transition = (TransitionImpl) activity.findOutgoingTransition(transitionId);
execution.setTransition(transition);
}
Context.getCommandInvocationContext().performOperation(atomicOperation, execution);
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class MessageJobDeclaration method resolveJobHandlerConfiguration.
@Override
protected JobHandlerConfiguration resolveJobHandlerConfiguration(AtomicOperationInvocation context) {
AsyncContinuationConfiguration configuration = new AsyncContinuationConfiguration();
configuration.setAtomicOperation(context.getOperation().getCanonicalName());
ExecutionEntity execution = context.getExecution();
PvmActivity activity = execution.getActivity();
if (activity != null && activity.isAsyncAfter()) {
if (execution.getTransition() != null) {
// store id of selected transition in case this is async after.
// id is not serialized with the execution -> we need to remember it as
// job handler configuration.
configuration.setTransitionId(execution.getTransition().getId());
}
}
return configuration;
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class LegacyBehavior method eventSubprocessConcurrentChildExecutionEnded.
public static boolean eventSubprocessConcurrentChildExecutionEnded(ActivityExecution scopeExecution, ActivityExecution endedExecution) {
boolean performLegacyBehavior = isLegacyBehaviorRequired(endedExecution);
if (performLegacyBehavior) {
LOG.endConcurrentExecutionInEventSubprocess();
// notify the grandparent flow scope in a similar way PvmAtomicOperationAcitivtyEnd does
ScopeImpl flowScope = endedExecution.getActivity().getFlowScope();
if (flowScope != null) {
flowScope = flowScope.getFlowScope();
if (flowScope != null) {
if (flowScope == endedExecution.getActivity().getProcessDefinition()) {
endedExecution.remove();
scopeExecution.tryPruneLastConcurrentChild();
scopeExecution.forceUpdate();
} else {
PvmActivity flowScopeActivity = (PvmActivity) flowScope;
ActivityBehavior activityBehavior = flowScopeActivity.getActivityBehavior();
if (activityBehavior instanceof CompositeActivityBehavior) {
((CompositeActivityBehavior) activityBehavior).concurrentChildExecutionEnded(scopeExecution, endedExecution);
}
}
}
}
}
return performLegacyBehavior;
}
use of org.camunda.bpm.engine.impl.pvm.PvmActivity in project camunda-bpm-platform by camunda.
the class ProcessInstanceStartContext method getInstantiationStack.
@SuppressWarnings({ "unchecked", "rawtypes" })
public InstantiationStack getInstantiationStack() {
if (instantiationStack == null) {
FlowScopeWalker flowScopeWalker = new FlowScopeWalker(initial.getFlowScope());
ScopeCollector scopeCollector = new ScopeCollector();
flowScopeWalker.addPreVisitor(scopeCollector).walkWhile(new ReferenceWalker.WalkCondition<ScopeImpl>() {
public boolean isFulfilled(ScopeImpl element) {
return element == null || element == initial.getProcessDefinition();
}
});
List<PvmActivity> scopeActivities = (List) scopeCollector.getScopes();
Collections.reverse(scopeActivities);
instantiationStack = new InstantiationStack(scopeActivities, initial, null);
}
return instantiationStack;
}
Aggregations