Hi, this post is about the Variable
node in the BPMN model and whether or not it is a standard element/node or is this a possibly extended custom element.
I’m trying to import and customize a model from the flowable open source engine, more specifically, they have a variableAggregation
node in the multi instance loop characteristincs’ extension elements, looking like this:
<multiInstanceLoopCharacteristics isSequential="true" flowable:collection="${data}" flowable:elementVariable="input">
<extensionElements>
<flowable:variableAggregation target="target_var" targetExpression="target_expr" createOverviewVariable="true" delegateExpression="delegate_expr">
<variable sourceExpression="${id}" target="id"></variable>
</flowable:variableAggregation>
</extensionElements>
</multiInstanceLoopCharacteristics>
(look at the Variable
node in the XML, it has no prefix.)
Now, I’ve described the variableAggregation
extension element in my flowable
descriptor like so:
{
name: 'VariableAggregation',
superClass: ['Element'],
properties: [
{
name: 'target',
isAttr: true,
type: 'String',
},
{
name: 'targetExpression',
isAttr: true,
type: 'String',
},
{
name: 'delegateExpression',
isAttr: true,
type: 'String',
},
{
name: 'storeAsTransientVariable',
isAttr: true,
type: 'String',
},
{
name: 'createOverviewVariable',
isAttr: true,
type: 'String',
},
{
name: 'variable', // this will be a `flowable:Variable`
isAttr: false,
isMany: true,
type: 'Variable',
},
],
},
in our bpmn-js descriptor with the flowable
prefix and I can create that element programmatically myself using moddle.create(flowable:VariableAggregation, {..})
, with no issues.
Problems arise when I try to create the variable
node, as you can see in the XML example above, variable has no prefix, and when i try to create a moddle.create("Variable", {..})
, i get the error message saying Uncaught Error: unknown type <Variable>
. I can however add the flowable:
prefix to the variable and add it to my descriptor:
{
name: 'Variable',
superClass: ['Element'],
properties: [
{ name: 'target', isAttr: true, type: 'String' },
{ name: 'source', isAttr: true, type: 'String' },
{ name: 'sourceExpression', isAttr: true, type: 'String' },
{ name: 'targetExpression', isAttr: true, type: 'String' },
],
},
but this will just allow me to create a <flowable:Variable>
element instead of just a <Variable>
.
Now, as far as I understand, this Variable
isn’t a regular bpmn element, so my question is:
is this a bug in the exported model i got without the prefix on the Variable
element, or did I somehow get the wrong BPMN definition and Variable
is a legit BPMN element?