Package org.drools.common

Examples of org.drools.common.AbstractRuleBase


  public void testEmpty() {
   
  }

  public void FIXMEtestTimer() {
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ExecutorService executorService = new DefaultExecutorService();
        final StatefulSession workingMemory = new ReteooStatefulSession(1, ruleBase, executorService);
        executorService.setCommandExecutor( new CommandExecutor( workingMemory ) );

        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance() {
View Full Code Here


        }               
       
    }

    protected <T, K> T applyTrait( K core, Class<T> trait, boolean logical ) {
        AbstractRuleBase arb = (AbstractRuleBase) ((KnowledgeBaseImpl) this.getKnowledgeRuntime().getKieBase() ).getRuleBase();
        TraitFactory builder = arb.getConfiguration().getComponentFactory().getTraitFactory();

        boolean needsWrapping = ! ( core instanceof TraitableBean );

        TraitableBean inner = needsWrapping ? asTraitable( core, builder ) : (TraitableBean) core;
        if ( needsWrapping ) {
View Full Code Here

        forEachNode.linkOutgoingConnections(
            actionNode.getId(), Node.CONNECTION_DEFAULT_TYPE,
            Node.CONNECTION_DEFAULT_TYPE);
        forEachNode.setVariable("child", personDataType);
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        Map<String, Object> parameters = new HashMap<String, Object>();
        List<Person> persons = new ArrayList<Person>();
        persons.add(new Person("John Doe", 30));
        persons.add(new Person("Jane Doe", 20));
View Full Code Here

        new ConnectionImpl(
            subProcessNode, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
       
        process = new RuleFlowProcess();
        process.setId("org.drools.process.subprocess");
        process.setName("SubProcess");
       
        startNode = new StartNode();
        startNode.setName("Start");
        startNode.setId(1);
        process.addNode(startNode);
        endNode = new EndNode();
        endNode.setName("EndNode");
        endNode.setId(2);
        process.addNode(endNode);
        ActionNode actionNode = new ActionNode();
        actionNode.setName("Action");
        DroolsAction action = new DroolsConsequenceAction("java", null);
        action.setMetaData("Action", new Action() {
            public void execute(KnowledgeHelper knowledgeHelper, WorkingMemory workingMemory, ProcessContext context) throws Exception {
              System.out.println("Executed action");
              executed = true;
            }
        });
        actionNode.setAction(action);
        process.addNode(actionNode);
        new ConnectionImpl(
            startNode, Node.CONNECTION_DEFAULT_TYPE,
            actionNode, Node.CONNECTION_DEFAULT_TYPE
        );
        new ConnectionImpl(
        actionNode, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        ruleBase.addProcess(process);
       
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        workingMemory.startProcess("org.drools.process.process");
        assertTrue(executed);
        assertEquals(0, workingMemory.getProcessInstances().size());
View Full Code Here

        new ConnectionImpl(
            subProcessNode, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
       
        process = new RuleFlowProcess();
        process.setId("org.drools.process.subprocess");
        process.setName("SubProcess");
       
        startNode = new StartNode();
        startNode.setName("Start");
        startNode.setId(1);
        process.addNode(startNode);
        endNode = new EndNode();
        endNode.setName("EndNode");
        endNode.setId(2);
        process.addNode(endNode);
        WorkItemNode workItemNode = new WorkItemNode();
        workItemNode.setName("WorkItem");
        Work work = new WorkImpl();
        work.setName("MyWork");
        workItemNode.setWork(work);
        process.addNode(workItemNode);
        new ConnectionImpl(
            startNode, Node.CONNECTION_DEFAULT_TYPE,
            workItemNode, Node.CONNECTION_DEFAULT_TYPE
        );
        new ConnectionImpl(
        workItemNode, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        ruleBase.addProcess(process);
       
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        workingMemory.getWorkItemManager().registerWorkItemHandler("MyWork", new WorkItemHandler() {
      public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
        System.out.println("Executing work item");
View Full Code Here

  public void testEmpty() {
   
  }

  public void FIXMEtestTimer() {
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ExecutorService executorService = new DefaultExecutorService();
        final StatefulSession workingMemory = new ReteooStatefulSession(1, ruleBase, executorService);
        executorService.setCommandExecutor( new CommandExecutor( workingMemory ) );

        RuleFlowProcessInstance processInstance = new RuleFlowProcessInstance() {
View Full Code Here

        new ConnectionImpl(
            join, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        ProcessInstance processInstance = workingMemory.startProcess("org.drools.process.event");
        assertEquals(0, myList.size());
        Person jack = new Person();
        jack.setName("Jack");
View Full Code Here

        new ConnectionImpl(
            actionNode, Node.CONNECTION_DEFAULT_TYPE,
            endNode2, Node.CONNECTION_DEFAULT_TYPE
        );
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        ProcessInstance processInstance = workingMemory.startProcess("org.drools.process.event");
        assertEquals(0, myList.size());
        Person jack = new Person();
        jack.setName("Jack");
View Full Code Here

        new ConnectionImpl(
            join, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        ProcessInstance processInstance = workingMemory.startProcess("org.drools.process.event");
        assertEquals(0, myList.size());
        Person jack = new Person();
        jack.setName("Jack");
View Full Code Here

        new ConnectionImpl(
            join, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        AbstractRuleBase ruleBase = (AbstractRuleBase) RuleBaseFactory.newRuleBase();
        ruleBase.addProcess(process);
        InternalWorkingMemory workingMemory = new ReteooWorkingMemory(1, ruleBase);
        ProcessInstance processInstance = workingMemory.startProcess("org.drools.process.event");
        assertEquals(0, myList.size());
        processInstance.signalEvent("myEvent", null);
        assertEquals(2, myList.size());
View Full Code Here

TOP

Related Classes of org.drools.common.AbstractRuleBase

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.