Examples of ActionUpdateField


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

                            line.substring( 0,
                                            modifyBlockEnd ).trim() :
                            line;
                }
                if ( modifyBlockEnd >= 0 ) {
                    ActionUpdateField action = new ActionUpdateField();
                    action.setVariable( modifiedVariable );
                    m.addRhsItem( action );
                    addModifiersToAction( modifiers,
                                          action,
                                          boundParams,
                                          dmo,
                                          m.getImports(),
                                          isJavaDialect );
                    modifiedVariable = null;
                    modifiers = null;
                }
            } else if ( line.startsWith( "insertLogical" ) ) {
                String fact = unwrapParenthesis( line );
                String type = getStatementType( fact,
                                                factsType );
                if ( type != null ) {
                    ActionInsertLogicalFact action = new ActionInsertLogicalFact( type );
                    m.addRhsItem( action );
                    if ( factsType.containsKey( fact ) ) {
                        addSettersToAction( setStatements,
                                            fact,
                                            action,
                                            boundParams,
                                            dmo,
                                            m.getImports(),
                                            isJavaDialect );
                    }
                }
            } else if ( line.startsWith( "insert" ) ) {
                String fact = unwrapParenthesis( line );
                String type = getStatementType( fact,
                                                factsType );
                if ( type != null ) {
                    ActionInsertFact action = new ActionInsertFact( type );
                    m.addRhsItem( action );
                    if ( factsType.containsKey( fact ) ) {
                        action.setBoundName( fact );
                        addSettersToAction( setStatements,
                                            fact,
                                            action,
                                            boundParams,
                                            dmo,
                                            m.getImports(),
                                            isJavaDialect );
                    }
                }
            } else if ( line.startsWith( "update" ) ) {
                String variable = unwrapParenthesis( line );
                ActionUpdateField action = new ActionUpdateField();
                action.setVariable( variable );
                m.addRhsItem( action );
                addSettersToAction( setStatements,
                                    variable,
                                    action,
                                    boundParams,
                                    dmo,
                                    m.getImports(),
                                    isJavaDialect );
            } else if ( line.startsWith( "modify" ) ) {
                int modifyBlockEnd = line.lastIndexOf( '}' );
                if ( modifyBlockEnd > 0 ) {
                    String variable = line.substring( line.indexOf( '(' ) + 1,
                                                      line.indexOf( ')' ) ).trim();
                    ActionUpdateField action = new ActionUpdateField();
                    action.setVariable( variable );
                    m.addRhsItem( action );
                    addModifiersToAction( line.substring( line.indexOf( '{' ) + 1,
                                                          modifyBlockEnd ).trim(),
                                          action,
                                          boundParams,
View Full Code Here

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

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

            }
            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();
View Full Code Here

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

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

        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

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

        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

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

            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

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

            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

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

            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

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

                                                                           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
TOP
Copyright © 2018 www.massapi.com. 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.