Search in sources :

Example 1 with ExecutableFlowElementContainer

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer in project zeebe by camunda.

the class SubProcessProcessor method onActivate.

@Override
public void onActivate(final ExecutableFlowElementContainer element, final BpmnElementContext activating) {
    variableMappingBehavior.applyInputMappings(activating, element).flatMap(ok -> eventSubscriptionBehavior.subscribeToEvents(element, activating)).ifRightOrLeft(ok -> {
        final var activated = stateTransitionBehavior.transitionToActivated(activating);
        final ExecutableStartEvent startEvent = element.getNoneStartEvent();
        if (startEvent == null) {
            throw new BpmnProcessingException(activated, NO_NONE_START_EVENT_ERROR_MSG);
        }
        stateTransitionBehavior.activateChildInstance(activated, startEvent);
    }, failure -> incidentBehavior.createIncident(failure, activating));
}
Also used : BpmnElementContext(io.camunda.zeebe.engine.processing.bpmn.BpmnElementContext) BpmnStateTransitionBehavior(io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnStateTransitionBehavior) ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) BpmnIncidentBehavior(io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnIncidentBehavior) BpmnElementContainerProcessor(io.camunda.zeebe.engine.processing.bpmn.BpmnElementContainerProcessor) BpmnStateBehavior(io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnStateBehavior) ProcessInstanceIntent(io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent) BpmnEventSubscriptionBehavior(io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnEventSubscriptionBehavior) BpmnBehaviors(io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnBehaviors) BpmnProcessingException(io.camunda.zeebe.engine.processing.bpmn.BpmnProcessingException) BpmnVariableMappingBehavior(io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnVariableMappingBehavior) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) BpmnProcessingException(io.camunda.zeebe.engine.processing.bpmn.BpmnProcessingException)

Example 2 with ExecutableFlowElementContainer

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer in project zeebe by zeebe-io.

the class SubProcessTransformer method transformEventSubprocess.

private void transformEventSubprocess(final SubProcess element, final ExecutableProcess currentProcess, final ExecutableFlowElementContainer subprocess) {
    // set the element type explicitly because the element name is equal to an embedded subprocess
    subprocess.setElementType(BpmnElementType.EVENT_SUB_PROCESS);
    if (element.getScope() instanceof FlowNode) {
        final FlowNode scope = (FlowNode) element.getScope();
        final ExecutableFlowElementContainer parentSubProc = currentProcess.getElementById(scope.getId(), ExecutableFlowElementContainer.class);
        parentSubProc.attach(subprocess);
    } else {
        // top-level start event
        currentProcess.attach(subprocess);
    }
    final ExecutableStartEvent startEvent = subprocess.getStartEvents().iterator().next();
    startEvent.setEventSubProcess(subprocess.getId());
}
Also used : ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) FlowNode(io.camunda.zeebe.model.bpmn.instance.FlowNode)

Example 3 with ExecutableFlowElementContainer

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer in project zeebe by camunda-cloud.

the class SubProcessTransformer method transformEventSubprocess.

private void transformEventSubprocess(final SubProcess element, final ExecutableProcess currentProcess, final ExecutableFlowElementContainer subprocess) {
    // set the element type explicitly because the element name is equal to an embedded subprocess
    subprocess.setElementType(BpmnElementType.EVENT_SUB_PROCESS);
    if (element.getScope() instanceof FlowNode) {
        final FlowNode scope = (FlowNode) element.getScope();
        final ExecutableFlowElementContainer parentSubProc = currentProcess.getElementById(scope.getId(), ExecutableFlowElementContainer.class);
        parentSubProc.attach(subprocess);
    } else {
        // top-level start event
        currentProcess.attach(subprocess);
    }
    final ExecutableStartEvent startEvent = subprocess.getStartEvents().iterator().next();
    startEvent.setEventSubProcess(subprocess.getId());
}
Also used : ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) FlowNode(io.camunda.zeebe.model.bpmn.instance.FlowNode)

Example 4 with ExecutableFlowElementContainer

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer in project zeebe by zeebe-io.

the class StartEventTransformer method transform.

@Override
public void transform(final StartEvent element, final TransformContext context) {
    final ExecutableProcess process = context.getCurrentProcess();
    final ExecutableStartEvent startEvent = process.getElementById(element.getId(), ExecutableStartEvent.class);
    startEvent.setInterrupting(element.isInterrupting());
    if (element.getScope() instanceof FlowNode) {
        final FlowNode scope = (FlowNode) element.getScope();
        final ExecutableFlowElementContainer subprocess = process.getElementById(scope.getId(), ExecutableFlowElementContainer.class);
        subprocess.addStartEvent(startEvent);
    } else {
        // top-level start event
        process.addStartEvent(startEvent);
    }
    if (startEvent.isMessage() && element.getScope() instanceof Process) {
        evaluateMessageNameExpression(startEvent, context);
    }
}
Also used : ExecutableStartEvent(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) Process(io.camunda.zeebe.model.bpmn.instance.Process) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) FlowNode(io.camunda.zeebe.model.bpmn.instance.FlowNode)

Example 5 with ExecutableFlowElementContainer

use of io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer in project zeebe by zeebe-io.

the class SubProcessTransformer method transform.

@Override
public void transform(final SubProcess element, final TransformContext context) {
    final ExecutableProcess currentProcess = context.getCurrentProcess();
    final ExecutableFlowElementContainer subprocess = currentProcess.getElementById(element.getId(), ExecutableFlowElementContainer.class);
    if (element.triggeredByEvent()) {
        transformEventSubprocess(element, currentProcess, subprocess);
    }
}
Also used : ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer)

Aggregations

ExecutableFlowElementContainer (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer)10 ExecutableStartEvent (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableStartEvent)7 ExecutableProcess (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)6 FlowNode (io.camunda.zeebe.model.bpmn.instance.FlowNode)6 Process (io.camunda.zeebe.model.bpmn.instance.Process)3 BpmnElementContainerProcessor (io.camunda.zeebe.engine.processing.bpmn.BpmnElementContainerProcessor)1 BpmnElementContext (io.camunda.zeebe.engine.processing.bpmn.BpmnElementContext)1 BpmnProcessingException (io.camunda.zeebe.engine.processing.bpmn.BpmnProcessingException)1 BpmnBehaviors (io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnBehaviors)1 BpmnEventSubscriptionBehavior (io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnEventSubscriptionBehavior)1 BpmnIncidentBehavior (io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnIncidentBehavior)1 BpmnStateBehavior (io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnStateBehavior)1 BpmnStateTransitionBehavior (io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnStateTransitionBehavior)1 BpmnVariableMappingBehavior (io.camunda.zeebe.engine.processing.bpmn.behavior.BpmnVariableMappingBehavior)1 ProcessInstanceIntent (io.camunda.zeebe.protocol.record.intent.ProcessInstanceIntent)1