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

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


        FactPattern factPattern = new FactPattern();
        factPattern.setFactType( "LoanApplication" );
        factPattern.setBoundName( "a" );
        m.lhs = new IPattern[]{ factPattern };

        ActionCallMethod actionCallMethod = new ActionCallMethod();
        actionCallMethod.setState( 1 );
        actionCallMethod.setMethodName( "clear" );
        actionCallMethod.setVariable( "keke" );
        m.rhs = new IAction[]{ actionCallMethod };

        checkMarshallUnmarshall( expected,
                                 m );
    }
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

                final ActionUpdateField clone = new ActionUpdateField( auf.getVariable() );
                clone.setFieldValues( auf.getFieldValues() );
                return clone;

            } else if ( action instanceof ActionCallMethod ) {
                final ActionCallMethod acm = (ActionCallMethod) action;
                final ActionCallMethod clone = new ActionCallMethod( acm.getVariable() );
                clone.setState( acm.getState() );
                clone.setMethodName( acm.getMethodName() );
                clone.setFieldValues( acm.getFieldValues() );
                return clone;

            } else if ( action instanceof ActionSetField ) {
                final ActionSetField clone = new ActionSetField( action.getVariable() );
                clone.setFieldValues( action.getFieldValues() );
                return clone;

            } else {
                return action;
            }
View Full Code Here

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertTrue( m.rhs[ 0 ] instanceof ActionCallMethod );
        ActionCallMethod actionGlobalCollectionAdd = (ActionCallMethod) m.rhs[ 0 ];
        assertEquals( "clear", actionGlobalCollectionAdd.getMethodName() );
        assertEquals( "keke", actionGlobalCollectionAdd.getVariable() );
        assertEquals( 1, actionGlobalCollectionAdd.getState() );
        assertEquals( 0, actionGlobalCollectionAdd.getFieldValues().length );

    }
View Full Code Here

                                                                           dmo );

        assertEquals( 2, m.getImports().getImports().size() );

        assertTrue( m.rhs[ 0 ] instanceof ActionCallMethod );
        ActionCallMethod mc = (ActionCallMethod) m.rhs[ 0 ];
        assertEquals( "put", mc.getMethodName() );
        assertEquals( "m", mc.getVariable() );
        assertEquals( 1, mc.getState() );
        assertEquals( 2, mc.getFieldValues().length );

        ActionFieldValue f1 = mc.getFieldValue( 0 );
        assertEquals( "key", f1.getValue() );
        ActionFieldValue f2 = mc.getFieldValue( 1 );
        assertEquals( "a", f2.getValue() );

        String marshalled = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
        System.out.println( marshalled );
        assertEqualsIgnoreWhitespace( drl,
View Full Code Here

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertTrue( m.rhs[ 0 ] instanceof ActionCallMethod );
        ActionCallMethod mc = (ActionCallMethod) m.rhs[ 0 ];
        assertEquals( "put", mc.getMethodName() );
        assertEquals( "m", mc.getVariable() );
        assertEquals( 1, mc.getState() );
        assertEquals( 2, mc.getFieldValues().length );

        ActionFieldValue f1 = mc.getFieldValue( 0 );
        assertEquals( "\"key\"", f1.getValue() );
        assertEquals( "java.lang.Object", f1.getType() );
        assertEquals( FieldNatureType.TYPE_LITERAL, f1.getNature() );
        ActionFieldValue f2 = mc.getFieldValue( 1 );
        assertEquals( "a", f2.getValue() );
        assertEquals( "java.lang.Object", f2.getType() );
        assertEquals( FieldNatureType.TYPE_VARIABLE, f2.getNature() );

        String marshalled = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
View Full Code Here

        RuleModel m = RuleModelDRLPersistenceImpl.getInstance().unmarshal( drl,
                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertTrue( m.rhs[ 0 ] instanceof ActionCallMethod );
        ActionCallMethod mc = (ActionCallMethod) m.rhs[ 0 ];
        assertEquals( "doSomething", mc.getMethodName() );
        assertEquals( "t", mc.getVariable() );
        assertEquals( 1, mc.getState() );
        assertEquals( 1, mc.getFieldValues().length );

        ActionFieldValue f1 = mc.getFieldValue( 0 );
        assertEquals( "1 * 2", f1.getValue() );
        assertEquals( DataType.TYPE_NUMERIC_INTEGER, f1.getType() );
        assertEquals( FieldNatureType.TYPE_FORMULA, f1.getNature() );

        String marshalled = RuleModelDRLPersistenceImpl.getInstance().marshal( m );
View Full Code Here

        FactPattern factPattern = new FactPattern();
        factPattern.setFactType( "LoanApplication" );
        factPattern.setBoundName( "a" );
        m.lhs = new IPattern[]{ factPattern };

        ActionCallMethod actionCallMethod = new ActionCallMethod();
        actionCallMethod.setState( 1 );
        actionCallMethod.setMethodName( "clear" );
        actionCallMethod.setVariable( "keke" );
        m.rhs = new IAction[]{ actionCallMethod };

        checkMarshallUnmarshall( expected, m );
    }
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.datamodel.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.