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

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


            a = new LabelledAction();
            a.boundName = sf.getBoundName();
            if ( !sf.isUpdate() ) {
                a.action = new ActionSetField( sf.getBoundName() );
            } else {
                a.action = new ActionUpdateField( sf.getBoundName() );
            }
            actions.add( a );
        } else if ( sf.isUpdate() && !( a.action instanceof ActionUpdateField ) ) {
            // lets swap it out for an update as the user has asked for it.
            ActionSetField old = (ActionSetField) a.action;
            ActionUpdateField update = new ActionUpdateField( sf.getBoundName() );
            update.setFieldValues( old.getFieldValues() );
            a.action = update;
        }
        ActionSetField asf = (ActionSetField) a.action;
        ActionFieldValue val = new ActionFieldValue( sf.getFactField(),
                                                     cell,
View Full Code Here


                                                 "33",
                                                 DataType.TYPE_NUMERIC_INTEGER ) );

        model.addRhsItem( asf );

        final ActionUpdateField auf = new ActionUpdateField();
        asf.setVariable( "$m" );
        asf.addFieldValue( new ActionFieldValue( "amount",
                                                 "10000",
                                                 DataType.TYPE_NUMERIC_INTEGER ) );
View Full Code Here

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

        ActionUpdateField actionUpdateField = new ActionUpdateField();
        actionUpdateField.setVariable( "m" );
        ActionFieldValue actionFieldValue = new ActionFieldValue();
        actionFieldValue.setField( "text" );
        actionFieldValue.setType( "String" );
        actionFieldValue.setNature( FieldNatureType.TYPE_FORMULA );
        actionFieldValue.setValue( "\"Hello \" + \"world\"" );
        actionUpdateField.setFieldValues( new ActionFieldValue[]{ actionFieldValue } );
        m.rhs = new IAction[]{ actionUpdateField };

        m.name = "my rule";

        checkMarshallUnmarshall( expected,
View Full Code Here

        final CompositeFactPattern comp = new CompositeFactPattern( "not" );
        comp.addFactPattern( new FactPattern( "Cancel" ) );
        m.addLhsItem( comp );

        final ActionUpdateField upd1 = new ActionUpdateField();
        upd1.setVariable( "p1" );
        upd1.addFieldValue( new ActionFieldValue( "status",
                                                  "rejected",
                                                  DataType.TYPE_STRING ) );
        upd1.addFieldValue( new ActionFieldValue( "name",
                                                  "Fred",
                                                  DataType.TYPE_STRING ) );
        m.addRhsItem( upd1 );

        final ActionRetractFact ret = new ActionRetractFact( "p1" );
View Full Code Here

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

            m.addLhsItem( p );

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

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

        final CompositeFactPattern comp = new CompositeFactPattern( "not" );
        comp.addFactPattern( new FactPattern( "Cancel" ) );
        m.addLhsItem( comp );

        final ActionUpdateField set = new ActionUpdateField();
        set.setVariable( "p1" );
        set.addFieldValue( new ActionFieldValue( "status",
                                                 "rejected",
                                                 DataType.TYPE_STRING ) );
        m.addRhsItem( set );

        final ActionRetractFact ret = new ActionRetractFact( "p1" );
View Full Code Here

        FactPattern factPattern = new FactPattern();
        factPattern.setFactType( "Person" );
        factPattern.setBoundName( "$p" );
        m.lhs = new IPattern[]{ factPattern };

        ActionUpdateField auf = new ActionUpdateField();
        auf.setVariable( "$p" );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setField( "name" );
        afv1.setType( DataType.TYPE_STRING );
        afv1.setNature( FieldNatureType.TYPE_LITERAL );
        afv1.setValue( "Fred" );
        ActionFieldValue afv2 = new ActionFieldValue();
        afv2.setField( "age" );
        afv2.setType( DataType.TYPE_NUMERIC_INTEGER );
        afv2.setNature( FieldNatureType.TYPE_LITERAL );
        afv2.setValue( "55" );

        auf.setFieldValues( new ActionFieldValue[]{ afv1, afv2 } );
        m.rhs = new IAction[]{ auf };

        m.name = "my rule";

        checkMarshallUnmarshall( expected,
View Full Code Here

        FactPattern factPattern = new FactPattern();
        factPattern.setFactType( "Person" );
        factPattern.setBoundName( "$p" );
        m.lhs = new IPattern[]{ factPattern };

        ActionUpdateField auf = new ActionUpdateField();
        auf.setVariable( "$p" );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setField( "name" );
        afv1.setType( DataType.TYPE_STRING );
        afv1.setNature( FieldNatureType.TYPE_LITERAL );
        afv1.setValue( "Fred" );

        auf.setFieldValues( new ActionFieldValue[]{ afv1 } );

        ActionSetField asf = new ActionSetField();
        asf.setVariable( "$p" );
        ActionFieldValue afv2 = new ActionFieldValue();
        afv2.setField( "age" );
View Full Code Here

        FactPattern factPattern = new FactPattern();
        factPattern.setFactType( "Person" );
        factPattern.setBoundName( "$p" );
        m.lhs = new IPattern[]{ factPattern };

        ActionUpdateField auf1 = new ActionUpdateField();
        auf1.setVariable( "$p" );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setField( "name" );
        afv1.setType( DataType.TYPE_STRING );
        afv1.setNature( FieldNatureType.TYPE_LITERAL );
        afv1.setValue( "Fred" );

        auf1.setFieldValues( new ActionFieldValue[]{ afv1 } );

        ActionSetField asf = new ActionSetField();
        asf.setVariable( "$p" );
        ActionFieldValue afv2 = new ActionFieldValue();
        afv2.setField( "gender" );
        afv2.setType( DataType.TYPE_STRING );
        afv2.setNature( FieldNatureType.TYPE_LITERAL );
        afv2.setValue( "X" );

        asf.setFieldValues( new ActionFieldValue[]{ afv2 } );

        ActionUpdateField auf2 = new ActionUpdateField();
        auf2.setVariable( "$p" );
        ActionFieldValue afv3 = new ActionFieldValue();
        afv3.setField( "age" );
        afv3.setType( DataType.TYPE_NUMERIC_INTEGER );
        afv3.setNature( FieldNatureType.TYPE_LITERAL );
        afv3.setValue( "55" );

        auf2.setFieldValues( new ActionFieldValue[]{ afv3 } );

        m.rhs = new IAction[]{ auf1, asf, auf2 };

        m.name = "my rule";
View Full Code Here

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

        ActionUpdateField actionUpdateField = new ActionUpdateField();
        actionUpdateField.setVariable( "m" );
        ActionFieldValue actionFieldValue = new ActionFieldValue();
        actionFieldValue.setField( "text" );
        actionFieldValue.setType( "String" );
        actionFieldValue.setNature( FieldNatureType.TYPE_FORMULA );
        actionFieldValue.setValue( "\"Hello \" + \"world\"" );
        actionUpdateField.setFieldValues( new ActionFieldValue[]{ actionFieldValue } );
        m.rhs = new IAction[]{ actionUpdateField };

        m.name = "my rule";

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