Examples of KnowledgeBase


Examples of org.drools.KnowledgeBase

        forEachNode.linkOutgoingConnections(
            actionNode.getId(), Node.CONNECTION_DEFAULT_TYPE,
            Node.CONNECTION_DEFAULT_TYPE);
        forEachNode.setVariable("child", personDataType);
       
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        ((AbstractRuleBase) ((InternalKnowledgeBase) kbase).getRuleBase()).addProcess(process);
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();       
       
        Map<String, Object> parameters = new HashMap<String, Object>();
        List<Person> persons = new ArrayList<Person>();
        persons.add(new Person("John Doe"));
        persons.add(new Person("Jane Doe"));
View Full Code Here

Examples of org.drools.KnowledgeBase

        new ConnectionImpl(
            subProcessNode, Node.CONNECTION_DEFAULT_TYPE,
            endNode, Node.CONNECTION_DEFAULT_TYPE
        );
       
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        ((AbstractRuleBase) ((InternalKnowledgeBase) kbase).getRuleBase()).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(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
        );
       
        ((AbstractRuleBase) ((InternalKnowledgeBase) kbase).getRuleBase()).addProcess(process);
       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        ksession.startProcess("org.drools.process.process");
        assertTrue(executed);
        assertEquals(0, ksession.getProcessInstances().size());
    }
View Full Code Here

Examples of org.drools.KnowledgeBase

import org.jbpm.ruleflow.core.RuleFlowProcess;

public class StandaloneBPMNProcessTest extends TestCase {
 
    public void testMinimalProcess() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-MinimalProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.KnowledgeBase

    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testMinimalProcessWithGraphical() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-MinimalProcessWithGraphical.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.KnowledgeBase

    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testMinimalProcessWithDIGraphical() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-MinimalProcessWithDIGraphical.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.KnowledgeBase

    ProcessInstance processInstance = ksession.startProcess("Minimal");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testCompositeProcessWithDIGraphical() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-CompositeProcessWithDIGraphical.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("Composite");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.KnowledgeBase

    ProcessInstance processInstance = ksession.startProcess("Composite");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

    public void testScriptTask() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-ScriptTask.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ProcessInstance processInstance = ksession.startProcess("ScriptTask");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }
View Full Code Here

Examples of org.drools.KnowledgeBase

    ProcessInstance processInstance = ksession.startProcess("ScriptTask");
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

    public void testDataObject() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-DataObject.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("employee", "UserId-12345");
        ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
        assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
View Full Code Here

Examples of org.drools.KnowledgeBase

        ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
        assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
    }

  public void testEvaluationProcess() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
    ksession.getWorkItemManager().registerWorkItemHandler("RegisterRequest", new SystemOutWorkItemHandler());
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "UserId-12345");
View Full Code Here

Examples of org.drools.KnowledgeBase

    ProcessInstance processInstance = ksession.startProcess("Evaluation", params);
    assertTrue(processInstance.getState() == ProcessInstance.STATE_COMPLETED);
  }

  public void testEvaluationProcess2() throws Exception {
    KnowledgeBase kbase = createKnowledgeBase("BPMN2-EvaluationProcess2.bpmn2");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
    ksession.getWorkItemManager().registerWorkItemHandler("Human Task", new SystemOutWorkItemHandler());
    Map<String, Object> params = new HashMap<String, Object>();
    params.put("employee", "UserId-12345");
    ProcessInstance processInstance = ksession.startProcess("com.sample.evaluation", params);
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.