Package org.drools.workbench.models.commons.shared.rule

Examples of org.drools.workbench.models.commons.shared.rule.FactPattern


        m.name = "test literal biginteger";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "mvel" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGINTEGER );
        con.setFieldName( "field1" );
        con.setOperator( "==" );
        con.setValue( "44" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        ActionInsertFact ai = new ActionInsertFact( "Person" );
        ai.addFieldValue( new ActionFieldValue( "field1",
View Full Code Here


        m.name = "test literal bigdecimal";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "java" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGDECIMAL );
        con.setFieldName( "field1" );
        con.setOperator( "==" );
        con.setValue( "44" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        ActionInsertFact ai = new ActionInsertFact( "Person" );
        ai.addFieldValue( new ActionFieldValue( "field1",
View Full Code Here

        m.name = "test literal biginteger";

        m.addAttribute( new RuleAttribute( "dialect",
                                           "java" ) );

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_BIGINTEGER );
        con.setFieldName( "field1" );
        con.setOperator( "==" );
        con.setValue( "44" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        ActionInsertFact ai = new ActionInsertFact( "Person" );
        ai.addFieldValue( new ActionFieldValue( "field1",
View Full Code Here

    public void testLiteralBooleans() {

        RuleModel m = new RuleModel();
        m.name = "test literal booleans";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_BOOLEAN );
        con.setFieldName( "field1" );
        con.setOperator( "==" );
        con.setValue( "true" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        SingleFieldConstraint con2 = new SingleFieldConstraint();
        con2.setFieldName( "field2" );
        con2.setOperator( "==" );
        con2.setValue( "variableHere" );
        con2.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
        p.addConstraint( con2 );

        m.addLhsItem( p );

        String expected = "rule \"test literal booleans\""
                + "\tdialect \"mvel\"\n when "
View Full Code Here

    public void testLiteralDates() {

        RuleModel m = new RuleModel();
        m.name = "test literal dates";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_DATE );
        con.setFieldName( "field1" );
        con.setOperator( "==" );
        con.setValue( "31-Jan-2010" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        SingleFieldConstraint con2 = new SingleFieldConstraint();
        con2.setFieldName( "field2" );
        con2.setOperator( "==" );
        con2.setValue( "variableHere" );
        con2.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
        p.addConstraint( con2 );

        m.addLhsItem( p );

        String expected = "rule \"test literal dates\""
                + "\tdialect \"mvel\"\n when "
View Full Code Here

    public void testLiteralNoType() {

        RuleModel m = new RuleModel();
        m.name = "test literal no type";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldName( "field1" );
        con.setOperator( "==" );
        con.setValue( "bananna" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        SingleFieldConstraint con2 = new SingleFieldConstraint();
        con2.setFieldName( "field2" );
        con2.setOperator( "==" );
        con2.setValue( "variableHere" );
        con2.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
        p.addConstraint( con2 );

        m.addLhsItem( p );

        String expected = "rule \"test literal no type\""
                + "\tdialect \"mvel\"\n when "
View Full Code Here

    public void testInOperatorString() {

        RuleModel m = new RuleModel();
        m.name = "in";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_STRING );
        con.setFieldName( "field1" );
        con.setOperator( "in" );
        con.setValue( "value1, value2" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        String expected = "rule \"in\" \n"
                + "dialect \"mvel\" \n"
View Full Code Here

    public void testInOperatorNumber() {

        RuleModel m = new RuleModel();
        m.name = "in";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
        con.setFieldName( "field1" );
        con.setOperator( "in" );
        con.setValue( "55, 66" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        String expected = "rule \"in\" \n"
                + "dialect \"mvel\" \n"
View Full Code Here

    public void testNotInOperatorString() {

        RuleModel m = new RuleModel();
        m.name = "not in";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_STRING );
        con.setFieldName( "field1" );
        con.setOperator( "not in" );
        con.setValue( "value1, value2" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        String expected = "rule \"not in\" \n"
                + "dialect \"mvel\" \n"
View Full Code Here

    public void testNotInOperatorNumber() {

        RuleModel m = new RuleModel();
        m.name = "not in";

        FactPattern p = new FactPattern( "Person" );
        SingleFieldConstraint con = new SingleFieldConstraint();
        con.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
        con.setFieldName( "field1" );
        con.setOperator( "not in" );
        con.setValue( "55, 66" );
        con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        p.addConstraint( con );

        m.addLhsItem( p );

        String expected = "rule \"not in\" \n"
                + "dialect \"mvel\" \n"
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.commons.shared.rule.FactPattern

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.