Package org.drools

Examples of org.drools.RuleBase


        processInstance.setState(ProcessInstance.STATE_ABORTED);
        assertEquals(0, workingMemory.getProcessInstances().size());
    }

    public void testVariableMapping() throws Exception {
        RuleBase ruleBase = readRule(false);
        WorkingMemory workingMemory = ruleBase.newStatefulSession();
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("x", "x-value");
        org.jbpm.process.instance.ProcessInstance processInstance = ( org.jbpm.process.instance.ProcessInstance )
        workingMemory.startProcess("com.sample.ruleflow", map);
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
View Full Code Here


      "  </connections>\n" +
      "\n" +
      "</process>");
    builder.addRuleFlow(source);
    Package pkg = builder.getPackage();
    RuleBase ruleBase = RuleBaseFactory.newRuleBase();
    ruleBase.addPackage( pkg );
    return ruleBase;
  }
View Full Code Here

    ruleBase.addPackage( pkg );
    return ruleBase;
  }
 
    public void testDynamicSubProcess() throws Exception {
        RuleBase ruleBase = readDynamicSubProcess();
        WorkingMemory workingMemory = ruleBase.newStatefulSession();
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("x", "subflow");
        ProcessInstance processInstance = ( ProcessInstance )
        workingMemory.startProcess("com.sample.ruleflow", params);
        assertEquals(ProcessInstance.STATE_ACTIVE, processInstance.getState());
View Full Code Here

      "  </connections>\n" +
      "\n" +
      "</process>");
    builder.addRuleFlow(source);
    Package pkg = builder.getPackage();
    RuleBase ruleBase = RuleBaseFactory.newRuleBase();
    ruleBase.addPackage( pkg );
    return ruleBase;
  }
View Full Code Here

              for (DroolsError error: builder.getErrors().getErrors()) {
                System.err.println(error);
              }
              fail("Could not parse process");
            }
            RuleBase ruleBase = RuleBaseFactory.newRuleBase();
            ruleBase.addPackage( builder.getPackage() );
            ruleBase = SerializationHelper.serializeObject(ruleBase);
            StatefulSession session = ruleBase.newStatefulSession();
            session = SerializationHelper.getSerialisedStatefulSession(session);
            List<String> list = new ArrayList<String>();
            session.setGlobal("list", list);
            ProcessInstance processInstance = session.startProcess("org.drools.integrationtests.multithread");
            final ProcessInstanceSignalRunner[] r = new ProcessInstanceSignalRunner[THREAD_COUNT];
View Full Code Here

      "  </connections>\n" +
      "</process>";
        builder.addProcessFromXml( new StringReader( process ));
        final Package pkg = builder.getPackage();

        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage(pkg);

        StatefulSession session = ruleBase.newStatefulSession();

        List<Object> list = new ArrayList<Object>();
        session.setGlobal( "list", list );

        Person p = new Person( "bobba fet", 32);
View Full Code Here

      "</process>";
        final PackageBuilder builder = new PackageBuilder();
        builder.addProcessFromXml( new StringReader( process ));
        final Package pkg = builder.getPackage();

        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage(pkg);

        StatefulSession session = ruleBase.newStatefulSession();
        TestWorkItemHandler handler = new TestWorkItemHandler();
        session.getWorkItemManager().registerWorkItemHandler("Email", handler);
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("myVariable", "ThisIsMyValue");
        session.startProcess("org.test.ruleflow", variables);
View Full Code Here

            "        System.out.println( \"Hello\" );\n" +
            "end";
        builder.addPackageFromDrl( new StringReader( rule ));
       
        final Package pkg = builder.getPackage();
        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage(pkg);

        StatefulSession session = ruleBase.newStatefulSession();
        TestWorkItemHandler handler1 = new TestWorkItemHandler();
        session.getWorkItemManager().registerWorkItemHandler("Log", handler1);
        TestWorkItemHandler handler2 = new TestWorkItemHandler();
        session.getWorkItemManager().registerWorkItemHandler("Human Task", handler2);
        session.startProcess("com.sample.ruleflow");
View Full Code Here

            "\n" +
            "</process>\n";
        final PackageBuilder builder = new PackageBuilder();
        builder.addProcessFromXml( new StringReader( process ));
        final Package pkg = builder.getPackage();
        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage(pkg);

        StatefulSession session = ruleBase.newStatefulSession();
        TestListWorkItemHandler handler = new TestListWorkItemHandler();
        session.getWorkItemManager().registerWorkItemHandler("Human Task", handler);
        List<String> list = new ArrayList<String>();
        list.add("one");
        list.add("two");
View Full Code Here

            "\n" +
            "</process>\n";
        final PackageBuilder builder = new PackageBuilder();
        builder.addProcessFromXml( new StringReader( process ));
        final Package pkg = builder.getPackage();
        final RuleBase ruleBase = RuleBaseFactory.newRuleBase();
        ruleBase.addPackage(pkg);

        final StatefulSession session = ruleBase.newStatefulSession();

        new Thread(new Runnable() {
      public void run() {
            session.fireUntilHalt();        
      }
View Full Code Here

TOP

Related Classes of org.drools.RuleBase

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.