Package org.drools.jsr94.rules

Examples of org.drools.jsr94.rules.StatefulRuleSessionImpl


        RuleBaseConfiguration config = ( RuleBaseConfiguration ) this.properties.get( Constants.RES_RULEBASE_CONFIG );
        org.drools.reteoo.ReteooRuleBase ruleBase;
        if ( config != null ) {
            ruleBase = new org.drools.reteoo.ReteooRuleBase( null,
                                                             config,
                                                             new Jsr94FactHandleFactory() );
        } else {
            ruleBase = new org.drools.reteoo.ReteooRuleBase( null,
                                                             new Jsr94FactHandleFactory() );           
        }
        ruleBase.addPackage( pkg );

        this.ruleBase = ruleBase;
    }
View Full Code Here


    }

    @Test
    public void testExecuteRules() {
        instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .serviceProviderProperties(null)
                .executionSetProperties(null)
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .sessionProperties(null)
                .bulid();
View Full Code Here

    public void testExecuteRulesWithGlobal() {
        Map sessionProperties = new HashMap();
        Map globalMap = new HashMap();
        sessionProperties.put("map", globalMap);
        instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .serviceProviderProperties(null)
                .executionSetProperties(null)
                .ruleSource(getClass().getResourceAsStream("/rule/example.drl"))
                .sessionProperties(sessionProperties)
                .bulid();
View Full Code Here

    yyang = new Person(3L, "yyang", "male");
  }

  private StatefulRuleTemplate createStatefulRuleTemplate() {
    InputStream ruleSource = getClass().getResourceAsStream(ruleDrl);
    StatefulRuleTemplate result = new StatefulRuleTemplate(new RuleServiceProviderImpl()).ruleSource(ruleSource);
    return result;
  }
View Full Code Here

  String ruleDrl = "/rule/Foo.drl";

  @Test
  public void item1() throws Exception {
        StatelessRuleService instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .bulid();
    List<?> globalStatelessResults = instance.executeRules(createObjects());
    for (Object object : globalStatelessResults) {
      System.out.println(object);
View Full Code Here

    // Execute rule
    List<Person> objects = new ArrayList<Person>();
    objects.add(new Person(1L, "chencao"));

        StatelessRuleService instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .bulid();

        // Execute rule
        List statelessResults = instance.executeRules(Arrays.asList(new Person(1L, "chencao")));
View Full Code Here

    List globalList = new ArrayList();
    Map sessionProperties = new HashMap();
    sessionProperties.put("list", globalList);

        StatelessRuleService instance = StatelessRuleServiceJsr94.builder()
                .ruleServiceProvider(new RuleServiceProviderImpl())
                .ruleSource(getClass().getResourceAsStream(ruleDrl))
                .sessionProperties(sessionProperties)
                .bulid();

    // Execute rule
View Full Code Here

   */
  public synchronized RuleAdministrator getRuleAdministrator() {
    if (this.ruleAdministrator != null) {
      return this.ruleAdministrator;
    }
    return this.ruleAdministrator = new RuleAdministratorImpl(getRepository());
  }
View Full Code Here

     * @return an instance of <code>RuleAdministrator</code>
     */
    public synchronized RuleAdministrator getRuleAdministrator() {
        // Lazy instantiate
        if ( this.ruleAdministrator == null ) {
            this.ruleAdministrator = new RuleAdministratorImpl( getRepository() );
        }
        return this.ruleAdministrator;
    }
View Full Code Here

     * @return an instance of <code>RuleAdministrator</code>
     */
    public synchronized RuleAdministrator getRuleAdministrator() {
        // Lazy instantiate
        if ( this.ruleAdministrator == null ) {
            this.ruleAdministrator = new RuleAdministratorImpl( getRepository() );
        }
        return this.ruleAdministrator;
    }
View Full Code Here

TOP

Related Classes of org.drools.jsr94.rules.StatefulRuleSessionImpl

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.