Search in sources :

Example 31 with PvmActivity

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

the class FoxAtomicOperationDeleteCascadeFireActivityEnd method eventNotificationsCompleted.

@Override
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    PvmActivity activity = execution.getActivity();
    if ((execution.isScope()) && (activity != null) && (!activity.isScope())) {
        execution.setActivity((PvmActivity) activity.getFlowScope());
        execution.performOperation(this);
    } else {
        if (execution.isScope()) {
            execution.destroy();
        }
        execution.remove();
    }
}
Also used : PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 32 with PvmActivity

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

the class PvmAtomicOperationActivityInitStack method execute.

public void execute(PvmExecutionImpl execution) {
    ExecutionStartContext executionStartContext = execution.getExecutionStartContext();
    InstantiationStack instantiationStack = executionStartContext.getInstantiationStack();
    List<PvmActivity> activityStack = instantiationStack.getActivities();
    PvmActivity currentActivity = activityStack.remove(0);
    PvmExecutionImpl propagatingExecution = execution;
    if (currentActivity.isScope()) {
        propagatingExecution = execution.createExecution();
        execution.setActive(false);
        propagatingExecution.setActivity(currentActivity);
        propagatingExecution.initialize();
    } else {
        propagatingExecution.setActivity(currentActivity);
    }
    // notify listeners for the instantiated activity
    propagatingExecution.performOperation(operationOnScopeInitialization);
}
Also used : InstantiationStack(org.camunda.bpm.engine.impl.pvm.runtime.InstantiationStack) PvmExecutionImpl(org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl) ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 33 with PvmActivity

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

the class PvmAtomicOperationTransitionNotifyListenerStart method eventNotificationsCompleted.

protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
    super.eventNotificationsCompleted(execution);
    TransitionImpl transition = execution.getTransition();
    PvmActivity destination;
    if (transition == null) {
        // this is null after async cont. -> transition is not stored in execution
        destination = execution.getActivity();
    } else {
        destination = transition.getDestination();
    }
    execution.setTransition(null);
    execution.setActivity(destination);
    ExecutionStartContext executionStartContext = execution.getExecutionStartContext();
    if (executionStartContext != null) {
        executionStartContext.executionStarted(execution);
        execution.disposeExecutionStartContext();
    }
    execution.dispatchDelayedEventsAndPerformOperation(ACTIVITY_EXECUTE);
}
Also used : TransitionImpl(org.camunda.bpm.engine.impl.pvm.process.TransitionImpl) ExecutionStartContext(org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity)

Example 34 with PvmActivity

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

the class ActivityBeforeInstantiationCmd method execute.

@Override
public Void execute(CommandContext commandContext) {
    ExecutionEntity processInstance = commandContext.getExecutionManager().findExecutionById(processInstanceId);
    ProcessDefinitionImpl processDefinition = processInstance.getProcessDefinition();
    PvmActivity activity = processDefinition.findActivity(activityId);
    // forbid instantiation of compensation boundary events
    if (activity != null && "compensationBoundaryCatch".equals(activity.getProperty("type"))) {
        throw new ProcessEngineException("Cannot start before activity " + activityId + "; activity " + "is a compensation boundary event.");
    }
    return super.execute(commandContext);
}
Also used : ExecutionEntity(org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity) ProcessDefinitionImpl(org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Example 35 with PvmActivity

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

the class ActivityAfterInstantiationCmd method findTransition.

protected TransitionImpl findTransition(ProcessDefinitionImpl processDefinition) {
    PvmActivity activity = processDefinition.findActivity(activityId);
    EnsureUtil.ensureNotNull(NotValidException.class, describeFailure("Activity '" + activityId + "' does not exist"), "activity", activity);
    if (activity.getOutgoingTransitions().isEmpty()) {
        throw new ProcessEngineException("Cannot start after activity " + activityId + "; activity " + "has no outgoing sequence flow to take");
    } else if (activity.getOutgoingTransitions().size() > 1) {
        throw new ProcessEngineException("Cannot start after activity " + activityId + "; " + "activity has more than one outgoing sequence flow");
    }
    return (TransitionImpl) activity.getOutgoingTransitions().get(0);
}
Also used : TransitionImpl(org.camunda.bpm.engine.impl.pvm.process.TransitionImpl) PvmActivity(org.camunda.bpm.engine.impl.pvm.PvmActivity) ProcessEngineException(org.camunda.bpm.engine.ProcessEngineException)

Aggregations

PvmActivity (org.camunda.bpm.engine.impl.pvm.PvmActivity)39 PvmExecutionImpl (org.camunda.bpm.engine.impl.pvm.runtime.PvmExecutionImpl)13 ProcessEngineException (org.camunda.bpm.engine.ProcessEngineException)9 PvmTransition (org.camunda.bpm.engine.impl.pvm.PvmTransition)7 ActivityExecution (org.camunda.bpm.engine.impl.pvm.delegate.ActivityExecution)6 ScopeImpl (org.camunda.bpm.engine.impl.pvm.process.ScopeImpl)6 ExecutionEntity (org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity)4 TransitionImpl (org.camunda.bpm.engine.impl.pvm.process.TransitionImpl)4 ReferenceWalker (org.camunda.bpm.engine.impl.tree.ReferenceWalker)4 ArrayList (java.util.ArrayList)3 PvmScope (org.camunda.bpm.engine.impl.pvm.PvmScope)3 ActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.ActivityBehavior)3 CompositeActivityBehavior (org.camunda.bpm.engine.impl.pvm.delegate.CompositeActivityBehavior)3 List (java.util.List)2 ActivityImpl (org.camunda.bpm.engine.impl.pvm.process.ActivityImpl)2 ProcessDefinitionImpl (org.camunda.bpm.engine.impl.pvm.process.ProcessDefinitionImpl)2 ExecutionStartContext (org.camunda.bpm.engine.impl.pvm.runtime.ExecutionStartContext)2 ActivityExecutionHierarchyWalker (org.camunda.bpm.engine.impl.tree.ActivityExecutionHierarchyWalker)2 ActivityExecutionMappingCollector (org.camunda.bpm.engine.impl.tree.ActivityExecutionMappingCollector)2 ActivityExecutionTuple (org.camunda.bpm.engine.impl.tree.ActivityExecutionTuple)2