package it.reply.workflowmanager.cdi.orchestrator.bpm.commands;

import it.reply.workflowmanager.orchestrator.bpm.OrchestratorContext;
import it.reply.workflowmanager.orchestrator.bpm.commands.BaseDispatcherCommand;
import it.reply.workflowmanager.orchestrator.bpm.ejbcommands.IEJBCommand;

import org.kie.api.executor.CommandContext;
import org.kie.api.executor.ExecutionResults;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import it.reply.workflowmanager.cdi.orchestrator.bpm.OrchestratorContextBean;
import it.reply.workflowmanager.logging.CustomLogger;
import it.reply.workflowmanager.logging.CustomLoggerFactory;

/**
 * This class gets the reference to the OrchestratorContext to re-enable CDI in executor context.
 * jBPM Executor's command should subclass this.
 * 
 * @author l.biava
 * 
 */
public abstract class CDIDispatcherCommand extends BaseDispatcherCommand {

  private static final Logger LOG = LoggerFactory.getLogger(CDIDispatcherCommand.class);
  
  private OrchestratorContext orchestratorContext;

  public CDIDispatcherCommand() throws Exception {

    orchestratorContext = OrchestratorContextBean.getBean(OrchestratorContext.class);
    if (orchestratorContext == null) {
      LOG.error("Cannot have access to OrchestratorContext from " + this.getClass());
      throw new Exception(
          "FATAL ERROR: Cannot have access to OrchestratorContext from " + this.getClass());
    }
  }
  
  @Override
  public ExecutionResults dispatch(String eJBCommandClass, CommandContext ctx) throws Exception {
    IEJBCommand ejbCommand = orchestratorContext.getCommand(eJBCommandClass);
    return ejbCommand.execute(ctx);
  }
}

@@ -58,16 +58,94 @@
 mands;%0A%0A
+import it.reply.workflowmanager.cdi.orchestrator.bpm.OrchestratorContextBean;%0A
 import i
@@ -202,24 +202,24 @@
 torContext;%0A
-
 import it.re
@@ -514,202 +514,8 @@
 y;%0A%0A
-import it.reply.workflowmanager.cdi.orchestrator.bpm.OrchestratorContextBean;%0Aimport it.reply.workflowmanager.logging.CustomLogger;%0Aimport it.reply.workflowmanager.logging.CustomLoggerFactory;%0A%0A
 /**%0A
@@ -703,17 +703,8 @@
 lic 
-abstract 
 clas
@@ -848,19 +848,17 @@
 class);%0A
-  
 %0A
+
   privat
@@ -1294,18 +1294,16 @@
   %7D%0A  %7D%0A
-  
 %0A  @Over

Fix CDIDispatcherCommand not instantiable