Package org.drools.spi

Examples of org.drools.spi.KnowledgeHelper


            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


    if (extendedNode == null) {
      return;
    }
    List<DroolsAction> actions = extendedNode.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

    public int doAfter(Object value,
                       ASTNode node,
                       VariableResolverFactory factory) {
        DroolsMVELKnowledgeHelper resolver = (DroolsMVELKnowledgeHelper) factory.getVariableResolver( "drools" );
        KnowledgeHelper helper = (KnowledgeHelper) resolver.getValue();
        helper.update( value );
        return 0;
    }
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

                        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

        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

                            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

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.