camunda / camunda-modeler

An integrated modeling solution for BPMN, DMN and Forms based on bpmn.io.
https://camunda.com/products/modeler
MIT License
1.51k stars 484 forks source link

I can define an element template for an event definition #859

Open nikku opened 6 years ago

nikku commented 6 years ago

As a user I would like to be able to define an element template for an event definition. This allows us to support templates for scoped events (https://github.com/camunda/camunda-modeler/issues/343).

Tasks


New Scope: eventDefinition

The eventDefinition allows users to define the event definition to be used for a given element along with its bindings.

Example 1: Defining a bpmn:MessageEventDefinition with a camunda:class binding

Element Template

  ...
  "scopes": {
    "eventDefinition": {
      "type": "bpmn:MessageEventDefinition",
      "properties": [
        {
          "type": "Hidden",
          "value": "com.my.custom.Foo",
          "binding": {
            "type": "property",
            "name": "camunda:class"
          }
        }
      ]
    }
  },
  ...

Resulting XML

    ...
    <bpmn:intermediateThrowEvent>
      <bpmn:messageEventDefinition camunda:class="com.my.custom.Foo" />
    </bpmn:intermediateThrowEvent>
    ...

Example 2: Defining a bpmn:SignalEventDefinition with a camunda:in binding

Element Template

  "scopes": {
    "eventDefinition": {
      "type": "bpmn:SignalEventDefinition",
      "properties": [
        {
          "type": "Hidden",
          "value": "${ execution.businessKey }",
          "binding": {
            "type": "camunda:in",
            "target": "key",
            "expression": true
          }
        }
      ]
    }
  },
  ...

Resulting XML

    ...
    <bpmn:intermediateThrowEvent>
      <bpmn:signalEventDefinition>
        <bpmn:extensionElements>
          <camunda:in sourceExpression="${ execution.businessKey }" target="key" />
        </bpmn:extensionElements>
      </bpmn:signalEventDefinition>
    </bpmn:intermediateThrowEvent>
    ...
vasicvuk commented 2 years ago

@nikku Is this planned in the near future? Without this element, templates cannot be used with events

nikku commented 2 years ago

Not planned yet (CC @christian-konrad)