Package org.drools.rule

Examples of org.drools.rule.FactType.newInstance()


        // Retrieve the generated fact type
        FactType cheeseFact = ruleBase.getFactType( "org.drools.generatedbeans.Cheese" );

        // Create a new Fact instance
        Object cheese = cheeseFact.newInstance();

        // Set a field value using the more verbose method chain...
        // should we add short cuts?
        //        cheeseFact.getField( "type" ).getFieldAccessor().setValue( cheese,
        //                                                             "stilton" );
View Full Code Here




        FactType personType = ruleBase.getFactType( "org.drools.generatedbeans.Person" );

        Object ps = personType.newInstance();
        personType.set( ps,
                        "age",
                        42 );

        Map<String, Object> personMap = personType.getAsMap( ps );
View Full Code Here

        // creating a person that likes the cheese:
        // Retrieve the generated fact type
        FactType personFact = ruleBase.getFactType( "org.drools.generatedbeans.Person" );

        // Create a new Fact instance
        Object person = personFact.newInstance();

        // Set a field value using the more verbose method chain...
        // should we add short cuts?
        personFact.getField( "likes" ).getFieldAccessor().setValue( person,
                                                                    cheese );
View Full Code Here

        FactType af = ruleBase.getFactType( "mortgages.LoanApplication" );

        Object person = pf.newInstance();
        pf.set(person, "creditRating", "OK");

        Object application = af.newInstance();
        StatefulSession sess = ruleBase.newStatefulSession();
        sess.insert(person);
        sess.insert(application);

        sess.fireAllRules();
View Full Code Here

        // Retrieve the generated fact type
        FactType cheeseFact = ruleBase.getFactType( "org.drools.generatedbeans.Cheese" );

        // Create a new Fact instance
        Object cheese = cheeseFact.newInstance();

        cheeseFact.set( cheese,
                        "type",
                        "stilton" );
        assertEquals( "stilton",
View Full Code Here

        assertEquals( "stilton",
                      cheeseFact.get( cheese,
                                      "type" ) );

        // testing equals method
        Object cheese2 = cheeseFact.newInstance();
        cheeseFact.set( cheese2,
                        "type",
                        "stilton" );
        assertEquals( cheese,
                      cheese2 );
View Full Code Here

                      cheese2 );


        FactType personType = ruleBase.getFactType( "org.drools.generatedbeans.Person" );

        Object ps = personType.newInstance();
        personType.set( ps,
                        "name",
                        "mark" );
        personType.set( ps,
                        "last",
View Full Code Here

                        "proctor" );
        personType.set( ps,
                        "age",
                        42 );

        Object ps2 = personType.newInstance();
        personType.set( ps2,
                        "name",
                        "mark" );
        personType.set( ps2,
                        "last",
View Full Code Here

        // creating a person that likes the cheese:
        // Retrieve the generated fact type
        FactType personFact = ruleBase.getFactType( "org.drools.generatedbeans.Person" );

        // Create a new Fact instance
        Object person = personFact.newInstance();

        // Set a field value using the more verbose method chain...
        // should we add short cuts?
        personFact.getField( "likes" ).getFieldAccessor().setValue( person,
                                                                    cheese );
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.