use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class BpmnParseTest method testParseCompensationHandlerOfMiActivity.
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.compensationMiActivity.bpmn20.xml")
public void testParseCompensationHandlerOfMiActivity() {
ActivityImpl miActivity = findActivityInDeployedProcessDefinition("undoBookHotel");
ScopeImpl flowScope = miActivity.getFlowScope();
assertEquals(ActivityTypes.MULTI_INSTANCE_BODY, flowScope.getProperty(BpmnParse.PROPERTYNAME_TYPE));
assertEquals("bookHotel" + BpmnParse.MULTI_INSTANCE_BODY_ID_SUFFIX, ((ActivityImpl) flowScope).getActivityId());
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class BpmnParseTest method testParseCompensationHandlerOfMiSubprocess.
@Deployment(resources = "org/camunda/bpm/engine/test/bpmn/event/compensate/CompensateEventTest.compensationMiSubprocess.bpmn20.xml")
public void testParseCompensationHandlerOfMiSubprocess() {
ActivityImpl miActivity = findActivityInDeployedProcessDefinition("undoBookHotel");
ScopeImpl flowScope = miActivity.getFlowScope();
assertEquals(ActivityTypes.MULTI_INSTANCE_BODY, flowScope.getProperty(BpmnParse.PROPERTYNAME_TYPE));
assertEquals("scope" + BpmnParse.MULTI_INSTANCE_BODY_ID_SUFFIX, ((ActivityImpl) flowScope).getActivityId());
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class BpmnParseTest method testParseCompensationStartEvent.
@Deployment
public void testParseCompensationStartEvent() {
ActivityImpl compensationStartEvent = findActivityInDeployedProcessDefinition("compensationStartEvent");
assertEquals("compensationStartEvent", compensationStartEvent.getProperty("type"));
assertEquals(EventSubProcessStartEventActivityBehavior.class, compensationStartEvent.getActivityBehavior().getClass());
ActivityImpl compensationEventSubProcess = (ActivityImpl) compensationStartEvent.getFlowScope();
assertEquals(Boolean.TRUE, compensationEventSubProcess.getProperty(BpmnParse.PROPERTYNAME_IS_FOR_COMPENSATION));
ScopeImpl subprocess = compensationEventSubProcess.getFlowScope();
assertEquals(compensationEventSubProcess.getActivityId(), subprocess.getProperty(BpmnParse.PROPERTYNAME_COMPENSATION_HANDLER_ID));
}
use of org.camunda.bpm.engine.impl.pvm.process.ScopeImpl 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.process.ScopeImpl in project camunda-bpm-platform by camunda.
the class LegacyBehavior method isLegacyBehaviorRequired.
/**
* This method
* @param scopeExecution
* @param isLegacyBehaviorTurnedOff
* @return
*/
protected static boolean isLegacyBehaviorRequired(ActivityExecution scopeExecution) {
// legacy behavior is turned off: the current activity was parsed as scope.
// now we need to check whether a scope execution was correctly created for the
// event subprocess.
// first create the mapping:
Map<ScopeImpl, PvmExecutionImpl> activityExecutionMapping = scopeExecution.createActivityExecutionMapping();
// if the scope execution for the current activity is the same as for the parent scope
// -> we need to perform legacy behavior
PvmScope activity = scopeExecution.getActivity();
if (!activity.isScope()) {
activity = activity.getFlowScope();
}
return activityExecutionMapping.get(activity) == activityExecutionMapping.get(activity.getFlowScope());
}
Aggregations