Package org.drools.workbench.models.guided.dtree.shared.model.nodes.impl

Examples of org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionFieldValueImpl


                                              model,
                                              dmo,
                                              messages,
                                              afv.getValue() );
                if ( value != null ) {
                    final ActionFieldValue _afv = new ActionFieldValueImpl( fieldName,
                                                                            value );
                    aun.getFieldValues().add( _afv );
                }
            }
            nodes.add( aun );
            return nodes;

        } else if ( a instanceof ActionInsertFact ) {
            final ActionInsertFact aif = (ActionInsertFact) a;
            final ActionInsertNode aun = new ActionInsertNodeImpl( aif.getFactType() );
            aun.setLogicalInsertion( false );
            for ( org.drools.workbench.models.datamodel.rule.ActionFieldValue afv : aif.getFieldValues() ) {
                if ( afv.getNature() != FieldNatureType.TYPE_LITERAL ) {
                    messages.add( new UnsupportedFieldNatureTypeParserMessage() );
                    return nodes;
                }
                final String fieldName = afv.getField();
                final Value value = getValue( aif.getFactType(),
                                              afv.getField(),
                                              model,
                                              dmo,
                                              messages,
                                              afv.getValue() );
                if ( value != null ) {
                    final ActionFieldValue _afv = new ActionFieldValueImpl( fieldName,
                                                                            value );
                    aun.getFieldValues().add( _afv );
                }
            }
            nodes.add( aun );
            return nodes;

        } else if ( a instanceof ActionUpdateField ) {
            final ActionUpdateField auf = (ActionUpdateField) a;
            final String binding = auf.getVariable();
            for ( TypeNode tn : types ) {
                if ( tn.isBound() ) {
                    if ( tn.getBinding().equals( binding ) ) {
                        final ActionUpdateNode aun = new ActionUpdateNodeImpl( tn );
                        aun.setModify( true );
                        for ( org.drools.workbench.models.datamodel.rule.ActionFieldValue afv : auf.getFieldValues() ) {
                            if ( afv.getNature() != FieldNatureType.TYPE_LITERAL ) {
                                messages.add( new UnsupportedFieldNatureTypeParserMessage() );
                                return nodes;
                            }
                            final String fieldName = afv.getField();
                            final Value value = getValue( tn.getClassName(),
                                                          afv.getField(),
                                                          model,
                                                          dmo,
                                                          messages,
                                                          afv.getValue() );
                            if ( value != null ) {
                                final ActionFieldValue _afv = new ActionFieldValueImpl( fieldName,
                                                                                        value );
                                aun.getFieldValues().add( _afv );
                            }
                        }
                        nodes.add( aun );
                        return nodes;
                    }
                }
            }
            messages.add( new BindingNotFoundParserMessage( binding ) );
            return nodes;

        } else if ( a instanceof ActionSetField ) {
            final ActionSetField asf = (ActionSetField) a;
            final String binding = asf.getVariable();
            for ( TypeNode tn : types ) {
                if ( tn.isBound() ) {
                    if ( tn.getBinding().equals( binding ) ) {
                        final ActionUpdateNode aun = new ActionUpdateNodeImpl( tn );
                        for ( org.drools.workbench.models.datamodel.rule.ActionFieldValue afv : asf.getFieldValues() ) {
                            if ( afv.getNature() != FieldNatureType.TYPE_LITERAL ) {
                                messages.add( new UnsupportedFieldNatureTypeParserMessage() );
                                return nodes;
                            }
                            final String fieldName = afv.getField();
                            final Value value = getValue( tn.getClassName(),
                                                          afv.getField(),
                                                          model,
                                                          dmo,
                                                          messages,
                                                          afv.getValue() );
                            if ( value != null ) {
                                final ActionFieldValue _afv = new ActionFieldValueImpl( fieldName,
                                                                                        value );
                                aun.getFieldValues().add( _afv );
                            }
                        }
                        nodes.add( aun );
View Full Code Here


        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( true );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        model.setRoot( type );
        type.addChild( c1 );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( true );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        c1.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action1 = new ActionUpdateNodeImpl( type );
        action1.setModify( true );
        action1.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                                new IntegerValue( 25 ) ) );
        type.addChild( action1 );

        final ActionRetractNode action2 = new ActionRetractNodeImpl( type );
        action1.addChild( action2 );
View Full Code Here

        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( true );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        action.getFieldValues().add( new ActionFieldValueImpl( "name",
                                                               new StringValue( "Michael" ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

                 1985 );
        dob.set( Calendar.MONTH,
                 6 );
        dob.set( Calendar.DATE,
                 15 );
        action.getFieldValues().add( new ActionFieldValueImpl( "dateOfBirth",
                                                               new DateValue( dob.getTime() ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        model.setRoot( type );
        type.addChild( c1 );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        c1.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action1 = new ActionUpdateNodeImpl( type );
        action1.setModify( false );
        action1.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                                new IntegerValue( 25 ) ) );
        type.addChild( action1 );

        final ActionRetractNode action2 = new ActionRetractNodeImpl( type );
        action1.addChild( action2 );
View Full Code Here

        type.setBinding( "$p" );
        model.setRoot( type );

        final ActionUpdateNode action = new ActionUpdateNodeImpl( type );
        action.setModify( false );
        action.getFieldValues().add( new ActionFieldValueImpl( "age",
                                                               new IntegerValue( 25 ) ) );
        action.getFieldValues().add( new ActionFieldValueImpl( "name",
                                                               new StringValue( "Michael" ) ) );
        type.addChild( action );

        final String drl = GuidedDecisionTreeDRLPersistence.getInstance().marshal( model );
        assertEqualsIgnoreWhitespace( expected,
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtree.shared.model.nodes.impl.ActionFieldValueImpl

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.