Search in sources :

Example 1 with TransformContext

use of io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext in project zeebe by camunda.

the class MultiInstanceActivityTransformer method transformLoopCharacteristics.

private ExecutableLoopCharacteristics transformLoopCharacteristics(final TransformContext context, final MultiInstanceLoopCharacteristics elementLoopCharacteristics) {
    final boolean isSequential = elementLoopCharacteristics.isSequential();
    final Optional<Expression> completionCondition = Optional.ofNullable(elementLoopCharacteristics.getCompletionCondition()).map(CompletionCondition::getTextContent).filter(e -> !e.isEmpty()).map(context.getExpressionLanguage()::parseExpression);
    final ZeebeLoopCharacteristics zeebeLoopCharacteristics = elementLoopCharacteristics.getSingleExtensionElement(ZeebeLoopCharacteristics.class);
    final Expression inputCollection = context.getExpressionLanguage().parseExpression(zeebeLoopCharacteristics.getInputCollection());
    final Optional<DirectBuffer> inputElement = Optional.ofNullable(zeebeLoopCharacteristics.getInputElement()).filter(e -> !e.isEmpty()).map(BufferUtil::wrapString);
    final Optional<DirectBuffer> outputCollection = Optional.ofNullable(zeebeLoopCharacteristics.getOutputCollection()).filter(e -> !e.isEmpty()).map(BufferUtil::wrapString);
    final Optional<Expression> outputElement = Optional.ofNullable(zeebeLoopCharacteristics.getOutputElement()).filter(e -> !e.isEmpty()).map(e -> context.getExpressionLanguage().parseExpression(e));
    return new ExecutableLoopCharacteristics(isSequential, completionCondition, inputCollection, inputElement, outputCollection, outputElement);
}
Also used : CompletionCondition(io.camunda.zeebe.model.bpmn.instance.CompletionCondition) LoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.LoopCharacteristics) ExecutableMultiInstanceBody(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMultiInstanceBody) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) ExecutableLoopCharacteristics(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics) ModelElementTransformer(io.camunda.zeebe.engine.processing.deployment.model.transformation.ModelElementTransformer) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) MultiInstanceLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.MultiInstanceLoopCharacteristics) ZeebeLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics) TransformContext(io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext) BpmnElementType(io.camunda.zeebe.protocol.record.value.BpmnElementType) ExecutableActivity(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableActivity) Expression(io.camunda.zeebe.el.Expression) Optional(java.util.Optional) Activity(io.camunda.zeebe.model.bpmn.instance.Activity) Collections(java.util.Collections) BufferUtil(io.camunda.zeebe.util.buffer.BufferUtil) DirectBuffer(org.agrona.DirectBuffer) DirectBuffer(org.agrona.DirectBuffer) CompletionCondition(io.camunda.zeebe.model.bpmn.instance.CompletionCondition) BufferUtil(io.camunda.zeebe.util.buffer.BufferUtil) ZeebeLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics) Expression(io.camunda.zeebe.el.Expression) ExecutableLoopCharacteristics(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics)

Example 2 with TransformContext

use of io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext in project zeebe by camunda-cloud.

the class MultiInstanceActivityTransformer method transformLoopCharacteristics.

private ExecutableLoopCharacteristics transformLoopCharacteristics(final TransformContext context, final MultiInstanceLoopCharacteristics elementLoopCharacteristics) {
    final boolean isSequential = elementLoopCharacteristics.isSequential();
    final Optional<Expression> completionCondition = Optional.ofNullable(elementLoopCharacteristics.getCompletionCondition()).map(CompletionCondition::getTextContent).filter(e -> !e.isEmpty()).map(context.getExpressionLanguage()::parseExpression);
    final ZeebeLoopCharacteristics zeebeLoopCharacteristics = elementLoopCharacteristics.getSingleExtensionElement(ZeebeLoopCharacteristics.class);
    final Expression inputCollection = context.getExpressionLanguage().parseExpression(zeebeLoopCharacteristics.getInputCollection());
    final Optional<DirectBuffer> inputElement = Optional.ofNullable(zeebeLoopCharacteristics.getInputElement()).filter(e -> !e.isEmpty()).map(BufferUtil::wrapString);
    final Optional<DirectBuffer> outputCollection = Optional.ofNullable(zeebeLoopCharacteristics.getOutputCollection()).filter(e -> !e.isEmpty()).map(BufferUtil::wrapString);
    final Optional<Expression> outputElement = Optional.ofNullable(zeebeLoopCharacteristics.getOutputElement()).filter(e -> !e.isEmpty()).map(e -> context.getExpressionLanguage().parseExpression(e));
    return new ExecutableLoopCharacteristics(isSequential, completionCondition, inputCollection, inputElement, outputCollection, outputElement);
}
Also used : CompletionCondition(io.camunda.zeebe.model.bpmn.instance.CompletionCondition) LoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.LoopCharacteristics) ExecutableMultiInstanceBody(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMultiInstanceBody) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) ExecutableLoopCharacteristics(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics) ModelElementTransformer(io.camunda.zeebe.engine.processing.deployment.model.transformation.ModelElementTransformer) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) MultiInstanceLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.MultiInstanceLoopCharacteristics) ZeebeLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics) TransformContext(io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext) BpmnElementType(io.camunda.zeebe.protocol.record.value.BpmnElementType) ExecutableActivity(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableActivity) Expression(io.camunda.zeebe.el.Expression) Optional(java.util.Optional) Activity(io.camunda.zeebe.model.bpmn.instance.Activity) Collections(java.util.Collections) BufferUtil(io.camunda.zeebe.util.buffer.BufferUtil) DirectBuffer(org.agrona.DirectBuffer) DirectBuffer(org.agrona.DirectBuffer) CompletionCondition(io.camunda.zeebe.model.bpmn.instance.CompletionCondition) BufferUtil(io.camunda.zeebe.util.buffer.BufferUtil) ZeebeLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics) Expression(io.camunda.zeebe.el.Expression) ExecutableLoopCharacteristics(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics)

Example 3 with TransformContext

use of io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext in project zeebe by zeebe-io.

the class MultiInstanceActivityTransformer method transformLoopCharacteristics.

private ExecutableLoopCharacteristics transformLoopCharacteristics(final TransformContext context, final MultiInstanceLoopCharacteristics elementLoopCharacteristics) {
    final boolean isSequential = elementLoopCharacteristics.isSequential();
    final Optional<Expression> completionCondition = Optional.ofNullable(elementLoopCharacteristics.getCompletionCondition()).map(CompletionCondition::getTextContent).filter(e -> !e.isEmpty()).map(context.getExpressionLanguage()::parseExpression);
    final ZeebeLoopCharacteristics zeebeLoopCharacteristics = elementLoopCharacteristics.getSingleExtensionElement(ZeebeLoopCharacteristics.class);
    final Expression inputCollection = context.getExpressionLanguage().parseExpression(zeebeLoopCharacteristics.getInputCollection());
    final Optional<DirectBuffer> inputElement = Optional.ofNullable(zeebeLoopCharacteristics.getInputElement()).filter(e -> !e.isEmpty()).map(BufferUtil::wrapString);
    final Optional<DirectBuffer> outputCollection = Optional.ofNullable(zeebeLoopCharacteristics.getOutputCollection()).filter(e -> !e.isEmpty()).map(BufferUtil::wrapString);
    final Optional<Expression> outputElement = Optional.ofNullable(zeebeLoopCharacteristics.getOutputElement()).filter(e -> !e.isEmpty()).map(e -> context.getExpressionLanguage().parseExpression(e));
    return new ExecutableLoopCharacteristics(isSequential, completionCondition, inputCollection, inputElement, outputCollection, outputElement);
}
Also used : CompletionCondition(io.camunda.zeebe.model.bpmn.instance.CompletionCondition) LoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.LoopCharacteristics) ExecutableMultiInstanceBody(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMultiInstanceBody) ExecutableProcess(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess) ExecutableLoopCharacteristics(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics) ModelElementTransformer(io.camunda.zeebe.engine.processing.deployment.model.transformation.ModelElementTransformer) ExecutableFlowElementContainer(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer) MultiInstanceLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.MultiInstanceLoopCharacteristics) ZeebeLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics) TransformContext(io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext) BpmnElementType(io.camunda.zeebe.protocol.record.value.BpmnElementType) ExecutableActivity(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableActivity) Expression(io.camunda.zeebe.el.Expression) Optional(java.util.Optional) Activity(io.camunda.zeebe.model.bpmn.instance.Activity) Collections(java.util.Collections) BufferUtil(io.camunda.zeebe.util.buffer.BufferUtil) DirectBuffer(org.agrona.DirectBuffer) DirectBuffer(org.agrona.DirectBuffer) CompletionCondition(io.camunda.zeebe.model.bpmn.instance.CompletionCondition) BufferUtil(io.camunda.zeebe.util.buffer.BufferUtil) ZeebeLoopCharacteristics(io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics) Expression(io.camunda.zeebe.el.Expression) ExecutableLoopCharacteristics(io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics)

Aggregations

Expression (io.camunda.zeebe.el.Expression)3 ExecutableActivity (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableActivity)3 ExecutableFlowElementContainer (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableFlowElementContainer)3 ExecutableLoopCharacteristics (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableLoopCharacteristics)3 ExecutableMultiInstanceBody (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableMultiInstanceBody)3 ExecutableProcess (io.camunda.zeebe.engine.processing.deployment.model.element.ExecutableProcess)3 ModelElementTransformer (io.camunda.zeebe.engine.processing.deployment.model.transformation.ModelElementTransformer)3 TransformContext (io.camunda.zeebe.engine.processing.deployment.model.transformation.TransformContext)3 Activity (io.camunda.zeebe.model.bpmn.instance.Activity)3 CompletionCondition (io.camunda.zeebe.model.bpmn.instance.CompletionCondition)3 LoopCharacteristics (io.camunda.zeebe.model.bpmn.instance.LoopCharacteristics)3 MultiInstanceLoopCharacteristics (io.camunda.zeebe.model.bpmn.instance.MultiInstanceLoopCharacteristics)3 ZeebeLoopCharacteristics (io.camunda.zeebe.model.bpmn.instance.zeebe.ZeebeLoopCharacteristics)3 BpmnElementType (io.camunda.zeebe.protocol.record.value.BpmnElementType)3 BufferUtil (io.camunda.zeebe.util.buffer.BufferUtil)3 Collections (java.util.Collections)3 Optional (java.util.Optional)3 DirectBuffer (org.agrona.DirectBuffer)3