Search in sources :

Example 1 with ExecutableSequenceFlow

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

the class SequenceFlowTransformer method transform.

@Override
public void transform(final SequenceFlow element, final TransformContext context) {
    final ExecutableProcess process = context.getCurrentProcess();
    final ExecutableSequenceFlow sequenceFlow = process.getElementById(element.getId(), ExecutableSequenceFlow.class);
    parseCondition(element, sequenceFlow, context.getExpressionLanguage());
    connectWithFlowNodes(element, process, sequenceFlow);
}
Also used : ExecutableSequenceFlow(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)

Example 2 with ExecutableSequenceFlow

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

the class ExclusiveGatewayTransformer method transformDefaultFlow.

private void transformDefaultFlow(final ExclusiveGateway element, final ExecutableProcess process, final ExecutableExclusiveGateway gateway) {
    final SequenceFlow defaultFlowElement = element.getDefault();
    if (defaultFlowElement != null) {
        final String defaultFlowId = defaultFlowElement.getId();
        final ExecutableSequenceFlow defaultFlow = process.getElementById(defaultFlowId, ExecutableSequenceFlow.class);
        gateway.setDefaultFlow(defaultFlow);
    }
}
Also used : ExecutableSequenceFlow(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow) SequenceFlow(io.camunda.zeebe.model.bpmn.instance.SequenceFlow) ExecutableSequenceFlow(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow)

Example 3 with ExecutableSequenceFlow

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

the class SequenceFlowTransformer method transform.

@Override
public void transform(final SequenceFlow element, final TransformContext context) {
    final ExecutableProcess process = context.getCurrentProcess();
    final ExecutableSequenceFlow sequenceFlow = process.getElementById(element.getId(), ExecutableSequenceFlow.class);
    parseCondition(element, sequenceFlow, context.getExpressionLanguage());
    connectWithFlowNodes(element, process, sequenceFlow);
}
Also used : ExecutableSequenceFlow(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)

Example 4 with ExecutableSequenceFlow

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

the class ExclusiveGatewayProcessor method findSequenceFlowToTake.

private Either<Failure, Optional<ExecutableSequenceFlow>> findSequenceFlowToTake(final ExecutableExclusiveGateway element, final BpmnElementContext context) {
    if (element.getOutgoing().isEmpty()) {
        // there are no flows to take: the gateway is an implicit end for the flow scope
        return Either.right(Optional.empty());
    }
    if (element.getOutgoing().size() == 1 && element.getOutgoing().get(0).getCondition() == null) {
        // only one flow without a condition, can just be taken
        return Either.right(Optional.of(element.getOutgoing().get(0)));
    }
    for (final ExecutableSequenceFlow sequenceFlow : element.getOutgoingWithCondition()) {
        final Expression condition = sequenceFlow.getCondition();
        final Either<Failure, Boolean> isFulfilledOrFailure = expressionBehavior.evaluateBooleanExpression(condition, context.getElementInstanceKey());
        if (isFulfilledOrFailure.isLeft()) {
            return Either.left(isFulfilledOrFailure.getLeft());
        } else if (isFulfilledOrFailure.get()) {
            // the condition is fulfilled
            return Either.right(Optional.of(sequenceFlow));
        }
    }
    // no condition is fulfilled - try to take the default flow
    if (element.getDefaultFlow() != null) {
        return Either.right(Optional.of(element.getDefaultFlow()));
    }
    return Either.left(new Failure(NO_OUTGOING_FLOW_CHOSEN_ERROR, ErrorType.CONDITION_ERROR, context.getElementInstanceKey()));
}
Also used : Expression(io.camunda.zeebe.el.Expression) ExecutableSequenceFlow(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow) Failure(io.camunda.zeebe.engine.processing.common.Failure)

Example 5 with ExecutableSequenceFlow

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

the class SequenceFlowTransformer method transform.

@Override
public void transform(final SequenceFlow element, final TransformContext context) {
    final ExecutableProcess process = context.getCurrentProcess();
    final ExecutableSequenceFlow sequenceFlow = process.getElementById(element.getId(), ExecutableSequenceFlow.class);
    parseCondition(element, sequenceFlow, context.getExpressionLanguage());
    connectWithFlowNodes(element, process, sequenceFlow);
}
Also used : ExecutableSequenceFlow(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)

Aggregations

ExecutableSequenceFlow (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableSequenceFlow)9 Expression (io.camunda.zeebe.el.Expression)3 Failure (io.camunda.zeebe.engine.processing.common.Failure)3 ExecutableProcess (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)3 SequenceFlow (io.camunda.zeebe.model.bpmn.instance.SequenceFlow)3