Hi,
I just saw Pause at Node Behavior by nikku · Pull Request #91 · bpmn-io/bpmn-js-token-simulation · GitHub which is really cool. Is it possible to automatically activate pause behaviour of some tasks based on custom attributes in the business object?
In my use case I have custom tasks that look like this
<bpmn2:task id="Activity_0r6a4hc" resources:type="Request" />
In the token simulation they should either behave like a ReceiveTask
or like regular tasks with the pause behaviour activated (whatever is easier to implement would be fine for me).
I assume that this could somehow be realised in ContinueHandler.js
or PauseHandler.js
but I couldn’t find out how.
Any help would be much appreciated. Thanks for the great work!
I was looking at the wrong place and found a solution by patching Simulator.js
:
function getBehavior(element) {
if ( element.type == 'bpmn:Task' &&
( element.businessObject.type == 'Resource'
|| element.businessObject.type == 'Request'
|| element.businessObject.type == 'Release' )
) {
return behaviors['bpmn:ReceiveTask'];
}
return behaviors[element.type] || noopBehavior;
}
Now my custom tasks behave like a ReceiveTask
.
Actually I also patched PauseHandler.js
to disable the redundant context pad for the pause behavior:
PauseHandler.prototype.createContextPads = function(element) {
if ( element.type == 'bpmn:ReceiveTask' ||
( element.type == 'bpmn:Task' &&
( element.businessObject.type == 'Resource'
|| element.businessObject.type == 'Request'
|| element.businessObject.type == 'Release'
)
)
) {
return [] ;
}
return [
this.createPauseContextPad(element)
];
};