Search in sources :

Example 1 with ActivityImpl

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

Example 2 with ActivityImpl

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

Example 3 with ActivityImpl

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

Example 4 with ActivityImpl

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

Example 5 with ActivityImpl

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

Aggregations

ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)70 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)12 ActivitiException (org.activiti.engine.ActivitiException)9 TransitionImpl (org.activiti.engine.impl.pvm.process.TransitionImpl)9 ProcessDefinitionEntity (org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity)8 PvmTransition (org.activiti.engine.impl.pvm.PvmTransition)7 ActivityExecution (org.activiti.engine.impl.pvm.delegate.ActivityExecution)6 ProcessDefinitionImpl (org.activiti.engine.impl.pvm.process.ProcessDefinitionImpl)6 ScopeImpl (org.activiti.engine.impl.pvm.process.ScopeImpl)6 ArrayList (java.util.ArrayList)5 IOSpecification (org.activiti.engine.impl.bpmn.data.IOSpecification)4 ActivityBehavior (org.activiti.engine.impl.pvm.delegate.ActivityBehavior)4 HashMap (java.util.HashMap)3 PvmProcessDefinition (org.activiti.engine.impl.pvm.PvmProcessDefinition)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)2 List (java.util.List)2 DataAssociation (org.activiti.bpmn.model.DataAssociation)2 EventDefinition (org.activiti.bpmn.model.EventDefinition)2