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

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


            return isUpdate;
        }

        private ActionSetField clone( final ActionSetField action ) {
            if ( action instanceof ActionUpdateField ) {
                final ActionUpdateField auf = (ActionUpdateField) action;
                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


        assertEquals( 1,
                      m.rhs.length );
        assertTrue( m.rhs[ 0 ] instanceof ActionUpdateField );

        ActionUpdateField field = (ActionUpdateField) m.rhs[ 0 ];
        assertEquals( "$p",
                      field.getVariable() );

        assertTrue( field.getFieldValues()[ 0 ] instanceof ActionFieldValue );
        assertEquals( 2,
                      field.getFieldValues().length );

        ActionFieldValue value1 = field.getFieldValues()[ 0 ];
        assertEquals( "firstName",
                      value1.getField() );
        assertEquals( ",)",
                      value1.getValue() );
        assertEquals( FieldNatureType.TYPE_LITERAL,
                      value1.getNature() );
        assertEquals( DataType.TYPE_STRING,
                      value1.getType() );

        ActionFieldValue value2 = field.getFieldValues()[ 1 ];
        assertEquals( "lastName",
                      value2.getField() );
        assertEquals( ",)",
                      value2.getValue() );
        assertEquals( FieldNatureType.TYPE_LITERAL,
View Full Code Here

        assertEquals( 1,
                      m.rhs.length );
        assertTrue( m.rhs[ 0 ] instanceof ActionUpdateField );

        ActionUpdateField field = (ActionUpdateField) m.rhs[ 0 ];
        assertEquals( "$p",
                      field.getVariable() );

        assertTrue( field.getFieldValues()[ 0 ] instanceof ActionFieldValue );
        assertEquals( 2,
                      field.getFieldValues().length );

        ActionFieldValue value1 = field.getFieldValues()[ 0 ];
        assertEquals( "firstName",
                      value1.getField() );
        assertEquals( ",)",
                      value1.getValue() );
        assertEquals( FieldNatureType.TYPE_LITERAL,
                      value1.getNature() );
        assertEquals( DataType.TYPE_STRING,
                      value1.getType() );

        ActionFieldValue value2 = field.getFieldValues()[ 1 ];
        assertEquals( "lastName",
                      value2.getField() );
        assertEquals( ",)",
                      value2.getValue() );
        assertEquals( FieldNatureType.TYPE_LITERAL,
View Full Code Here

            FreeFormLine ffl = (FreeFormLine) m.rhs[ 0 ];
            assertEquals( "DateTime newStartDate = new DateTime();",
                          ffl.getText() );

            assertTrue( m.rhs[ 1 ] instanceof ActionUpdateField );
            ActionUpdateField auf = (ActionUpdateField) m.rhs[ 1 ];
            assertEquals( "$bundle",
                          auf.getVariable() );
            assertEquals( 1,
                          auf.getFieldValues().length );
            ActionFieldValue afv = auf.getFieldValues()[ 0 ];
            assertEquals( "treatmentEffectiveDt",
                          afv.getField() );
            assertEquals( "newStartDate.toDate()",
                          afv.getValue() );
            assertEquals( FieldNatureType.TYPE_FORMULA,
View Full Code Here

            FreeFormLine ffl = (FreeFormLine) m.rhs[ 0 ];
            assertEquals( "java.util.Date newStartDate = new java.util.Date();",
                          ffl.getText() );

            assertTrue( m.rhs[ 1 ] instanceof ActionUpdateField );
            ActionUpdateField auf = (ActionUpdateField) m.rhs[ 1 ];
            assertEquals( "$a",
                          auf.getVariable() );
            assertEquals( 1,
                          auf.getFieldValues().length );
            ActionFieldValue afv = auf.getFieldValues()[ 0 ];
            assertEquals( "applicantDate",
                          afv.getField() );
            assertEquals( "newStartDate",
                          afv.getValue() );
            assertEquals( FieldNatureType.TYPE_FORMULA,
View Full Code Here

            FreeFormLine ffl = (FreeFormLine) m.rhs[ 0 ];
            assertEquals( "java.util.Date newStartDate = new java.util.Date();",
                          ffl.getText() );

            assertTrue( m.rhs[ 1 ] instanceof ActionUpdateField );
            ActionUpdateField auf = (ActionUpdateField) m.rhs[ 1 ];
            assertEquals( "$a",
                          auf.getVariable() );
            assertEquals( 1,
                          auf.getFieldValues().length );
            ActionFieldValue afv = auf.getFieldValues()[ 0 ];
            assertEquals( "applicantDate",
                          afv.getField() );
            assertEquals( "newStartDate",
                          afv.getValue() );
            assertEquals( FieldNatureType.TYPE_FORMULA,
View Full Code Here

                                                                           Collections.EMPTY_LIST,
                                                                           dmo );

        assertTrue( m.rhs[ 0 ] instanceof ActionUpdateField );

        ActionUpdateField field = (ActionUpdateField) m.rhs[ 0 ];
        assertTrue( field.getFieldValues()[ 0 ] instanceof ActionFieldValue );
        ActionFieldValue value = field.getFieldValues()[ 0 ];
        assertEquals( "apr", value.getField() );
        assertEquals( "application.getApr() + 5", value.getValue() );
        assertEquals( FieldNatureType.TYPE_FORMULA, value.getNature() );
        assertEquals( DataType.TYPE_NUMERIC, value.getType() );
    }
View Full Code Here

        assertEquals( 1,
                      m.rhs.length );
        IAction a = m.rhs[ 0 ];
        assertTrue( a instanceof ActionUpdateField );

        ActionUpdateField ap = (ActionUpdateField) a;
        assertEquals( "$p",
                      ap.getVariable() );

        assertEquals( 1,
                      ap.getFieldValues().length );
        ActionFieldValue afv = ap.getFieldValues()[ 0 ];
        assertEquals( "field1",
                      afv.getField() );
        assertEquals( FieldNatureType.TYPE_VARIABLE,
                      afv.getNature() );
        assertEquals( "=$f",
View Full Code Here

        assertEquals( 1,
                      m.rhs.length );
        IAction a = m.rhs[ 0 ];
        assertTrue( a instanceof ActionUpdateField );

        ActionUpdateField ap = (ActionUpdateField) a;
        assertEquals( "$p",
                      ap.getVariable() );

        assertEquals( 1,
                      ap.getFieldValues().length );
        ActionFieldValue afv = ap.getFieldValues()[ 0 ];
        assertEquals( "field1",
                      afv.getField() );
        assertEquals( FieldNatureType.TYPE_LITERAL,
                      afv.getNature() );
        assertEquals( "55",
View Full Code Here

        assertEquals( 1,
                      m.rhs.length );
        IAction a = m.rhs[ 0 ];
        assertTrue( a instanceof ActionUpdateField );

        ActionUpdateField ap = (ActionUpdateField) a;
        assertEquals( "$p",
                      ap.getVariable() );

        assertEquals( 1,
                      ap.getFieldValues().length );
        ActionFieldValue afv = ap.getFieldValues()[ 0 ];
        assertEquals( "field1",
                      afv.getField() );
        assertEquals( FieldNatureType.TYPE_VARIABLE,
                      afv.getNature() );
        assertEquals( "=$f",
View Full Code Here

TOP

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

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.