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

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


                final List<MethodInfo> mis = dmo.getProjectMethodInformation().get( previousClassName );
                boolean isMethod = false;
                if ( mis != null ) {
                    for ( MethodInfo mi : mis ) {
                        if ( mi.getName().equals( expressionPart ) ) {
                            expression.appendPart( new ExpressionMethod( mi.getName(),
                                                                         mi.getReturnClassType(),
                                                                         mi.getGenericType(),
                                                                         mi.getParametricReturnType() ) );
                            isMethod = true;
                            break;
View Full Code Here


        MethodInfo mi = sce.getMethodInfo( factName, methodName );
        if ( DataType.TYPE_COLLECTION.equals( mi.getGenericType() ) ) {
            return new ExpressionCollection( methodName, mi.getReturnClassType(),
                                             mi.getGenericType(), mi.getParametricReturnType() );
        }
        return new ExpressionMethod( mi.getName(), mi.getReturnClassType(), mi.getGenericType() );
    }
View Full Code Here

        return lb;
    }

    private void onCollectionChange( String value ) {
        if ( "size".contains( value ) ) {
            expression.appendPart( new ExpressionMethod( "size",
                                                         "int",
                                                         DataType.TYPE_NUMERIC_INTEGER ) );
        } else if ( "isEmpty".equals( value ) ) {
            expression.appendPart( new ExpressionMethod( "isEmpty",
                                                         "boolean",
                                                         DataType.TYPE_BOOLEAN ) );
        } else {
            ExpressionCollectionIndex collectionIndex;
            String factName = getCompletionEngine().getFactNameFromType( getCurrentParametricType() );
            if ( getCurrentParametricType() != null && factName != null ) {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 getCurrentParametricType(),
                                                                 factName );
            } else {
                collectionIndex = new ExpressionCollectionIndex( "get",
                                                                 "java.lang.Object",
                                                                 DataType.TYPE_OBJECT );
            }
            if ( "first".equals( value ) ) {
                collectionIndex.putParam( "index",
                                          new ExpressionFormLine( new ExpressionText( "0" ) ) );
                expression.appendPart( collectionIndex );
            } else if ( "last".equals( value ) ) {
                ExpressionFormLine index = new ExpressionFormLine( expression );
                index.appendPart( new ExpressionMethod( "size",
                                                        "int",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
                index.appendPart( new ExpressionText( "-1" ) );

                collectionIndex.putParam( "index",
View Full Code Here

            expression.removeLast();
        } else if ( DataType.TYPE_COLLECTION.equals( getCurrentGenericType() ) ) {
            onCollectionChange( value );
        } else if ( DataType.TYPE_STRING.equals( getCurrentGenericType() ) ) {
            if ( "size".equals( value ) ) {
                expression.appendPart( new ExpressionMethod( "size",
                                                             "int",
                                                             DataType.TYPE_NUMERIC_INTEGER ) );
            } else if ( "isEmpty".equals( value ) ) {
                expression.appendPart( new ExpressionText( ".size() == 0",
                                                           "",
View Full Code Here

                        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;
View Full Code Here

                                            final ExpressionFormLine expression,
                                            final String expressionPart ) {
            if ( currentField == null ) {
                boolean isMethod = currentMethodInfo != null;
                if ( isMethod ) {
                    final ExpressionMethod em = new ExpressionMethod( currentMethodInfo.getName(),
                                                                      currentMethodInfo.getReturnClassType(),
                                                                      currentMethodInfo.getGenericType(),
                                                                      currentMethodInfo.getParametricReturnType() );
                    //Add applicable parameter values
                    final List<String> parameters = parseExpressionParameters( expressionPart );
                    for ( int index = 0; index < currentMethodInfo.getParams().size(); index++ ) {
                        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 );
                        }
                    }
                    expression.appendPart( em );
                } else {
View Full Code Here

                final List<MethodInfo> mis = dmo.getProjectMethodInformation().get( previousClassName );
                boolean isMethod = false;
                if ( mis != null ) {
                    for ( MethodInfo mi : mis ) {
                        if ( mi.getName().equals( expressionPart ) ) {
                            expression.appendPart( new ExpressionMethod( mi.getName(),
                                                                         mi.getReturnClassType(),
                                                                         mi.getGenericType(),
                                                                         mi.getParametricReturnType() ) );
                            isMethod = true;
                            break;
View Full Code Here

                        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;
View Full Code Here

                        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;
View Full Code Here

                                            final ExpressionFormLine expression,
                                            final String expressionPart ) {
            if ( currentField == null ) {
                boolean isMethod = currentMethodInfo != null;
                if ( isMethod ) {
                    expression.appendPart( new ExpressionMethod( currentMethodInfo.getName(),
                                                                 currentMethodInfo.getReturnClassType(),
                                                                 currentMethodInfo.getGenericType(),
                                                                 currentMethodInfo.getParametricReturnType() ) );
                } else {
                    expression.appendPart( new ExpressionText( expressionPart ) );
View Full Code Here

TOP

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

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.