Search in sources :

Example 26 with ScopeImpl

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());
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 27 with ScopeImpl

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());
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 28 with ScopeImpl

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));
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) Deployment(org.camunda.bpm.engine.test.Deployment)

Example 29 with ScopeImpl

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;
}
Also used : CompositeActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior) CancelBoundaryEventActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.CancelBoundaryEventActivityBehavior) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SubProcessActivityBehavior) MultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior) ReceiveTaskActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.ReceiveTaskActivityBehavior) CompensationEventActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.CompensationEventActivityBehavior) EventSubProcessActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.EventSubProcessActivityBehavior) CompositeActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior) SequentialMultiInstanceActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.SequentialMultiInstanceActivityBehavior) ActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior) CancelEndEventActivityBehavior(org.camunda.bpm.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 30 with ScopeImpl

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());
}
Also used : PvmScope(org.camunda.bpm.engine.impl.pvm.PvmScope) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)

Aggregations

ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)37 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)10 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)10 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)6 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)6 FlowScopeWalker (org.camunda.bpm.engine.impl.tree.FlowScopeWalker)5 HashMap (java.util.HashMap)4 List (java.util.List)4 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 ReferenceWalker (org.camunda.bpm.engine.impl.tree.ReferenceWalker)4 ArrayList (java.util.ArrayList)3 HashSet (java.util.HashSet)3 Map (java.util.Map)3 PvmScope (org.camunda.bpm.engine.impl.pvm.PvmScope)3 Deployment (org.camunda.bpm.engine.test.Deployment)3 MigratingActivityInstance (org.camunda.bpm.engine.impl.migration.instance.MigratingActivityInstance)2 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)2 JobEntity (org.camunda.bpm.engine.impl.persistence.entity.JobEntity)2 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)2 CompositeActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior)2