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

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


        p4.setName( "StringResult" );
        pwd.addResult( p4 );

        m.addRhsItem( awi );

        ActionSetField asf = new ActionSetField();
        asf.setVariable( "$r" );
        ActionWorkItemFieldValue fv1 = new ActionWorkItemFieldValue( "ResultsBooleanResult",
                                                                     DataType.TYPE_BOOLEAN,
                                                                     "WorkItem",
                                                                     "BooleanResult",
                                                                     Boolean.class.getName() );
        asf.addFieldValue( fv1 );
        ActionWorkItemFieldValue fv2 = new ActionWorkItemFieldValue( "ResultsFloatResult",
                                                                     DataType.TYPE_NUMERIC_FLOAT,
                                                                     "WorkItem",
                                                                     "FloatResult",
                                                                     Float.class.getName() );
        asf.addFieldValue( fv2 );
        ActionWorkItemFieldValue fv3 = new ActionWorkItemFieldValue( "ResultsIntegerResult",
                                                                     DataType.TYPE_NUMERIC_INTEGER,
                                                                     "WorkItem",
                                                                     "IntegerResult",
                                                                     Integer.class.getName() );
        asf.addFieldValue( fv3 );
        ActionWorkItemFieldValue fv4 = new ActionWorkItemFieldValue( "ResultsStringResult",
                                                                     DataType.TYPE_STRING,
                                                                     "WorkItem",
                                                                     "StringResult",
                                                                     String.class.getName() );
        asf.addFieldValue( fv4 );

        m.addRhsItem( asf );

        String result = BRDRLPersistence.getInstance().marshal( m );
View Full Code Here


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

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

        final ActionFieldValue fv = a.getFieldValues()[ 0 ];
        assertEquals( "name",
                      fv.getField() );
        assertEquals( "Michael",
                      fv.getValue() );
    }
View Full Code Here

        final FreeFormLine ffl = (FreeFormLine) m.rhs[ 0 ];
        assertEquals( "Here's something typed by the user as free-format DRL",
                      ffl.getText() );

        assertTrue( m.rhs[ 1 ] instanceof ActionSetField );
        final ActionSetField a1 = (ActionSetField) m.rhs[ 1 ];
        assertEquals( "$a",
                      a1.getVariable() );
        assertEquals( 2,
                      a1.getFieldValues().length );

        final ActionFieldValue fv1a1 = a1.getFieldValues()[ 0 ];
        assertEquals( "name",
                      fv1a1.getField() );
        assertEquals( "Michael",
                      fv1a1.getValue() );

        final ActionFieldValue fv1a2 = a1.getFieldValues()[ 1 ];
        assertEquals( "age",
                      fv1a2.getField() );
        assertEquals( "40",
                      fv1a2.getValue() );
    }
View Full Code Here

            con.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
            p.addConstraint( con );

            m.addLhsItem( p );

            ActionSetField au = new ActionSetField( "$p" );
            au.addFieldValue( new ActionFieldValue( "dob",
                                                    "31-Jan-2000",
                                                    DataType.TYPE_DATE ) );
            m.addRhsItem( au );

            String result = BRDRLPersistence.getInstance().marshal( m );
View Full Code Here

        p4.setName( "StringResult" );
        pwd.addResult( p4 );

        m.addRhsItem( awi );

        ActionSetField asf = new ActionSetField();
        asf.setVariable( "$r" );
        ActionWorkItemFieldValue fv1 = new ActionWorkItemFieldValue( "ResultsBooleanResult",
                                                                     DataType.TYPE_BOOLEAN,
                                                                     "WorkItem",
                                                                     "BooleanResult",
                                                                     Boolean.class.getName() );
        asf.addFieldValue( fv1 );
        ActionWorkItemFieldValue fv2 = new ActionWorkItemFieldValue( "ResultsFloatResult",
                                                                     DataType.TYPE_NUMERIC_FLOAT,
                                                                     "WorkItem",
                                                                     "FloatResult",
                                                                     Float.class.getName() );
        asf.addFieldValue( fv2 );
        ActionWorkItemFieldValue fv3 = new ActionWorkItemFieldValue( "ResultsIntegerResult",
                                                                     DataType.TYPE_NUMERIC_INTEGER,
                                                                     "WorkItem",
                                                                     "IntegerResult",
                                                                     Integer.class.getName() );
        asf.addFieldValue( fv3 );
        ActionWorkItemFieldValue fv4 = new ActionWorkItemFieldValue( "ResultsStringResult",
                                                                     DataType.TYPE_STRING,
                                                                     "WorkItem",
                                                                     "StringResult",
                                                                     String.class.getName() );
        asf.addFieldValue( fv4 );

        m.addRhsItem( asf );

        String result = BRDRLPersistence.getInstance().marshal( m );
View Full Code Here

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

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

        final ActionFieldValue fv = a.getFieldValues()[ 0 ];
        assertEquals( "name",
                      fv.getField() );
        assertEquals( "Michael",
                      fv.getValue() );
    }
View Full Code Here

        final FreeFormLine ffl = (FreeFormLine) m.rhs[ 0 ];
        assertEquals( "Here's something typed by the user as free-format DRL",
                      ffl.getText() );

        assertTrue( m.rhs[ 1 ] instanceof ActionSetField );
        final ActionSetField a1 = (ActionSetField) m.rhs[ 1 ];
        assertEquals( "$a",
                      a1.getVariable() );
        assertEquals( 2,
                      a1.getFieldValues().length );

        final ActionFieldValue fv1a1 = a1.getFieldValues()[ 0 ];
        assertEquals( "name",
                      fv1a1.getField() );
        assertEquals( "Michael",
                      fv1a1.getValue() );

        final ActionFieldValue fv1a2 = a1.getFieldValues()[ 1 ];
        assertEquals( "age",
                      fv1a2.getField() );
        assertEquals( "40",
                      fv1a2.getValue() );
    }
View Full Code Here

    }

    @Test
    public void testAddItemRhs() {
        final RuleModel model = new RuleModel();
        final IAction a0 = new ActionSetField();
        final IAction a1 = new ActionSetField();

        model.addRhsItem( a0 );

        assertEquals( 1,
                model.rhs.length );
View Full Code Here

                model.getLHSBoundFact( "y" ) );
        assertEquals( x,
                model.getLHSBoundFact( "x" ) );

        model.rhs = new IAction[1];
        final ActionSetField set = new ActionSetField();
        set.setVariable( "x" );
        model.rhs[0] = set;

        assertTrue( model.isBoundFactUsed( "x" ) );
        assertFalse( model.isBoundFactUsed( "y" ) );
View Full Code Here

        assertFalse( m.hasDSLSentences() );

        m.addLhsItem( new FactPattern() );
        assertFalse( m.hasDSLSentences() );

        m.addRhsItem( new ActionSetField( "q" ) );

        assertFalse( m.hasDSLSentences() );

        m.addLhsItem( new DSLSentence() );
        assertTrue( m.hasDSLSentences() );
View Full Code Here

TOP

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

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.