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

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


                             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

                                                    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

                             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( 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

                    } 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

                container.add( new Label( expressionPart.getName() ) );
                container.add( new Label( "(" ) );
                final ExpressionMethod em = (ExpressionMethod) expressionPart;
                final List<ExpressionFormLine> emParams = em.getOrderedParams();
                for ( int index = 0; index < emParams.size(); index++ ) {
                    final ExpressionFormLine paramValueHolder = emParams.get( index );
                    final String paramDataType = em.getParameterDataType( paramValueHolder );
                    final ExpressionMethodParameter paramValue = ( (ExpressionMethodParameter) paramValueHolder.getRootExpression() );
                    final TextBox paramValueEditor = TextBoxFactory.getTextBox( paramDataType );
                    paramValueEditor.addValueChangeHandler( new ValueChangeHandler<String>() {
                        @Override
                        public void onValueChange( ValueChangeEvent<String> event ) {
                            paramValue.setText( event.getValue() );
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

                //Reset Constraint's value and value type
                if ( Window.confirm( Constants.INSTANCE.RemoveConstraintValueDefinitionQuestion() ) ) {
                    constraint.setConstraintValueType( BaseSingleFieldConstraint.TYPE_UNDEFINED );
                    constraint.setValue( null );
                    constraint.clearParameters();
                    constraint.setExpressionValue( new ExpressionFormLine() );
                    doTypeChosen();
                }
            }

        } );
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.