Search in sources :

Example 6 with ActivityBehavior

use of org.activiti.engine.impl.delegate.ActivityBehavior in project Activiti by Activiti.

the class ContinueProcessOperation method executeBoundaryEvents.

protected void executeBoundaryEvents(Collection<BoundaryEvent> boundaryEvents, ExecutionEntity execution) {
    // The parent execution becomes a scope, and a child execution is created for each of the boundary events
    for (BoundaryEvent boundaryEvent : boundaryEvents) {
        if (CollectionUtil.isEmpty(boundaryEvent.getEventDefinitions()) || (boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition)) {
            continue;
        }
        // A Child execution of the current execution is created to represent the boundary event being active
        ExecutionEntity childExecutionEntity = commandContext.getExecutionEntityManager().createChildExecution((ExecutionEntity) execution);
        childExecutionEntity.setParentId(execution.getId());
        childExecutionEntity.setCurrentFlowElement(boundaryEvent);
        childExecutionEntity.setScope(false);
        ActivityBehavior boundaryEventBehavior = ((ActivityBehavior) boundaryEvent.getBehavior());
        logger.debug("Executing boundary event activityBehavior {} with execution {}", boundaryEventBehavior.getClass(), childExecutionEntity.getId());
        boundaryEventBehavior.execute(childExecutionEntity);
    }
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) MultiInstanceActivityBehavior(org.activiti.engine.impl.bpmn.behavior.MultiInstanceActivityBehavior) ActivityBehavior(org.activiti.engine.impl.delegate.ActivityBehavior) CompensateEventDefinition(org.activiti.bpmn.model.CompensateEventDefinition)

Example 7 with ActivityBehavior

use of org.activiti.engine.impl.delegate.ActivityBehavior in project Activiti by Activiti.

the class MultiInstanceActivityBehavior method executeCompensationBoundaryEvents.

protected void executeCompensationBoundaryEvents(FlowElement flowElement, DelegateExecution execution) {
    // Execute compensation boundary events
    Collection<BoundaryEvent> boundaryEvents = findBoundaryEventsForFlowNode(execution.getProcessDefinitionId(), flowElement);
    if (CollectionUtil.isNotEmpty(boundaryEvents)) {
        // The parent execution becomes a scope, and a child execution is created for each of the boundary events
        for (BoundaryEvent boundaryEvent : boundaryEvents) {
            if (CollectionUtil.isEmpty(boundaryEvent.getEventDefinitions())) {
                continue;
            }
            if (boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
                ExecutionEntity childExecutionEntity = Context.getCommandContext().getExecutionEntityManager().createChildExecution((ExecutionEntity) execution);
                childExecutionEntity.setParentId(execution.getId());
                childExecutionEntity.setCurrentFlowElement(boundaryEvent);
                childExecutionEntity.setScope(false);
                ActivityBehavior boundaryEventBehavior = ((ActivityBehavior) boundaryEvent.getBehavior());
                boundaryEventBehavior.execute(childExecutionEntity);
            }
        }
    }
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ExecutionEntity(org.activiti.engine.impl.persistence.entity.ExecutionEntity) SubProcessActivityBehavior(org.activiti.engine.impl.delegate.SubProcessActivityBehavior) ActivityBehavior(org.activiti.engine.impl.delegate.ActivityBehavior) CompensateEventDefinition(org.activiti.bpmn.model.CompensateEventDefinition)

Aggregations

ActivityBehavior (org.activiti.engine.impl.delegate.ActivityBehavior)7 BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)4 CompensateEventDefinition (org.activiti.bpmn.model.CompensateEventDefinition)3 ExecutionEntity (org.activiti.engine.impl.persistence.entity.ExecutionEntity)3 ActivitiException (org.activiti.engine.ActivitiException)2 AbstractBpmnActivityBehavior (org.activiti.engine.impl.bpmn.behavior.AbstractBpmnActivityBehavior)2 AdhocSubProcessActivityBehavior (org.activiti.engine.impl.bpmn.behavior.AdhocSubProcessActivityBehavior)2 BoundaryCancelEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundaryCancelEventActivityBehavior)2 BoundaryCompensateEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundaryCompensateEventActivityBehavior)2 BoundaryEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundaryEventActivityBehavior)2 BoundaryMessageEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundaryMessageEventActivityBehavior)2 BoundarySignalEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundarySignalEventActivityBehavior)2 BoundaryTimerEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.BoundaryTimerEventActivityBehavior)2 CallActivityBehavior (org.activiti.engine.impl.bpmn.behavior.CallActivityBehavior)2 CancelEndEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.CancelEndEventActivityBehavior)2 ErrorEndEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.ErrorEndEventActivityBehavior)2 EventBasedGatewayActivityBehavior (org.activiti.engine.impl.bpmn.behavior.EventBasedGatewayActivityBehavior)2 EventSubProcessErrorStartEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.EventSubProcessErrorStartEventActivityBehavior)2 EventSubProcessMessageStartEventActivityBehavior (org.activiti.engine.impl.bpmn.behavior.EventSubProcessMessageStartEventActivityBehavior)2 ExclusiveGatewayActivityBehavior (org.activiti.engine.impl.bpmn.behavior.ExclusiveGatewayActivityBehavior)2