Examples of ProcessContext


Examples of org.drools.spi.ProcessContext

    }

    private void handleAssignment(Assignment assignment) {
      AssignmentAction action = (AssignmentAction) assignment.getMetaData("Action");
    try {
        ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
        context.setNodeInstance(this);
          action.execute(getWorkItem(), context);       
    } catch (Exception e) {
        throw new RuntimeException("unable to execute Assignment", e);
    }
    }
View Full Code Here

Examples of org.drools.spi.ProcessContext

  public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
    String className = (String) workItem.getParameter("Class");
    try {
      Class<JavaHandler> c = (Class<JavaHandler>) Class.forName(className);
      JavaHandler handler = c.newInstance();
      ProcessContext kcontext = new ProcessContext(ksession);
      WorkflowProcessInstance processInstance = (WorkflowProcessInstance)
        ksession.getProcessInstance(workItem.getProcessInstanceId());
      kcontext.setProcessInstance(processInstance);
      WorkItemNodeInstance nodeInstance = findNodeInstance(workItem.getId(), processInstance);
      kcontext.setNodeInstance(nodeInstance);
      Map<String, Object> results = handler.execute(kcontext);
            manager.completeWorkItem(workItem.getId(), results);
        return;
        } catch (ClassNotFoundException e) {
            System.err.println(e);
View Full Code Here

Examples of org.drools.spi.ProcessContext

            throw new IllegalArgumentException(
                "An ActionNode only accepts default incoming connections!");
        }
    Action action = (Action) getActionNode().getAction().getMetaData("Action");
    try {
        ProcessContext context = new ProcessContext(getProcessInstance().getKnowledgeRuntime());
        context.setNodeInstance(this);
          action.execute(context);       
    } catch (Exception e) {
        throw new RuntimeException("unable to execute Action", e);
    }
      triggerCompleted();
View Full Code Here

Examples of org.drools.spi.ProcessContext

                "An ActionNode only accepts default incoming connections!");
        }
    Action action = (Action) getActionNode().getAction().getMetaData("Action");
    try {
        KnowledgeHelper knowledgeHelper = createKnowledgeHelper();
        ProcessContext context = new ProcessContext();
        context.setNodeInstance(this);
          action.execute(knowledgeHelper, ((ProcessInstance) getProcessInstance()).getWorkingMemory(), context);       
    } catch (Exception e) {
        throw new RuntimeException("unable to execute Action", e);
    }
      triggerCompleted();
View Full Code Here

Examples of org.drools.spi.ProcessContext

   
    if (handler instanceof ActionExceptionHandler) {
      Action action = (Action) ((ActionExceptionHandler) handler).getAction().getMetaData("Action");
      try {
          KnowledgeHelper knowledgeHelper = createKnowledgeHelper();
          ProcessContext context = new ProcessContext();
          ProcessInstance processInstance = getProcessInstance();
          ContextInstanceContainer contextInstanceContainer = getContextInstanceContainer();
          if (contextInstanceContainer instanceof NodeInstance) {
            context.setNodeInstance((NodeInstance) contextInstanceContainer);
          } else {
            context.setProcessInstance(processInstance);
          }
          String faultVariable = handler.getFaultVariable();
          if (faultVariable != null) {
            context.setVariable(faultVariable, params);
          }
            action.execute(knowledgeHelper, ((ProcessInstance) processInstance).getWorkingMemory(), context);
      } catch (Exception e) {
          throw new RuntimeException("unable to execute Action", e);
      }
View Full Code Here

Examples of org.drools.spi.ProcessContext

    public boolean evaluate(SplitInstance instance,
                            Connection connection,
                            Constraint constraint) {
        Object value;
        try {
            ProcessContext context = new ProcessContext();
            context.setNodeInstance( instance );
            value = this.evaluator.evaluate( ((ProcessInstance) instance.getProcessInstance()).getWorkingMemory(),
                                             context );
        } catch ( Exception e ) {
            throw new RuntimeException( "unable to execute ReturnValueEvaluator",
                                        e );
View Full Code Here

Examples of org.drools.spi.ProcessContext

    return knowledgeHelper;
  }
 
  protected void executeAction(DroolsAction droolsAction, KnowledgeHelper knowledgeHelper) {
    Action action = (Action) droolsAction.getMetaData("Action");
    ProcessContext context = new ProcessContext();
    context.setNodeInstance(this);
    try {
      action.execute(knowledgeHelper, ((ProcessInstance) getProcessInstance()).getWorkingMemory(), context);
    } catch (Exception exception) {
      String exceptionName = exception.getClass().getName();
      ExceptionScopeInstance exceptionScopeInstance = (ExceptionScopeInstance)
View Full Code Here

Examples of org.drools.spi.ProcessContext

                "An ActionNode only accepts default incoming connections!");
        }
    Action action = (Action) getActionNode().getAction().getMetaData("Action");
    try {
        KnowledgeHelper knowledgeHelper = createKnowledgeHelper();
        ProcessContext context = new ProcessContext();
        context.setNodeInstance(this);
          action.execute(knowledgeHelper, ((ProcessInstance) getProcessInstance()).getWorkingMemory(), context);       
    } catch (Exception e) {
        throw new RuntimeException("unable to execute Action", e);
    }
      triggerCompleted();
View Full Code Here

Examples of org.drools.spi.ProcessContext

    public boolean evaluate(SplitInstance instance,
                            Connection connection,
                            Constraint constraint) {
        Object value;
        try {
            ProcessContext context = new ProcessContext();
            context.setNodeInstance( instance );
            value = this.evaluator.evaluate( ((ProcessInstance) instance.getProcessInstance()).getWorkingMemory(),
                                             context );
        } catch ( Exception e ) {
            throw new RuntimeException( "unable to execute ReturnValueEvaluator",
                                        e );
View Full Code Here

Examples of org.drools.spi.ProcessContext

    return knowledgeHelper;
  }
 
  protected void executeAction(DroolsAction droolsAction, KnowledgeHelper knowledgeHelper) {
    Action action = (Action) droolsAction.getMetaData("Action");
    ProcessContext context = new ProcessContext();
    context.setNodeInstance(this);
    try {
      action.execute(knowledgeHelper, ((ProcessInstance) getProcessInstance()).getWorkingMemory(), context);
    } catch (Exception exception) {
      exception.printStackTrace();
      String exceptionName = exception.getClass().getName();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.