Package org.drools.workbench.models.datamodel.rule

Examples of org.drools.workbench.models.datamodel.rule.ExpressionFormLine$ToStringVisitor


                      fp3.getFactType() );
        assertEquals( 0,
                      fp3.getNumberOfConstraints() );

        assertNotNull( fp2.getExpression() );
        ExpressionFormLine efl = fp2.getExpression();
        assertEquals( 3,
                      efl.getParts().size() );
        assertTrue( efl.getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable ev = (ExpressionVariable) efl.getParts().get( 0 );
        assertEquals( "$trans",
                      ev.getName() );
        assertEquals( "Transactions",
                      ev.getClassType() );
        assertTrue( efl.getParts().get( 1 ) instanceof ExpressionText );
        ExpressionText et1 = (ExpressionText) efl.getParts().get( 1 );
        assertEquals( "getRecCategorization()",
                      et1.getName() );
        assertEquals( "java.lang.String",
                      et1.getClassType() );
        assertEquals( DataType.TYPE_STRING,
                      et1.getGenericType() );
        assertTrue( efl.getParts().get( 2 ) instanceof ExpressionText );
        ExpressionText et2 = (ExpressionText) efl.getParts().get( 2 );
        assertEquals( "get(\"APES-01\")",
                      et2.getName() );
        assertEquals( "java.lang.String",
                      et2.getClassType() );
        assertEquals( DataType.TYPE_STRING,
View Full Code Here


        }
        return clone;
    }

    private ExpressionFormLine visitExpressionFormLine( ExpressionFormLine efl ) {
        ExpressionFormLine clone = new ExpressionFormLine( efl );
        clone.setBinding( efl.getBinding() );
        return clone;
    }
View Full Code Here

                if ( !Character.isDigit( value.charAt( 0 ) ) ) {
                    if ( value.equals( "true" ) || value.equals( "false" ) ) {
                        type = DataType.TYPE_BOOLEAN;
                        con.setConstraintValueType( BaseSingleFieldConstraint.TYPE_ENUM );
                    } else if ( value.indexOf( '.' ) > 0 && boundParams.containsKey( value.substring( 0, value.indexOf( '.' ) ).trim() ) ) {
                        con.setExpressionValue( parseExpression( null, value, null, new ExpressionFormLine() ) );
                        value = "";
                    } else {
                        con.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
                    }
                } else {
View Full Code Here

        constraint.setOperator( "!=" );
        pattern.addConstraint( constraint );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( pattern );
        ExpressionFormLine expression = new ExpressionFormLine();
        expression.setBinding( "person.addresses" );
        fromCompositeFactPattern.setExpression( expression );

        model.lhs = new IPattern[]{ boundPattern, fromCompositeFactPattern };

        assertFalse( validator.isValid() );
View Full Code Here

        SingleFieldConstraint constraint = new SingleFieldConstraint( "street" );
        pattern.addConstraint( constraint );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( pattern );
        ExpressionFormLine expression = new ExpressionFormLine();
        expression.setBinding( "person.addresses" );
        fromCompositeFactPattern.setExpression( expression );

        model.lhs = new IPattern[]{ boundPattern, fromCompositeFactPattern };

        assertTrue( validator.isValid() );
View Full Code Here

        FactPattern factPattern = new FactPattern( "SomeList" );
        factPattern.setBoundName( "list" );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( new FactPattern( "Person" ) );
        ExpressionFormLine expression = new ExpressionFormLine();
        expression.appendPart( new ExpressionVariable( "list", "SomeList", "SomeList" ) );
        fromCompositeFactPattern.setExpression( expression );
        model.lhs = new IPattern[]{ fromCompositeFactPattern };

        assertTrue( validator.isValid() );
    }
View Full Code Here

        SingleFieldConstraint constraint = new SingleFieldConstraint( "street" );
        pattern.addConstraint( constraint );

        FromCompositeFactPattern fromCompositeFactPattern = new FromCompositeFactPattern();
        fromCompositeFactPattern.setFactPattern( pattern );
        ExpressionFormLine expression = new ExpressionFormLine();
        fromCompositeFactPattern.setExpression( expression );

        model.lhs = new IPattern[]{ fromCompositeFactPattern };

        assertFalse( validator.isValid() );
View Full Code Here

        pattern2.addConstraint( constraint2 );

        FromAccumulateCompositeFactPattern fromAccumulateCompositeFactPattern = new FromAccumulateCompositeFactPattern();
        fromAccumulateCompositeFactPattern.setSourcePattern( pattern1 );
        fromAccumulateCompositeFactPattern.setFactPattern( pattern2 );
        ExpressionFormLine expression = new ExpressionFormLine();
        expression.setBinding( "person.addresses" );
        fromAccumulateCompositeFactPattern.setExpression( expression );

        model.lhs = new IPattern[]{ fromAccumulateCompositeFactPattern };

        assertTrue( validator.isValid() );
View Full Code Here

        IPattern p1 = m.lhs[ 1 ];
        assertTrue( p1 instanceof FromCompositeFactPattern );

        FromCompositeFactPattern fcfp1 = (FromCompositeFactPattern) p1;
        FactPattern fp1 = fcfp1.getFactPattern();
        ExpressionFormLine efl1 = fcfp1.getExpression();

        assertNotNull( fp1 );
        assertNotNull( efl1 );

        assertEquals( "Number",
                      fp1.getFactType() );
        assertEquals( 0,
                      fp1.getNumberOfConstraints() );

        assertEquals( 2,
                      efl1.getParts().size() );
        assertTrue( efl1.getParts().get( 0 ) instanceof ExpressionVariable );
        assertTrue( efl1.getParts().get( 1 ) instanceof ExpressionField );

        ExpressionVariable eflv1 = (ExpressionVariable) efl1.getParts().get( 0 );
        assertEquals( "cc",
                      eflv1.getName() );
        assertEquals( "Counter",
                      eflv1.getClassType() );
        assertEquals( DataType.TYPE_NUMERIC,
                      eflv1.getGenericType() );

        ExpressionField eflf1 = (ExpressionField) efl1.getParts().get( 1 );
        assertEquals( "number",
                      eflf1.getName() );
        assertEquals( "java.lang.Number",
                      eflf1.getClassType() );
        assertEquals( DataType.TYPE_NUMERIC,
View Full Code Here

                      fp3.getFactType() );
        assertEquals( 0,
                      fp3.getNumberOfConstraints() );

        assertNotNull( fp2.getExpression() );
        ExpressionFormLine efl = fp2.getExpression();
        assertEquals( 3,
                      efl.getParts().size() );
        assertTrue( efl.getParts().get( 0 ) instanceof ExpressionVariable );
        ExpressionVariable ev = (ExpressionVariable) efl.getParts().get( 0 );
        assertEquals( "$trans",
                      ev.getName() );
        assertEquals( "Transactions",
                      ev.getClassType() );
        assertTrue( efl.getParts().get( 1 ) instanceof ExpressionMethod );
        ExpressionMethod em = (ExpressionMethod) efl.getParts().get( 1 );
        assertEquals( "getRecCategorization()",
                      em.getName() );
        assertEquals( "java.util.Map",
                      em.getClassType() );
        assertEquals( DataType.TYPE_COLLECTION,
                      em.getGenericType() );
        assertTrue( efl.getParts().get( 2 ) instanceof ExpressionText );
        ExpressionText et = (ExpressionText) efl.getParts().get( 2 );
        assertEquals( "get(\"APES-01\")",
                      et.getName() );
        assertEquals( "java.lang.String",
                      et.getClassType() );
        assertEquals( DataType.TYPE_STRING,
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.rule.ExpressionFormLine$ToStringVisitor

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.