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?
}
}
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);
}
}
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;
}
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;
}
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;
}
Aggregations