Class VariableMappingTransformer

java.lang.Object
io.camunda.zeebe.engine.processing.deployment.model.transformer.VariableMappingTransformer

public final class VariableMappingTransformer extends Object
Transform variable mappings into an expression.

The resulting expression is a FEEL context that has a similar structure as a JSON document. Each target of a mapping is a key in the context and the source of this mapping is the context value. The source expression can be any FEEL expression. A nested target expression is transformed into a nested context.

Variable mappings:

   source | target
   =======|=======
    x     | a
    y     | b.c
    z     | b.d
 
FEEL context expression:
   {
     a: x,
     b: {
       c: y,
       d: z
     }
   }
 

Output variable mappings differ from input mappings that the result variables needs to be merged with the existing variables if the variable is a JSON object. The merging is done by calling the FEEL function 'context merge()' and referencing the variable.

   {
     a: x,
     b: if (b = null)
        then {
          c: y,
          d: z
        }
        else context merge(b, {
          c: y,
          d: z
       })
   }
 
  • Constructor Details

    • VariableMappingTransformer

      public VariableMappingTransformer()
  • Method Details

    • transformInputMappings

      public io.camunda.zeebe.el.Expression transformInputMappings(Collection<? extends ZeebeMapping> inputMappings, io.camunda.zeebe.el.ExpressionLanguage expressionLanguage)
    • transformOutputMappings

      public io.camunda.zeebe.el.Expression transformOutputMappings(Collection<? extends ZeebeMapping> outputMappings, io.camunda.zeebe.el.ExpressionLanguage expressionLanguage)