A decision literal expression represents decision logic which can be depicted as an expression in DMN 1.1.It consists of a and a variable.

A decision literal expression is represented by a element inside a decision XML element.

Decision Name

The name describes the decision for which the literal expression provides thedecision logic. It is set as the name attribute on the decision element.

  1. <decision id="season" name="Season">
  2. </decision>

Decision Id

Decision Literal Expression - 图1

Each decision should have an unique id when it is to the Camunda BPMplatform. The engine uses the id as the decision key of the deployedDecisionDefinition.

  1. <decision id="season" name="Season">
  2. <!-- ... -->

Literal Expression

The literal expression specifies how the value of the decision is generated. It is an expression which will be evaluated by the DMN engine.It can be used to do a complex calculation, to invoke a bean which provides decision logic, or to combine the output values of required decisions.

The expression is set inside a text element that is a child of the literalExpression XML element.

The expression language of the literal expression can be specified by theexpressionLanguage attribute on the literalExpression XML element. Thesupported expression languages are listed in the .

  1. <literalExpression expressionLanguage="groovy">
  2. <text>calendar.getSeason(date)</text>
  3. </literalExpression>

If no expression language is set then the global expression language is usedwhich is set on the definitions XML element.

  1. name="definitions"
  2. xmlns="http://www.omg.org/spec/DMN/20151101/dmn.xsd"
  3. namespace="http://camunda.org/schema/1.0/dmn">
  4. <!-- ... -->
  5. </definitions>

Variable

A decision literal expression must have a variable which specifies the name and the type of the decision result.A variable is represented by a variable element inside a decision XML element.

The name of the variable is used to reference the value of the literal expression in the decision result. It is specified by the name attribute on the variable XML element.

  1. <variable name="season" />

The type of the decision result can be specified by the typeRef attribute on thevariable XML element. After the expression is evaluated by theDMN engine it converts the result to the specified type. The supported typesare listed in the User Guide.

    Note that the type is not required but recommended since it provides a typesafety of the expression result.