bpmn-elements
Version:
Executable workflow elements based on BPMN 2.0
31 lines (30 loc) • 1.34 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.IntermediateThrowEventBehaviour = IntermediateThrowEventBehaviour;
exports.default = IntermediateThrowEvent;
var _Activity = _interopRequireDefault(require("../activity/Activity.js"));
var _EventDefinitionExecution = _interopRequireDefault(require("../eventDefinitions/EventDefinitionExecution.js"));
var _messageHelper = require("../messageHelper.js");
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
const kExecution = Symbol.for('execution');
function IntermediateThrowEvent(activityDef, context) {
return new _Activity.default(IntermediateThrowEventBehaviour, {
...activityDef,
isThrowing: true
}, context);
}
function IntermediateThrowEventBehaviour(activity) {
this.id = activity.id;
this.type = activity.type;
this.broker = activity.broker;
this[kExecution] = activity.eventDefinitions && new _EventDefinitionExecution.default(activity, activity.eventDefinitions);
}
IntermediateThrowEventBehaviour.prototype.execute = function execute(executeMessage) {
const execution = this[kExecution];
if (execution) {
return execution.execute(executeMessage);
}
return this.broker.publish('execution', 'execute.completed', (0, _messageHelper.cloneContent)(executeMessage.content));
};