use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class FlowNodeHistoryParseHandler method parse.
public void parse(BpmnParse bpmnParse, BaseElement element) {
ActivityImpl activity = bpmnParse.getCurrentScope().findActivity(element.getId());
if (element instanceof BoundaryEvent) {
// A boundary-event never receives an activity start-event
activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_END, ACTIVITY_INSTANCE_START_LISTENER, 0);
activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_END, ACTIVITI_INSTANCE_END_LISTENER, 1);
} else {
activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_START, ACTIVITY_INSTANCE_START_LISTENER, 0);
activity.addExecutionListener(org.activiti.engine.impl.pvm.PvmEvent.EVENTNAME_END, ACTIVITI_INSTANCE_END_LISTENER);
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class TimerStartEventJobHandler method startProcessInstanceWithInitialActivity.
protected void startProcessInstanceWithInitialActivity(JobEntity job, String configuration, DeploymentManager deploymentManager, CommandContext commandContext) {
ProcessDefinitionEntity processDefinition = deploymentManager.findDeployedProcessDefinitionById(job.getProcessDefinitionId());
String activityId = getActivityIdFromConfiguration(configuration);
ActivityImpl startActivity = processDefinition.findActivity(activityId);
if (!deploymentManager.isProcessDefinitionSuspended(processDefinition.getId())) {
dispatchTimerFiredEvent(job, commandContext);
ExecutionEntity processInstance = processDefinition.createProcessInstance(null, startActivity);
processInstance.start();
} else {
log.debug("Ignoring timer of suspended process definition {}", processDefinition.getId());
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class CustomSequenceFlowBpmnParseHandler method executeParse.
protected void executeParse(BpmnParse bpmnParse, SequenceFlow flow) {
// Do the regular stuff
super.executeParse(bpmnParse, flow);
// Add extension element conditions
Map<String, List<ExtensionElement>> extensionElements = flow.getExtensionElements();
if (extensionElements.containsKey("activiti_custom_condition")) {
List<ExtensionElement> conditionsElements = extensionElements.get("activiti_custom_condition");
CustomSetConditionsExecutionListener customFlowListener = new CustomSetConditionsExecutionListener();
customFlowListener.setFlowId(flow.getId());
for (ExtensionElement conditionElement : conditionsElements) {
customFlowListener.addCondition(conditionElement.getElementText());
}
ActivityImpl activity = findActivity(bpmnParse, flow.getSourceRef());
activity.addExecutionListener("start", customFlowListener);
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class TerminateEndEventActivityBehavior method execute.
public void execute(ActivityExecution execution) throws Exception {
ActivityImpl terminateEndEventActivity = (ActivityImpl) execution.getActivity();
if (terminateAll) {
ActivityExecution processInstanceExecution = findRootProcessInstanceExecution((ExecutionEntity) execution);
terminateProcessInstanceExecution(execution, terminateEndEventActivity, processInstanceExecution);
} else {
ActivityExecution scopeExecution = ScopeUtil.findScopeExecution(execution);
if (scopeExecution != null) {
terminateExecution(execution, terminateEndEventActivity, scopeExecution);
}
}
}
use of org.activiti.engine.impl.pvm.process.ActivityImpl in project Activiti by Activiti.
the class EventSubProcessStartEventActivityBehavior method execute.
@Override
public void execute(ActivityExecution execution) throws Exception {
InterpretableExecution interpretableExecution = (InterpretableExecution) execution;
ActivityImpl activity = interpretableExecution.getProcessDefinition().findActivity(activityId);
ActivityExecution outgoingExecution = execution;
if (isInterrupting) {
execution.destroyScope("Event subprocess triggered using activity " + activityId);
} else {
outgoingExecution = execution.createExecution();
outgoingExecution.setActive(true);
outgoingExecution.setScope(false);
outgoingExecution.setConcurrent(true);
}
// set the outgoing execution to this activity
((InterpretableExecution) outgoingExecution).setActivity(activity);
// continue execution
outgoingExecution.takeAll(activity.getOutgoingTransitions(), Collections.EMPTY_LIST);
}
Aggregations