Search in sources :

Example 31 with ActivityImpl

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);
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent)

Example 32 with ActivityImpl

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());
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) ProcessDefinitionEntity(org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)

Example 33 with ActivityImpl

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);
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ExtensionElement(org.activiti.bpmn.model.ExtensionElement) List(java.util.List)

Example 34 with ActivityImpl

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);
        }
    }
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ActivityExecution(org.activiti.engine.impl.pvm.delegate.ActivityExecution)

Example 35 with ActivityImpl

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);
}
Also used : ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) ActivityExecution(org.activiti.engine.impl.pvm.delegate.ActivityExecution) InterpretableExecution(org.activiti.engine.impl.pvm.runtime.InterpretableExecution)

Aggregations

ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)83 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)15 ActivitiException (org.activiti.engine.ActivitiException)14 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)11 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)9 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)7 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)7 TransitionImpl (org.activiti.engine.impl.pvm.process.TransitionImpl)7 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)6 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)6 ArrayList (java.util.ArrayList)5 List (java.util.List)5 EventDefinition (org.activiti.bpmn.model.EventDefinition)4 StartEvent (org.activiti.bpmn.model.StartEvent)4 IOSpecification (org.activiti.engine.impl.bpmn.data.IOSpecification)4 ActivityBehavior (org.activiti.engine.impl.pvm.delegate.ActivityBehavior)4 HashMap (java.util.HashMap)3 BpmnModel (org.activiti.bpmn.model.BpmnModel)3 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)3 SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)3