From fa4e104db7c922f4be87c2acb73ec690b8d018a9 Mon Sep 17 00:00:00 2001
From: clauspeterhuebner
Date: Wed, 11 Feb 2026 16:37:39 +0100
Subject: [PATCH] now with explizit command instantiation
---
core/src/command/CommandFactory.ts | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/core/src/command/CommandFactory.ts b/core/src/command/CommandFactory.ts
index d9acd1a0e..3fa1510ce 100644
--- a/core/src/command/CommandFactory.ts
+++ b/core/src/command/CommandFactory.ts
@@ -3,6 +3,7 @@ import { BaseCommand } from './BaseCommand';
import { getLogger } from 'log4js';
import { LOG4JS_BASE_CATEGORY_NAME } from '../config/const';
import { ICommandConstructor } from './CommandTypes';
+import { SendEmailCommand } from './commands/SendEmailCommand';
const createLogger = (method: string) =>
getLogger(`${LOG4JS_BASE_CATEGORY_NAME}.command.CommandFactory.${method}`)
@@ -45,6 +46,7 @@ export class CommandFactory {
methodLogger.error(errmsg);
throw new Error(errmsg);
}
+ /*
try {
const command = new CommandClass(params) as Command;
if (methodLogger.isDebugEnabled()) {
@@ -56,6 +58,20 @@ export class CommandFactory {
methodLogger.error(errmsg);
throw new Error(errmsg);
}
-
+ */
+ let command: BaseCommand;
+ switch(CommandClass.name) {
+ case 'SendEmailCommand':
+ command = new SendEmailCommand(params);
+ break;
+ default:
+ const errmsg = `Command ${name} not found`;
+ methodLogger.error(errmsg);
+ throw new Error(errmsg);
+ }
+ if (methodLogger.isDebugEnabled()) {
+ methodLogger.debug(`createCommand() created command=${JSON.stringify(command)}`)
+ }
+ return command
}
}