use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class PvmAtomicOperationActivityInitStackNotifyListenerStart method eventNotificationsCompleted.
protected void eventNotificationsCompleted(PvmExecutionImpl execution) {
super.eventNotificationsCompleted(execution);
execution.activityInstanceStarted();
ExecutionStartContext startContext = execution.getExecutionStartContext();
InstantiationStack instantiationStack = startContext.getInstantiationStack();
PvmExecutionImpl propagatingExecution = execution;
ActivityImpl activity = execution.getActivity();
if (activity.getActivityBehavior() instanceof ModificationObserverBehavior) {
ModificationObserverBehavior behavior = (ModificationObserverBehavior) activity.getActivityBehavior();
List<ActivityExecution> concurrentExecutions = behavior.initializeScope(propagatingExecution, 1);
propagatingExecution = (PvmExecutionImpl) concurrentExecutions.get(0);
}
// if the stack has been instantiated
if (instantiationStack.getActivities().isEmpty() && instantiationStack.getTargetActivity() != null) {
// as if we are entering the target activity instance id via a transition
propagatingExecution.setActivityInstanceId(null);
// execute the target activity with this execution
startContext.applyVariables(propagatingExecution);
propagatingExecution.setActivity(instantiationStack.getTargetActivity());
propagatingExecution.performOperation(ACTIVITY_START_CREATE_SCOPE);
} else if (instantiationStack.getActivities().isEmpty() && instantiationStack.getTargetTransition() != null) {
// as if we are entering the target activity instance id via a transition
propagatingExecution.setActivityInstanceId(null);
// execute the target transition with this execution
PvmTransition transition = instantiationStack.getTargetTransition();
startContext.applyVariables(propagatingExecution);
propagatingExecution.setActivity(transition.getSource());
propagatingExecution.setTransition((TransitionImpl) transition);
propagatingExecution.performOperation(TRANSITION_START_NOTIFY_LISTENER_TAKE);
} else {
// else instantiate the activity stack further
propagatingExecution.setActivity(null);
propagatingExecution.performOperation(ACTIVITY_INIT_STACK);
}
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class DefaultConditionHandler method evaluateConditionStartByProcessDefinitionId.
protected List<ConditionHandlerResult> evaluateConditionStartByProcessDefinitionId(CommandContext commandContext, ConditionSet conditionSet, String processDefinitionId) {
DeploymentCache deploymentCache = commandContext.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinition = deploymentCache.findDeployedProcessDefinitionById(processDefinitionId);
List<ConditionHandlerResult> results = new ArrayList<ConditionHandlerResult>();
if (processDefinition != null && !processDefinition.isSuspended()) {
List<ActivityImpl> activities = findConditionalStartEventActivities(processDefinition);
if (activities.isEmpty()) {
throw LOG.exceptionWhenEvaluatingConditionalStartEventByProcessDefinition(processDefinitionId);
}
for (ActivityImpl activity : activities) {
if (evaluateCondition(conditionSet, activity)) {
results.add(new ConditionHandlerResult(processDefinition, activity));
}
}
}
return results;
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class ProcessDefinitionBuilder method attachedTo.
public ProcessDefinitionBuilder attachedTo(String id, boolean isInterrupting) {
ActivityImpl activity = getActivity();
activity.setEventScope(processDefinition.findActivity(id));
if (isInterrupting) {
activity.setActivityStartBehavior(ActivityStartBehavior.INTERRUPT_EVENT_SCOPE);
} else {
activity.setActivityStartBehavior(ActivityStartBehavior.CONCURRENT_IN_FLOW_SCOPE);
}
return this;
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class PvmAtomicOperationDeleteCascadeFireActivityEnd method getFlowScopeActivity.
protected ActivityImpl getFlowScopeActivity(PvmActivity activity) {
ScopeImpl flowScope = activity.getFlowScope();
ActivityImpl flowScopeActivity = null;
if (flowScope.getProcessDefinition() != flowScope) {
flowScopeActivity = (ActivityImpl) flowScope;
}
return flowScopeActivity;
}
use of org.camunda.bpm.engine.impl.pvm.process.ActivityImpl in project camunda-bpm-platform by camunda.
the class DefaultJobRetryCmd method getCurrentActivity.
protected ActivityImpl getCurrentActivity(CommandContext commandContext, JobEntity job) {
String type = job.getJobHandlerType();
ActivityImpl activity = null;
if (SUPPORTED_TYPES.contains(type)) {
DeploymentCache deploymentCache = Context.getProcessEngineConfiguration().getDeploymentCache();
ProcessDefinitionEntity processDefinitionEntity = deploymentCache.findDeployedProcessDefinitionById(job.getProcessDefinitionId());
activity = processDefinitionEntity.findActivity(job.getActivityId());
} else {
// noop, because activity type is not supported
}
return activity;
}
Aggregations