use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class CdiEventSupportBpmnParseHandler method parse.
public void parse(BpmnParse bpmnParse, BaseElement element) {
if (element instanceof SequenceFlow) {
TransitionImpl transition = bpmnParse.getSequenceFlows().get(element.getId());
transition.addExecutionListener(new CdiExecutionListener(transition.getId()));
} else {
ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(element.getId());
if (element instanceof UserTask) {
addCreateListener(activity);
addAssignListener(activity);
addCompleteListener(activity);
addDeleteListener(activity);
}
if (activity != null) {
addStartEventListener(activity);
addEndEventListener(activity);
}
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class ProcessDefinitionBuilder method createActivity.
public ProcessDefinitionBuilder createActivity(String id) {
ActivityImpl activity = scopeStack.peek().createActivity(id);
scopeStack.push(activity);
processElement = activity;
transition = null;
return this;
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class AtomicOperationDeleteCascadeFireActivityEnd method eventNotificationsCompleted.
@Override
protected void eventNotificationsCompleted(InterpretableExecution execution) {
ActivityImpl activity = (ActivityImpl) execution.getActivity();
if ((execution.isScope()) && (activity != null)) {
execution.setActivity(activity.getParentActivity());
execution.performOperation(AtomicOperation.DELETE_CASCADE_FIRE_ACTIVITY_END);
} else {
if (execution.isScope()) {
execution.destroy();
}
execution.remove();
if (!execution.isDeleteRoot()) {
InterpretableExecution parent = (InterpretableExecution) execution.getParent();
if (parent != null) {
parent.performOperation(AtomicOperation.DELETE_CASCADE);
}
}
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class AtomicOperationProcessEnd method eventNotificationsCompleted.
@Override
protected void eventNotificationsCompleted(InterpretableExecution execution) {
InterpretableExecution superExecution = execution.getSuperExecution();
SubProcessActivityBehavior subProcessActivityBehavior = null;
// copy variables before destroying the ended sub process instance
if (superExecution != null) {
ActivityImpl activity = (ActivityImpl) superExecution.getActivity();
subProcessActivityBehavior = (SubProcessActivityBehavior) activity.getActivityBehavior();
try {
subProcessActivityBehavior.completing(superExecution, execution);
} catch (RuntimeException e) {
log.error("Error while completing sub process of execution {}", execution, e);
throw e;
} catch (Exception e) {
log.error("Error while completing sub process of execution {}", execution, e);
throw new ActivitiException("Error while completing sub process of execution " + execution, e);
}
}
execution.destroy();
execution.remove();
// and trigger execution afterwards
if (superExecution != null) {
superExecution.setSubProcessInstance(null);
try {
subProcessActivityBehavior.completed(superExecution);
} catch (RuntimeException e) {
log.error("Error while completing sub process of execution {}", execution, e);
throw e;
} catch (Exception e) {
log.error("Error while completing sub process of execution {}", execution, e);
throw new ActivitiException("Error while completing sub process of execution " + execution, e);
}
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class AtomicOperationProcessStart method eventNotificationsCompleted.
@Override
protected void eventNotificationsCompleted(InterpretableExecution execution) {
if (Context.getProcessEngineConfiguration() != null && Context.getProcessEngineConfiguration().getEventDispatcher().isEnabled()) {
Map<String, Object> variablesMap = null;
try {
variablesMap = execution.getVariables();
} catch (Throwable t) {
// In some rare cases getting the execution variables can fail (JPA entity load failure for example)
// We ignore the exception here, because it's only meant to include variables in the initialized event.
}
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createEntityWithVariablesEvent(ActivitiEventType.ENTITY_INITIALIZED, execution, variablesMap, false));
Context.getProcessEngineConfiguration().getEventDispatcher().dispatchEvent(ActivitiEventBuilder.createProcessStartedEvent(execution, variablesMap, false));
}
ProcessDefinitionImpl processDefinition = execution.getProcessDefinition();
StartingExecution startingExecution = execution.getStartingExecution();
List<ActivityImpl> initialActivityStack = processDefinition.getInitialActivityStack(startingExecution.getInitial());
execution.setActivity(initialActivityStack.get(0));
execution.performOperation(PROCESS_START_INITIAL);
}
Aggregations