Search in sources :

Example 6 with BoundaryEvent

use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.

the class CompensateEventDefinitionParseHandler method executeParse.

protected void executeParse(BpmnParse bpmnParse, CompensateEventDefinition eventDefinition) {
    ScopeImpl scope = bpmnParse.getCurrentScope();
    if (StringUtils.isNotEmpty(eventDefinition.getActivityRef())) {
        if (scope.findActivity(eventDefinition.getActivityRef()) == null) {
            logger.warn("Invalid attribute value for 'activityRef': no activity with id '" + eventDefinition.getActivityRef() + "' in current scope " + scope.getId());
        }
    }
    org.activiti.engine.impl.bpmn.parser.CompensateEventDefinition compensateEventDefinition = new org.activiti.engine.impl.bpmn.parser.CompensateEventDefinition();
    compensateEventDefinition.setActivityRef(eventDefinition.getActivityRef());
    compensateEventDefinition.setWaitForCompletion(eventDefinition.isWaitForCompletion());
    ActivityImpl activity = bpmnParse.getCurrentActivity();
    if (bpmnParse.getCurrentFlowElement() instanceof ThrowEvent) {
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createIntermediateThrowCompensationEventActivityBehavior((ThrowEvent) bpmnParse.getCurrentFlowElement(), compensateEventDefinition));
    } else if (bpmnParse.getCurrentFlowElement() instanceof BoundaryEvent) {
        BoundaryEvent boundaryEvent = (BoundaryEvent) bpmnParse.getCurrentFlowElement();
        boolean interrupting = boundaryEvent.isCancelActivity();
        activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createBoundaryEventActivityBehavior(boundaryEvent, interrupting, activity));
        activity.setProperty("type", "compensationBoundaryCatch");
    } else {
    // What to do?
    }
}
Also used : ThrowEvent(org.activiti.bpmn.model.ThrowEvent) ActivityImpl(org.activiti.engine.impl.pvm.process.ActivityImpl) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) ScopeImpl(org.activiti.engine.impl.pvm.process.ScopeImpl) CompensateEventDefinition(org.activiti.bpmn.model.CompensateEventDefinition)

Example 7 with BoundaryEvent

use of org.activiti.bpmn.model.BoundaryEvent 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 8 with BoundaryEvent

use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.

the class FeedbackStepDefinitionConverter method createProcessArtifact.

@Override
protected Map<String, BaseElement> createProcessArtifact(FeedbackStepDefinition feedbackStepDefinition, WorkflowDefinitionConversion conversion) {
    // See feedback-step.png in the resource folder to get a graphical understanding of the conversion below
    Map<String, BaseElement> processElements = new HashMap<String, BaseElement>();
    // The first user task, responsible for configuring the feedback
    UserTask selectPeopleUserTask = createSelectPeopleUserTask(feedbackStepDefinition, conversion, processElements);
    // Parallel gateways (forking/joining)
    ParallelGateway fork = createForkParallelGateway(conversion, processElements);
    addSequenceFlow(conversion, selectPeopleUserTask, fork);
    // Gather feedback user task for the initiator of the feedback step
    UserTask gatherFeedbackUserTask = createGatherFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
    addSequenceFlow(conversion, fork, gatherFeedbackUserTask);
    // Global signal event
    Signal signal = createSignalDeclaration(conversion);
    // Signal throw event after the gather feedback task
    ThrowEvent signalThrowEvent = createSignalThrow(conversion, signal);
    addSequenceFlow(conversion, gatherFeedbackUserTask, signalThrowEvent);
    // Povide feedback step
    UserTask feedbackTask = createFeedbackUserTask(feedbackStepDefinition, conversion, processElements);
    addSequenceFlow(conversion, fork, feedbackTask);
    // Boundary signal catch to shut down all tasks if the 'gather feedback' task is completed
    BoundaryEvent boundarySignalCatch = createBoundarySignalCatch(conversion, signal, feedbackTask);
    // Exclusive gateway after the feedback task, needed to correctly merge the sequence flow
    // such that the joining parallel gateway has exactly two incoming sequence flow
    ExclusiveGateway mergingExclusiveGateway = createMergingExclusiveGateway(conversion);
    addSequenceFlow(conversion, feedbackTask, mergingExclusiveGateway);
    addSequenceFlow(conversion, boundarySignalCatch, mergingExclusiveGateway);
    // Parallel gateway that will join  it all together
    ParallelGateway join = createJoinParallelGateway(conversion, processElements);
    addSequenceFlow(conversion, signalThrowEvent, join);
    addSequenceFlow(conversion, mergingExclusiveGateway, join);
    // Set the last activity id, such that next steps can connect correctly
    conversion.setLastActivityId(join.getId());
    return processElements;
}
Also used : ThrowEvent(org.activiti.bpmn.model.ThrowEvent) BaseElement(org.activiti.bpmn.model.BaseElement) ExclusiveGateway(org.activiti.bpmn.model.ExclusiveGateway) Signal(org.activiti.bpmn.model.Signal) BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) HashMap(java.util.HashMap) ParallelGateway(org.activiti.bpmn.model.ParallelGateway) UserTask(org.activiti.bpmn.model.UserTask)

Example 9 with BoundaryEvent

use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.

the class FeedbackStepDefinitionConverter method createBoundarySignalCatch.

protected BoundaryEvent createBoundarySignalCatch(WorkflowDefinitionConversion conversion, Signal signal, UserTask feedbackTask) {
    BoundaryEvent boundarySignalCatch = new BoundaryEvent();
    boundarySignalCatch.setId(conversion.getUniqueNumberedId(ConversionConstants.BOUNDARY_ID_PREFIX));
    boundarySignalCatch.setAttachedToRef(feedbackTask);
    boundarySignalCatch.setAttachedToRefId(feedbackTask.getId());
    boundarySignalCatch.setCancelActivity(true);
    addFlowElement(conversion, boundarySignalCatch);
    SignalEventDefinition signalCatchEventDefinition = new SignalEventDefinition();
    signalCatchEventDefinition.setSignalRef(signal.getId());
    boundarySignalCatch.addEventDefinition(signalCatchEventDefinition);
    return boundarySignalCatch;
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition)

Example 10 with BoundaryEvent

use of org.activiti.bpmn.model.BoundaryEvent in project Activiti by Activiti.

the class BpmnModelUtil method createSignalBoundaryEvent.

public static BoundaryEvent createSignalBoundaryEvent(WorkflowDefinitionConversion conversion, Signal signal, Activity activity, boolean cancelActivity) {
    BoundaryEvent signalBoundaryEvent = new BoundaryEvent();
    signalBoundaryEvent.setId(conversion.getUniqueNumberedId(SIGNAL_BOUNDARY_EVENT));
    signalBoundaryEvent.setCancelActivity(cancelActivity);
    signalBoundaryEvent.setAttachedToRef(activity);
    SignalEventDefinition boundarySignalEventDefinition = new SignalEventDefinition();
    boundarySignalEventDefinition.setSignalRef(signal.getId());
    signalBoundaryEvent.addEventDefinition(boundarySignalEventDefinition);
    return signalBoundaryEvent;
}
Also used : BoundaryEvent(org.activiti.bpmn.model.BoundaryEvent) SignalEventDefinition(org.activiti.bpmn.model.SignalEventDefinition)

Aggregations

BoundaryEvent (org.activiti.bpmn.model.BoundaryEvent)31 FlowElement (org.activiti.bpmn.model.FlowElement)11 SubProcess (org.activiti.bpmn.model.SubProcess)8 StartEvent (org.activiti.bpmn.model.StartEvent)7 ActivityImpl (org.activiti.engine.impl.pvm.process.ActivityImpl)7 SequenceFlow (org.activiti.bpmn.model.SequenceFlow)6 SignalEventDefinition (org.activiti.bpmn.model.SignalEventDefinition)6 TimerEventDefinition (org.activiti.bpmn.model.TimerEventDefinition)6 UserTask (org.activiti.bpmn.model.UserTask)6 ErrorEventDefinition (org.activiti.bpmn.model.ErrorEventDefinition)5 CompensateEventDefinition (org.activiti.bpmn.model.CompensateEventDefinition)4 DataObject (org.activiti.bpmn.model.DataObject)4 EventDefinition (org.activiti.bpmn.model.EventDefinition)4 IntermediateCatchEvent (org.activiti.bpmn.model.IntermediateCatchEvent)4 MessageEventDefinition (org.activiti.bpmn.model.MessageEventDefinition)4 Activity (org.activiti.bpmn.model.Activity)3 Association (org.activiti.bpmn.model.Association)3 CancelEventDefinition (org.activiti.bpmn.model.CancelEventDefinition)3 Event (org.activiti.bpmn.model.Event)3 FlowNode (org.activiti.bpmn.model.FlowNode)3