@5minds/processcube_engine
Version:
The ProcessCube Engine. Stores and executes BPMNs.
63 lines • 3.89 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.EndTerminateEventHandler = void 0;
const inversify_1 = require("inversify");
const processcube_engine_sdk_1 = require("@5minds/processcube_engine_sdk");
const index_1 = require("../../../Contracts/index");
const EventAggregator_1 = __importDefault(require("../../../Tools/EventAggregator"));
const index_2 = require("../../../Tools/index");
const ProcessInstance_1 = require("../../ProcessInstance");
const FlowNodeHandlerFactory_1 = require("../FlowNodeHandlerFactory");
const EndEventHandler_1 = require("./EndEventHandler");
let EndTerminateEventHandler = class EndTerminateEventHandler extends EndEventHandler_1.EndEventHandler {
constructor(eventMiddlewareHandler, flowNodeHandlerFactory, flowNodeInstanceDatabaseAdapter, endEventModel, processInstance, namespace) {
super(eventMiddlewareHandler, flowNodeHandlerFactory, flowNodeInstanceDatabaseAdapter, endEventModel, processInstance, namespace ?? 'terminate_end_event_handler');
}
async startExecution() {
this.logger.debug(`Executing TerminateEndEvent instance.`);
return this.executeHandler();
}
async executeHandler() {
this.sendCancelSignalToActiveFlowNodes();
return undefined;
}
sendCancelSignalToActiveFlowNodes() {
const eventName = index_1.eventAggregatorSettings.messagePaths.terminateEndEventReached.replace(index_1.eventAggregatorSettings.messageParams.processInstanceId, this.processInstance.getProcessInstanceId());
const message = {
correlationId: this.processInstance.getCorrelationId(),
processDefinitionId: this.processInstance.getProcessDefinitionId(),
processModelId: this.processInstance.getProcessModelId(),
embeddedProcessModelId: this.processInstance.getEmbeddedProcessModelId(),
processModelName: this.processInstance.getProcessModelName(),
processInstanceId: this.processInstance.getProcessInstanceId(),
parentProcessInstanceId: this.processInstance.getParentProcessInstance()?.getProcessInstanceId(),
flowNodeId: this.endEvent.id,
flowNodeName: this.endEvent.name,
flowNodeInstanceId: this.flowNodeInstanceId,
processInstanceOwner: this.processInstance.getOwner(),
currentToken: this.processToken,
eventType: this.flowNode.eventType,
};
EventAggregator_1.default.publish(eventName, message);
}
};
exports.EndTerminateEventHandler = EndTerminateEventHandler;
exports.EndTerminateEventHandler = EndTerminateEventHandler = __decorate([
(0, inversify_1.injectable)(),
__metadata("design:paramtypes", [index_2.EventMiddlewareHandler,
FlowNodeHandlerFactory_1.FlowNodeHandlerFactory,
index_2.FlowNodeInstanceDatabaseAdapter, Object, ProcessInstance_1.ProcessInstance, String])
], EndTerminateEventHandler);
//# sourceMappingURL=EndTerminateEventHandler.js.map