use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior in project camunda-bpm-platform by camunda.
the class BpmnParse method parseBoundaryCancelEventDefinition.
protected ActivityBehavior parseBoundaryCancelEventDefinition(Element cancelEventDefinition, ActivityImpl activity) {
activity.getProperties().set(BpmnProperties.TYPE, ActivityTypes.BOUNDARY_CANCEL);
LegacyBehavior.parseCancelBoundaryEvent(activity);
ActivityImpl transaction = (ActivityImpl) activity.getEventScope();
if (transaction.getActivityBehavior() != null && transaction.getActivityBehavior() instanceof MultiInstanceActivityBehavior) {
transaction = transaction.getActivities().get(0);
}
if (!"transaction".equals(transaction.getProperty(BpmnProperties.TYPE.getName()))) {
addError("boundary event with cancelEventDefinition only supported on transaction subprocesses", cancelEventDefinition);
}
// ensure there is only one cancel boundary event
for (ActivityImpl sibling : activity.getFlowScope().getActivities()) {
if ("cancelBoundaryCatch".equals(sibling.getProperty(BpmnProperties.TYPE.getName())) && sibling != activity && sibling.getEventScope() == transaction) {
addError("multiple boundary events with cancelEventDefinition not supported on same transaction subprocess", cancelEventDefinition);
}
}
// find all cancel end events
for (ActivityImpl childActivity : transaction.getActivities()) {
ActivityBehavior activityBehavior = childActivity.getActivityBehavior();
if (activityBehavior != null && activityBehavior instanceof CancelEndEventActivityBehavior) {
((CancelEndEventActivityBehavior) activityBehavior).setCancelBoundaryEvent(activity);
}
}
return new CancelBoundaryEventActivityBehavior();
}
use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior 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.delegate.ActivityBehavior in project camunda-bpm-platform by camunda.
the class LegacyBehavior method wasNoScope72.
protected static boolean wasNoScope72(ActivityImpl activity) {
ActivityBehavior activityBehavior = activity.getActivityBehavior();
ActivityBehavior parentActivityBehavior = (ActivityBehavior) (activity.getFlowScope() != null ? activity.getFlowScope().getActivityBehavior() : null);
return (activityBehavior instanceof EventSubProcessActivityBehavior) || (activityBehavior instanceof SubProcessActivityBehavior && parentActivityBehavior instanceof SequentialMultiInstanceActivityBehavior) || (activityBehavior instanceof ReceiveTaskActivityBehavior && parentActivityBehavior instanceof MultiInstanceActivityBehavior);
}
use of org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior in project camunda-bpm-platform by camunda.
the class EventBasedGatewayActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
// If conditional events exist after the event based gateway they should be evaluated.
// If a condition is satisfied the event based gateway should be left,
// otherwise the event based gateway is a wait state
ActivityImpl eventBasedGateway = (ActivityImpl) execution.getActivity();
for (ActivityImpl act : eventBasedGateway.getEventActivities()) {
ActivityBehavior activityBehavior = act.getActivityBehavior();
if (activityBehavior instanceof ConditionalEventBehavior) {
ConditionalEventBehavior conditionalEventBehavior = (ConditionalEventBehavior) activityBehavior;
ConditionalEventDefinition conditionalEventDefinition = conditionalEventBehavior.getConditionalEventDefinition();
if (conditionalEventDefinition.tryEvaluate(execution)) {
((ExecutionEntity) execution).executeEventHandlerActivity(conditionalEventDefinition.getConditionalActivity());
return;
}
}
}
}
Aggregations