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

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


                               position );
    }

    private void addCallMethod( String itemText,
                                int position ) {
        this.model.addRhsItem( new ActionCallMethod( itemText ),
                               position );
    }
View Full Code Here


                            ActionGlobalCollectionAdd actionGlobalCollectionAdd = new ActionGlobalCollectionAdd();
                            actionGlobalCollectionAdd.setGlobalName( variable );
                            actionGlobalCollectionAdd.setFactName( factName );
                            m.addRhsItem( actionGlobalCollectionAdd );
                        } else {
                            ActionCallMethod acm = new ActionCallMethod();
                            acm.setMethodName( methodName );
                            acm.setVariable( variable );
                            m.addRhsItem( acm );
                            String params = unwrapParenthesis( line );
                            for ( String param : params.split( "," ) ) {
                                param = param.trim();
                                if ( param.length() == 0 ) {
                                    continue;
                                }
                                String dataType = inferDataType( param, isJavaDialect );
                                acm.addFieldValue( new ActionFieldFunction( null, adjustParam( dataType, param, isJavaDialect ), dataType ) );
                            }
                        }
                        continue;
                    }
                }
View Full Code Here

            FactPattern p = new FactPattern( "Person" );
            p.setBoundName( "$p" );
            m.addLhsItem( p );

            ActionCallMethod acm = new ActionCallMethod();
            acm.setMethodName( "method" );
            acm.setVariable( "$p" );
            acm.addFieldValue( new ActionFieldFunction( "f1",
                                                        "String",
                                                        DataType.TYPE_STRING ) );
            acm.addFieldValue( new ActionFieldFunction( "f2",
                                                        "true",
                                                        DataType.TYPE_BOOLEAN ) );
            acm.addFieldValue( new ActionFieldFunction( "f3",
                                                        "31-Jan-2012",
                                                        DataType.TYPE_DATE ) );
            acm.addFieldValue( new ActionFieldFunction( "f4",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
            acm.addFieldValue( new ActionFieldFunction( "f5",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_BIGDECIMAL ) );

            m.addRhsItem( acm );
View Full Code Here

            FactPattern p = new FactPattern( "Person" );
            p.setBoundName( "$p" );
            m.addLhsItem( p );

            ActionCallMethod acm = new ActionCallMethod();
            acm.setMethodName( "method" );
            acm.setVariable( "$p" );
            acm.addFieldValue( new ActionFieldFunction( "f1",
                                                        "String",
                                                        DataType.TYPE_STRING ) );
            acm.addFieldValue( new ActionFieldFunction( "f2",
                                                        "true",
                                                        DataType.TYPE_BOOLEAN ) );
            acm.addFieldValue( new ActionFieldFunction( "f3",
                                                        "31-Jan-2012",
                                                        DataType.TYPE_DATE ) );
            acm.addFieldValue( new ActionFieldFunction( "f4",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
            acm.addFieldValue( new ActionFieldFunction( "f5",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_BIGDECIMAL ) );

            m.addRhsItem( acm );
View Full Code Here

        //RHS
        assertEquals( 1,
                      m.rhs.length );
        assertTrue( m.rhs[ 0 ] instanceof ActionCallMethod );

        final ActionCallMethod a = (ActionCallMethod) m.rhs[ 0 ];
        assertEquals( "$a",
                      a.getVariable() );
        assertEquals( "addName",
                      a.getMethodName() );
        assertEquals( 1,
                      a.getFieldValues().length );

        final ActionFieldValue fv = a.getFieldValue( 0 );
        assertEquals( "Michael",
                      fv.getValue() );
    }
View Full Code Here

    // before that needs to be updated.
    private RuleModel updateMethodCall( RuleModel model ) {

        for ( int i = 0; i < model.rhs.length; i++ ) {
            if ( model.rhs[ i ] instanceof ActionCallMethod ) {
                ActionCallMethod action = (ActionCallMethod) model.rhs[ i ];
                // Check if method name is filled, if not this was made with an older Guvnor version
                if ( action.getMethodName() == null || "".equals( action.getMethodName() ) ) {
                    if ( action.getFieldValues() != null && action.getFieldValues().length >= 1 ) {
                        action.setMethodName( action.getFieldValues()[ 0 ].getField() );

                        action.setFieldValues( new ActionFieldValue[ 0 ] );
                        action.setState( ActionCallMethod.TYPE_DEFINED );
                    }
                }
            }
        }
View Full Code Here

            FactPattern p = new FactPattern( "Person" );
            p.setBoundName( "$p" );
            m.addLhsItem( p );

            ActionCallMethod acm = new ActionCallMethod();
            acm.setMethodName( "method" );
            acm.setVariable( "$p" );
            acm.addFieldValue( new ActionFieldFunction( "f1",
                                                        "String",
                                                        DataType.TYPE_STRING ) );
            acm.addFieldValue( new ActionFieldFunction( "f2",
                                                        "true",
                                                        DataType.TYPE_BOOLEAN ) );
            acm.addFieldValue( new ActionFieldFunction( "f3",
                                                        "31-Jan-2012",
                                                        DataType.TYPE_DATE ) );
            acm.addFieldValue( new ActionFieldFunction( "f4",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
            acm.addFieldValue( new ActionFieldFunction( "f5",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_BIGDECIMAL ) );

            m.addRhsItem( acm );
View Full Code Here

            FactPattern p = new FactPattern( "Person" );
            p.setBoundName( "$p" );
            m.addLhsItem( p );

            ActionCallMethod acm = new ActionCallMethod();
            acm.setMethodName( "method" );
            acm.setVariable( "$p" );
            acm.addFieldValue( new ActionFieldFunction( "f1",
                                                        "String",
                                                        DataType.TYPE_STRING ) );
            acm.addFieldValue( new ActionFieldFunction( "f2",
                                                        "true",
                                                        DataType.TYPE_BOOLEAN ) );
            acm.addFieldValue( new ActionFieldFunction( "f3",
                                                        "31-Jan-2012",
                                                        DataType.TYPE_DATE ) );
            acm.addFieldValue( new ActionFieldFunction( "f4",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_INTEGER ) );
            acm.addFieldValue( new ActionFieldFunction( "f5",
                                                        "100",
                                                        DataType.TYPE_NUMERIC_BIGDECIMAL ) );

            m.addRhsItem( acm );
View Full Code Here

        //RHS
        assertEquals( 1,
                      m.rhs.length );
        assertTrue( m.rhs[ 0 ] instanceof ActionCallMethod );

        final ActionCallMethod a = (ActionCallMethod) m.rhs[ 0 ];
        assertEquals( "$a",
                      a.getVariable() );
        assertEquals( "addName",
                      a.getMethodName() );
        assertEquals( 1,
                      a.getFieldValues().length );

        final ActionFieldValue fv = a.getFieldValue( 0 );
        assertEquals( "Michael",
                      fv.getValue() );
    }
View Full Code Here

                               position );
    }

    private void addCallMethod( String itemText,
                                int position ) {
        this.model.addRhsItem( new ActionCallMethod( itemText ),
                               position );
    }
View Full Code Here

TOP

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

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.