Search in sources :

Example 16 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.

the class CaseExecutionImpl method createSubProcessInstance.

public PvmExecutionImpl createSubProcessInstance(PvmProcessDefinition processDefinition, String businessKey, String caseInstanceId) {
    ExecutionImpl subProcessInstance = (ExecutionImpl) processDefinition.createProcessInstance(businessKey, caseInstanceId);
    // manage bidirectional super-subprocess relation
    subProcessInstance.setSuperCaseExecution(this);
    setSubProcessInstance(subProcessInstance);
    return subProcessInstance;
}
Also used : ExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)

Example 17 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.

the class MigratingActivityInstanceVisitor method instantiateScopes.

protected void instantiateScopes(MigratingScopeInstance ancestorScopeInstance, MigratingScopeInstanceBranch executionBranch, List<ScopeImpl> scopesToInstantiate) {
    if (scopesToInstantiate.isEmpty()) {
        return;
    }
    // must always be an activity instance
    MigratingActivityInstance ancestorActivityInstance = (MigratingActivityInstance) ancestorScopeInstance;
    ExecutionEntity newParentExecution = ancestorActivityInstance.createAttachableExecution();
    Map<PvmActivity, PvmExecutionImpl> createdExecutions = newParentExecution.instantiateScopes((List) scopesToInstantiate, skipCustomListeners, skipIoMappings);
    for (ScopeImpl scope : scopesToInstantiate) {
        ExecutionEntity createdExecution = (ExecutionEntity) createdExecutions.get(scope);
        createdExecution.setActivity(null);
        createdExecution.setActive(false);
        executionBranch.visited(new MigratingActivityInstance(scope, createdExecution));
    }
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) ScopeImpl(org.camunda.bpm.engine.impl.pvm.process.ScopeImpl) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 18 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.

the class ProcessDefinitionImpl method createProcessInstance.

public PvmProcessInstance createProcessInstance(String businessKey, String caseInstanceId, ActivityImpl initial) {
    PvmExecutionImpl processInstance = (PvmExecutionImpl) createProcessInstanceForInitial(initial);
    processInstance.setBusinessKey(businessKey);
    processInstance.setCaseInstanceId(caseInstanceId);
    return processInstance;
}
Also used : PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)

Example 19 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.

the class ActivityExecutionHierarchyWalker method nextElement.

@Override
protected ActivityExecutionTuple nextElement() {
    PvmScope currentScope = getCurrentElement().getScope();
    PvmScope flowScope = currentScope.getFlowScope();
    if (flowScope != null) {
        // walk to parent scope
        PvmExecutionImpl execution = activityExecutionMapping.get(flowScope);
        return new ActivityExecutionTuple(flowScope, execution);
    } else {
        // this is the process instance, look for parent
        PvmExecutionImpl currentExecution = activityExecutionMapping.get(currentScope);
        PvmExecutionImpl superExecution = currentExecution.getSuperExecution();
        if (superExecution != null) {
            // walk to parent process instance
            activityExecutionMapping = superExecution.createActivityExecutionMapping();
            return createTupel(superExecution);
        } else {
            // this is the top level process instance
            return null;
        }
    }
}
Also used : PvmScope(org.camunda.bpm.engine.impl.pvm.PvmScope) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)

Example 20 with PvmExecutionImpl

use of org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl in project camunda-bpm-platform by camunda.

the class OutputVariablesPropagator method visit.

@Override
public void visit(ActivityExecution execution) {
    if (isProcessInstanceOfSubprocess(execution)) {
        PvmExecutionImpl superExecution = (PvmExecutionImpl) execution.getSuperExecution();
        ActivityImpl activity = superExecution.getActivity();
        SubProcessActivityBehavior subProcessActivityBehavior = (SubProcessActivityBehavior) activity.getActivityBehavior();
        subProcessActivityBehavior.passOutputVariables(superExecution, execution);
    }
}
Also used : ActivityImpl(org.camunda.bpm.engine.impl.pvm.process.ActivityImpl) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) SubProcessActivityBehavior(org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)

Aggregations

PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)38 PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)13 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)7 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)7 ArrayList (java.util.ArrayList)6 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)6 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)4 Map (java.util.Map)3 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)3 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)3 SubProcessActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.SubProcessActivityBehavior)3 HashMap (java.util.HashMap)2 TransferVariablesActivityBehavior (org.camunda.bpm.engine.impl.cmmn.behavior.TransferVariablesActivityBehavior)2 ActivityInstanceImpl (org.camunda.bpm.engine.impl.persistence.entity.ActivityInstanceImpl)2 EventSubscriptionEntity (org.camunda.bpm.engine.impl.persistence.entity.EventSubscriptionEntity)2 ProcessDefinitionBuilder (org.camunda.bpm.engine.impl.pvm.ProcessDefinitionBuilder)2 PvmProcessDefinition (org.camunda.bpm.engine.impl.pvm.PvmProcessDefinition)2 PvmProcessInstance (org.camunda.bpm.engine.impl.pvm.PvmProcessInstance)2 PvmScope (org.camunda.bpm.engine.impl.pvm.PvmScope)2 CompositeActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior)2