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

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


        FactPattern fp = new FactPattern( "Person" );
        fp.setBoundName( "$p" );
        m.addLhsItem( fp );

        ActionInsertFact aif = new ActionInsertFact( "Present" );
        aif.setBoundName( "f0" );
        ActionFieldValue afv0 = new ActionFieldValue();
        afv0.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv0.setField( "field1" );
        afv0.setValue( "$f1" );
        aif.addFieldValue( afv0 );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv1.setField( "field2" );
        afv1.setValue( "$f2" );
        aif.addFieldValue( afv1 );

        m.addRhsItem( aif );

        String expected = "rule \"r1_0\"\n"
                + "dialect \"mvel\"\n"
View Full Code Here


        FactPattern fp = new FactPattern( "Person" );
        fp.setBoundName( "$p" );
        m.addLhsItem( fp );

        ActionInsertFact aif = new ActionInsertFact( "Present" );
        aif.setBoundName( "f0" );
        ActionFieldValue afv0 = new ActionFieldValue();
        afv0.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv0.setField( "field1" );
        afv0.setValue( "$f1" );
        aif.addFieldValue( afv0 );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv1.setField( "field2" );
        afv1.setValue( "$f2" );
        aif.addFieldValue( afv1 );

        m.addRhsItem( aif );

        String expected = "rule \"r1_0\"\n"
                + "dialect \"mvel\"\n"
View Full Code Here

        FactPattern fp = new FactPattern( "Person" );
        fp.setBoundName( "$p" );
        m.addLhsItem( fp );

        ActionInsertFact aif = new ActionInsertFact( "Present" );
        aif.setBoundName( "f0" );
        ActionFieldValue afv0 = new ActionFieldValue();
        afv0.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv0.setField( "field1" );
        afv0.setValue( "$f1" );
        aif.addFieldValue( afv0 );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv1.setField( "field2" );
        afv1.setValue( "$f2" );
        aif.addFieldValue( afv1 );

        m.addRhsItem( aif );

        String expected = "rule \"r1_0\"\n"
                + "dialect \"mvel\"\n"
View Full Code Here

        FactPattern fp = new FactPattern( "Person" );
        fp.setBoundName( "$p" );
        m.addLhsItem( fp );

        ActionInsertFact aif = new ActionInsertFact( "Present" );
        aif.setBoundName( "f0" );
        ActionFieldValue afv0 = new ActionFieldValue();
        afv0.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv0.setField( "field1" );
        afv0.setValue( "$f1" );
        aif.addFieldValue( afv0 );
        ActionFieldValue afv1 = new ActionFieldValue();
        afv1.setNature( FieldNatureType.TYPE_TEMPLATE );
        afv1.setField( "field2" );
        afv1.setValue( "$f2" );
        aif.addFieldValue( afv1 );

        m.addRhsItem( aif );

        String expected = "rule \"r1_0\"\n"
                + "dialect \"mvel\"\n"
View Full Code Here

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

        ActionInsertFact ap = (ActionInsertFact) a;
        assertEquals( "Person",
                      ap.getFactType() );
        assertEquals( "fact0",
                      ap.getBoundName() );

        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 ActionInsertFact );

        ActionInsertFact ap = (ActionInsertFact) a;
        assertEquals( "Person",
                      ap.getFactType() );
        assertEquals( "fact0",
                      ap.getBoundName() );

        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 ActionInsertFact );

        ActionInsertFact ap = (ActionInsertFact) a;
        assertEquals( "Person",
                      ap.getFactType() );
        assertEquals( "fact0",
                      ap.getBoundName() );

        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 ActionInsertFact );

        ActionInsertFact ap = (ActionInsertFact) a;
        assertEquals( "Person",
                      ap.getFactType() );
        assertEquals( "fact0",
                      ap.getBoundName() );

        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

            } else {
                /*
                     * if the call method is applied on a bound variable created in the rhs
                 */
                final ActionInsertFact patternRhs = mod.getModel().getRHSBoundFact( actionCallMethod.getVariable() );
                if ( patternRhs != null ) {
                    oracle.getMethodInfos( patternRhs.getFactType(),
                                           new Callback<List<MethodInfo>>() {
                                               @Override
                                               public void callback( final List<MethodInfo> methodInfos ) {
                                                   ActionCallMethodWidget.this.fieldCompletionTexts = new String[ methodInfos.size() ];
                                                   ActionCallMethodWidget.this.fieldCompletionValues = new String[ methodInfos.size() ];
                                                   int i = 0;
                                                   for ( MethodInfo methodInfo : methodInfos ) {
                                                       ActionCallMethodWidget.this.fieldCompletionTexts[ i ] = methodInfo.getName();
                                                       ActionCallMethodWidget.this.fieldCompletionValues[ i ] = methodInfo.getNameWithParameters();
                                                       i++;
                                                   }
                                                   ActionCallMethodWidget.this.variableClass = patternRhs.getFactType();
                                                   ActionCallMethodWidget.this.isBoundFact = true;
                                               }
                                           } );
                } else {
                    this.readOnly = true;
View Full Code Here

                             "INS" + item );
            cmds.put( "INS" + item,
                      new Command() {

                          public void execute() {
                              model.addRhsItem( new ActionInsertFact( item ),
                                                Integer.parseInt( positionCbo.getValue( positionCbo.getSelectedIndex() ) ) );
                              hide();
                          }
                      } );
        }
View Full Code Here

TOP

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

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.