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

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


                             pattern.getConstraint(),
                             boundParams,
                             dmo );

            fcfp.setFactPattern( factPattern );
            ExpressionFormLine expression = new ExpressionFormLine();
            fcfp.setExpression( expression );

            String dataSource = from.getDataSource().toString();
            String[] splitSource = dataSource.split( "\\." );
            ModelField[] fields = null;
            for ( int i = 0; i < splitSource.length; i++ ) {
                String sourcePart = splitSource[ i ];
                if ( i == 0 ) {
                    String type = boundParams.get( sourcePart );
                    expression.appendPart( new ExpressionVariable( sourcePart, type, DataType.TYPE_NUMERIC ) );
                    fields = findFields( dmo, m, type );
                } else {
                    ModelField modelField = null;
                    for ( ModelField field : fields ) {
                        if ( field.getName().equals( sourcePart ) ) {
                            modelField = field;
                            break;
                        }
                    }
                    expression.appendPart( new ExpressionField( sourcePart, modelField.getClassName(), modelField.getType() ) );
                    fields = findFields( dmo, m, modelField.getClassName() );
                }
            }

            return fcfp;
View Full Code Here


                                                    factPattern,
                                                    con ) ) {
                        type = DataType.TYPE_COMPARABLE;
                        con.setConstraintValueType( SingleFieldConstraint.TYPE_ENUM );
                    } else if ( value.indexOf( '.' ) > 0 && boundParams.containsKey( value.substring( 0, value.indexOf( '.' ) ).trim() ) ) {
                        con.setExpressionValue( parseExpression( m, null, value, new ExpressionFormLine() ) );
                        con.setConstraintValueType( BaseSingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE );
                        value = "";
                    } else {
                        con.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
                    }
View Full Code Here

                             pattern.getConstraint(),
                             boundParams,
                             dmo );

            fcfp.setFactPattern( factPattern );
            ExpressionFormLine expression = new ExpressionFormLine();
            fcfp.setExpression( expression );

            String dataSource = from.getDataSource().toString();
            String[] splitSource = dataSource.split( "\\." );
            ModelField[] fields = null;
            for ( int i = 0; i < splitSource.length; i++ ) {
                String sourcePart = splitSource[ i ];
                if ( i == 0 ) {
                    String type = boundParams.get( sourcePart );
                    expression.appendPart( new ExpressionVariable( sourcePart, type, DataType.TYPE_NUMERIC ) );
                    fields = findFields( dmo, m, type );
                } else {
                    ModelField modelField = null;
                    for ( ModelField field : fields ) {
                        if ( field.getName().equals( sourcePart ) ) {
                            modelField = field;
                            break;
                        }
                    }
                    if ( modelField == null ) {
                        final String previousClassName = expression.getClassType();
                        final List<MethodInfo> mis = dmo.getProjectMethodInformation().get( previousClassName );
                        boolean isMethod = false;
                        if ( mis != null ) {
                            for ( MethodInfo mi : mis ) {
                                if ( mi.getName().equals( sourcePart ) ) {
                                    expression.appendPart( new ExpressionMethod( mi.getName(),
                                                                                 mi.getReturnClassType(),
                                                                                 mi.getGenericType(),
                                                                                 mi.getParametricReturnType() ) );
                                    isMethod = true;
                                    break;
                                }
                            }
                        }
                        if ( isMethod == false ) {
                            expression.appendPart( new ExpressionText( sourcePart ) );
                        }
                    } else {
                        expression.appendPart( new ExpressionField( sourcePart,
                                                                    modelField.getClassName(),
                                                                    modelField.getType() ) );
                        fields = findFields( dmo,
                                             m,
                                             modelField.getClassName() );
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

                             isJavaDialect,
                             boundParams,
                             dmo );

            fcfp.setFactPattern( factPattern );
            ExpressionFormLine expression = new ExpressionFormLine();
            fcfp.setExpression( expression );

            String dataSource = from.getDataSource().toString();
            String[] splitSource = dataSource.split( "\\." );
            ModelField[] fields = null;
            for ( int i = 0; i < splitSource.length; i++ ) {
                String sourcePart = splitSource[ i ];
                if ( i == 0 ) {
                    String type = boundParams.get( sourcePart );
                    expression.appendPart( new ExpressionVariable( sourcePart,
                                                                   type,
                                                                   DataType.TYPE_NUMERIC ) );
                    fields = findFields( m,
                                         dmo,
                                         type );
                } else {
                    ModelField modelField = null;
                    for ( ModelField field : fields ) {
                        if ( field.getName().equals( sourcePart ) ) {
                            modelField = field;
                            break;
                        }
                    }
                    if ( modelField == null ) {
                        final String previousClassName = expression.getClassType();
                        final List<MethodInfo> mis = dmo.getProjectMethodInformation().get( previousClassName );
                        boolean isMethod = false;
                        if ( mis != null ) {
                            for ( MethodInfo mi : mis ) {
                                if ( mi.getName().equals( sourcePart ) ) {
                                    expression.appendPart( new ExpressionMethod( mi.getName(),
                                                                                 mi.getReturnClassType(),
                                                                                 mi.getGenericType(),
                                                                                 mi.getParametricReturnType() ) );
                                    isMethod = true;
                                    break;
                                }
                            }
                        }
                        if ( isMethod == false ) {
                            expression.appendPart( new ExpressionText( sourcePart ) );
                        }
                    } else {
                        expression.appendPart( new ExpressionField( sourcePart,
                                                                    modelField.getClassName(),
                                                                    modelField.getType() ) );
                        fields = findFields( m,
                                             dmo,
                                             modelField.getClassName() );
View Full Code Here

                        final String paramDataType = currentMethodInfo.getParams().get( index );
                        final String paramValue = getParameterValue( paramDataType,
                                                                     parameters,
                                                                     index );
                        if ( paramValue != null ) {
                            final ExpressionFormLine param = new ExpressionFormLine( index );
                            param.appendPart( new ExpressionMethodParameter( paramValue,
                                                                             paramDataType,
                                                                             paramDataType ) );
                            em.putParam( paramDataType,
                                         param );
                        }
View Full Code Here

                    } else if ( value.indexOf( '.' ) > 0 && boundParams.containsKey( value.substring( 0,
                                                                                                      value.indexOf( '.' ) ).trim() ) ) {
                        con.setExpressionValue( parseExpression( m,
                                                                 null,
                                                                 value,
                                                                 new ExpressionFormLine() ) );
                        con.setConstraintValueType( BaseSingleFieldConstraint.TYPE_EXPR_BUILDER_VALUE );
                        value = "";
                    } else {
                        con.setConstraintValueType( SingleFieldConstraint.TYPE_VARIABLE );
                    }
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

                      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

                        final String paramDataType = currentMethodInfo.getParams().get( index );
                        final String paramValue = getParameterValue( paramDataType,
                                                                     parameters,
                                                                     index );
                        if ( paramValue != null ) {
                            final ExpressionFormLine param = new ExpressionFormLine( index );
                            param.appendPart( new ExpressionMethodParameter( paramValue,
                                                                             paramDataType,
                                                                             paramDataType ) );
                            em.putParam( paramDataType,
                                         param );
                        }
View Full Code Here

TOP

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

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.