Package org.drools.spi

Examples of org.drools.spi.KnowledgeHelper


        Argument mockApplicationDataArgument = (Argument) controlApplicationDataArgument.getMock();

        MockControl controlTuple = mocks.createControl(Tuple.class);
        Tuple mockTuple = (Tuple)controlTuple.getMock();
        MockControl controlKnowledgeHelper = mocks.createControl(KnowledgeHelper.class);
        KnowledgeHelper mockKnowledgeHelper = (KnowledgeHelper) controlKnowledgeHelper.getMock();
        String p1 = "p1";
        Object a1 = new Object();

        controlKnowledgeHelperArgument.expectAndReturn(
                mockKnowledgeHelperArgument.getValue(mockTuple),
View Full Code Here


        df.setOtherVarsPos( otherVarsPos );
        df.setOtherVarsLength( otherVarsLength );
       
        if ( knowledgeHelper != null && knowledgeHelper instanceof KnowledgeHelper ) {
            KnowledgeHelper kh = ( KnowledgeHelper ) knowledgeHelper;
            kh.setIdentityMap( identityMap );
            df.setKnowledgeHelper( kh );
        }       
    }
View Full Code Here

        df.setOtherVarsPos( otherVarsPos );
        df.setOtherVarsLength( otherVarsLength );
       
        if ( knowledgeHelper instanceof KnowledgeHelper ) {
            KnowledgeHelper kh = ( KnowledgeHelper ) knowledgeHelper;
            kh.setIdentityMap( identityMap );
            df.setKnowledgeHelper( kh );
        }       
    }
View Full Code Here

                        VariableResolverFactory factory) {
        Object object = ((WithNode) node).getNestedStatement().getValue( null,
                                                                         factory );

        DroolsMVELKnowledgeHelper resolver = (DroolsMVELKnowledgeHelper) factory.getVariableResolver( "drools" );
        KnowledgeHelper helper = (KnowledgeHelper) resolver.getValue();
        helper.modifyRetract( object );
        return 0;
    }
View Full Code Here

    public int doAfter(Object value,
                       ASTNode node,
                       VariableResolverFactory factory) {
        DroolsMVELKnowledgeHelper resolver = (DroolsMVELKnowledgeHelper) factory.getVariableResolver( "drools" );
        KnowledgeHelper helper = (KnowledgeHelper) resolver.getValue();
        helper.modifyInsert( value );
        return 0;
    }
View Full Code Here

    }
   
    private void triggerTimer(TimerInstance timerInstance) {
      for (Map.Entry<Timer, DroolsAction> entry: getEventBasedNode().getTimers().entrySet()) {
        if (entry.getKey().getId() == timerInstance.getTimerId()) {
          KnowledgeHelper knowledgeHelper = createKnowledgeHelper();
          executeAction(entry.getValue(), knowledgeHelper);
          return;
        }
      }
    }
View Full Code Here

            throw new IllegalArgumentException(
                "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);
View Full Code Here

  public void handleException(ExceptionHandler handler, String exception, Object params) {
   
    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);
View Full Code Here

  }
 
  protected void triggerEvent(String type) {
    List<DroolsAction> actions = getExtendedNode().getActions(type);
    if (actions != null) {
      KnowledgeHelper knowledgeHelper = createKnowledgeHelper();
      for (DroolsAction droolsAction: actions) {
        executeAction(droolsAction, knowledgeHelper);
      }
    }
  }
View Full Code Here

      }
    }
  }
 
  protected KnowledgeHelper createKnowledgeHelper() {
    KnowledgeHelper knowledgeHelper = null;
    WorkingMemory workingMemory = ((ProcessInstance) getProcessInstance()).getWorkingMemory();
    if (((InternalRuleBase) workingMemory.getRuleBase()).getConfiguration().isSequential()) {
      knowledgeHelper = new SequentialKnowledgeHelper(workingMemory);
        } else {
          knowledgeHelper = new DefaultKnowledgeHelper(workingMemory);
View Full Code Here

TOP

Related Classes of org.drools.spi.KnowledgeHelper

Copyright © 2018 www.massapicom. 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.