Examples of newStatefulKnowledgeSession()


Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            "  </connections>\n" +
            "\n" +
            "</process>");
        kbuilder.add( ResourceFactory.newReaderResource( source ), ResourceType.DRF );
        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        List<String> list = new ArrayList<String>();
        ksession.setGlobal("list", list);
        ProcessInstance processInstance = ksession.startProcess("org.drools.state");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
        assertTrue(list.isEmpty());
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            "  </connections>\n" +
            "\n" +
            "</process>");
        kbuilder.add( ResourceFactory.newReaderResource( source ), ResourceType.DRF );
        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        List<String> list = new ArrayList<String>();
        ksession.setGlobal("list", list);
        ProcessInstance processInstance = ksession.startProcess("org.drools.state");
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
        assertTrue(list.isEmpty());
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            "  </connections>\n" +
            "\n" +
            "</process>");
        kbuilder.add( ResourceFactory.newReaderResource( source ), ResourceType.DRF );
        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        List<String> list = new ArrayList<String>();
        ksession.setGlobal("list", list);
        // start process
        WorkflowProcessInstance processInstance = (WorkflowProcessInstance)
            ksession.startProcess("org.drools.state");
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            "  </connections>\n" +
            "\n" +
            "</process>");
        kbuilder.add( ResourceFactory.newReaderResource( source ), ResourceType.DRF );
        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        final StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
        List<String> list = new ArrayList<String>();
        ksession.setGlobal("list", list);
        new Thread(new Runnable() {
      public void run() {
        ksession.fireUntilHalt();
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            "\n" +
            "</process>");
        kbuilder.add( ResourceFactory.newReaderResource( source ), ResourceType.DRF );
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kbuilder.getKnowledgePackages() );       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
     
        TestWorkItemHandler handler = new TestWorkItemHandler();
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("UserName", "John Doe");
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

        kbuilder.add( ResourceFactory.newReaderResource( source ), ResourceType.DRF );
       
        Collection<KnowledgePackage> kpkgs = kbuilder.getKnowledgePackages();
        KnowledgeBase kbase = KnowledgeBaseFactory.newKnowledgeBase();
        kbase.addKnowledgePackages( kpkgs );       
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
     
        ImmediateTestWorkItemHandler handler = new ImmediateTestWorkItemHandler();
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
        ksession.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
        Map<String, Object> parameters = new HashMap<String, Object>();
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            final Thread[] t = new Thread[THREAD_COUNT];
           
            final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
            kbuilder.add(ResourceFactory.newClassPathResource( "BPMN2-MultiThreadServiceProcess.bpmn" ), ResourceType.BPMN2 );
            KnowledgeBase kbase = kbuilder.newKnowledgeBase();
            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
            ksession.getWorkItemManager().registerWorkItemHandler("Log", new WorkItemHandler() {
        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
          Long threadId = (Long) workItem.getParameter("id");
//          System.out.println("Executing work item " + workItem.getId() + " for thread " + threadId);
          workItems.put(workItem.getId(), threadId);
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

            final Thread[] t = new Thread[THREAD_COUNT];
           
            final KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
            kbuilder.add(ResourceFactory.newClassPathResource( "BPMN2-MultiThreadServiceProcess.bpmn" ), ResourceType.BPMN2 );
            KnowledgeBase kbase = kbuilder.newKnowledgeBase();
            StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession();
            ksession.getWorkItemManager().registerWorkItemHandler("Log", new WorkItemHandler() {
        public void executeWorkItem(WorkItem workItem, WorkItemManager manager) {
          Long threadId = (Long) workItem.getParameter("id");
//          System.out.println("Executing process instance " + workItem.getProcessInstanceId() + " for thread " + threadId);
          workItems.put(workItem.getProcessInstanceId(), threadId);
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

    KnowledgeBase kbase = kbuilder.newKnowledgeBase();
    Properties properties = new Properties();
    properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
    properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");
    KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
    StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(config, EnvironmentFactory.newEnvironment());
    ksession.startProcess("Minimal");
  }

    public void testMultipleProcessInOneFile() {
        KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder();
View Full Code Here

Examples of org.drools.KnowledgeBase.newStatefulKnowledgeSession()

        KnowledgeBase kbase = kbuilder.newKnowledgeBase();
        Properties properties = new Properties();
        properties.put("drools.processInstanceManagerFactory", "org.jbpm.process.instance.impl.DefaultProcessInstanceManagerFactory");
        properties.put("drools.processSignalManagerFactory", "org.jbpm.process.instance.event.DefaultSignalManagerFactory");
        KnowledgeSessionConfiguration config = KnowledgeBaseFactory.newKnowledgeSessionConfiguration(properties);
        StatefulKnowledgeSession ksession = kbase.newStatefulKnowledgeSession(config, EnvironmentFactory.newEnvironment());
        ProcessInstance processInstance = ksession.startProcess("Evaluation");
        assertNotNull(processInstance);
        ProcessInstance processInstance2 = ksession.startProcess("Simple");
        assertNotNull(processInstance2);
    }
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.