2 * Copyright 2017 ZTE Corporation.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package org.activiti.engine.impl.pvm.runtime;
18 import java.util.List;
21 import org.activiti.engine.delegate.event.ActivitiEventType;
22 import org.activiti.engine.delegate.event.impl.ActivitiEventBuilder;
23 import org.activiti.engine.impl.context.Context;
24 import org.activiti.engine.impl.pvm.process.ActivityImpl;
25 import org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl;
26 import org.activiti.engine.impl.pvm.process.ScopeImpl;
28 public class AtomicOperationProcessStart extends AbstractEventAtomicOperation {
30 public boolean isAsync(InterpretableExecution execution) {
34 protected ScopeImpl getScope(InterpretableExecution execution) {
35 return execution.getProcessDefinition();
38 protected String getEventName() {
42 protected void eventNotificationsCompleted(InterpretableExecution execution) {
43 if ((Context.getProcessEngineConfiguration() != null)
44 && (Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled())) {
45 Map variablesMap = null;
47 variablesMap = execution.getVariables();
48 } catch (Throwable localThrowable) {
51 .getProcessEngineConfiguration()
54 ActivitiEventBuilder.createEntityWithVariablesEvent(
55 ActivitiEventType.ENTITY_INITIALIZED, execution, variablesMap, false));
58 .getProcessEngineConfiguration()
61 ActivitiEventBuilder.createProcessStartedEvent(execution, variablesMap, false));
64 ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
65 StartingExecution startingExecution = execution.getStartingExecution();
66 List initialActivityStack =
67 processDefinition.getInitialActivityStack(startingExecution.getInitial());
68 execution.setActivity((ActivityImpl) initialActivityStack.get(0));
69 execution.performOperation(PROCESS_START_INITIAL);