Package org.drools.ide.common.client.modeldriven.brl

Examples of org.drools.ide.common.client.modeldriven.brl.ActionFieldValue


        dt.getActionCols().add( ins );

        BRLActionColumn brlAction = new BRLActionColumn();
        ActionInsertFact aif = new ActionInsertFact( "Person" );
        aif.setBoundName( "$aif" );
        aif.addFieldValue( new ActionFieldValue( "rating",
                                                 null,
                                                 SuggestionCompletionEngine.TYPE_STRING ) );
        aif.fieldValues[0].nature = BaseSingleFieldConstraint.TYPE_LITERAL;

        brlAction.getDefinition().add( aif );
View Full Code Here


        dt.getActionCols().add( ins2 );

        BRLActionColumn brlAction = new BRLActionColumn();
        ActionInsertFact aif = new ActionInsertFact( "Person" );
        aif.setBoundName( "$aif" );
        aif.addFieldValue( new ActionFieldValue( "rating",
                                                 null,
                                                 SuggestionCompletionEngine.TYPE_STRING ) );
        aif.fieldValues[0].nature = BaseSingleFieldConstraint.TYPE_LITERAL;

        brlAction.getDefinition().add( aif );
View Full Code Here

                      result[0] );
        assertEquals( "colour",
                      result[1] );

        ActionFieldValue[] vals = new ActionFieldValue[2];
        vals[0] = new ActionFieldValue( "type",
                                        "sex",
                                        "blah" );
        vals[1] = new ActionFieldValue( "value",
                                        null,
                                        "blah" );
        result = sce.getEnums( "Fact",
                "value", vals
        ).fixedList;
View Full Code Here

        assertEquals( "f2=f2val",
                      dd.valuePairs[1] );

        //and now for the RHS
        ActionFieldValue[] vals = new ActionFieldValue[2];
        vals[0] = new ActionFieldValue( "f1",
                                        "f1val",
                                        "blah" );
        vals[1] = new ActionFieldValue( "f2",
                                        "f2val",
                                        "blah" );
        dd = sce.getEnums( "Fact",
                "value", vals
        );
View Full Code Here

        assertEquals( "f2=f2val",
                      dd.valuePairs[1] );

        //and now for the RHS
        ActionFieldValue[] vals = new ActionFieldValue[2];
        vals[0] = new ActionFieldValue( "f1",
                                        "f1val",
                                        "blah" );
        vals[1] = new ActionFieldValue( "f2",
                                        "f2val",
                                        "blah" );
        dd = sce.getEnums( "Fact",
                "value", vals
        );
View Full Code Here

        RuleModel model = new RuleModel();

        model.rhs = new IAction[2];
        ActionInsertFact aif0 = new ActionInsertFact( "AIF0" );
        aif0.setBoundName( "$t0" );
        ActionFieldValue aif0f0 = new ActionFieldValue( "AIF0F0",
                                                        "AIF0F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif0.addFieldValue( aif0f0 );
        ActionFieldValue aif0f1 = new ActionFieldValue( "AIF0F1",
                                                        "AIF0F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif0.addFieldValue( aif0f1 );
        model.rhs[0] = aif0;

        ActionInsertFact aif1 = new ActionInsertFact( "AIF1" );
        aif1.setBoundName( "$t1" );
        ActionFieldValue aif1f0 = new ActionFieldValue( "AIF1F0",
                                                        "AIF1F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif1f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif1.addFieldValue( aif1f0 );
        ActionFieldValue aif1f1 = new ActionFieldValue( "AIF1F1",
                                                        "AIF1F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        aif1f1.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        aif1.addFieldValue( aif1f1 );
        model.rhs[1] = aif1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
                       clone.rhs[0] );
        assertNotNull( clone.rhs[0] );
        assertTrue( clone.rhs[0] instanceof ActionInsertFact );
        ActionInsertFact aif0Clone = (ActionInsertFact) clone.rhs[0];
        assertEquals( "AIF0",
                      aif0Clone.factType );
        assertEquals( "$t0",
                      aif0Clone.getBoundName() );
        assertEquals( 2,
                      aif0Clone.fieldValues.length );

        assertNotSame( aif0.fieldValues[0],
                       aif0Clone.fieldValues[0] );
        assertNotNull( aif0Clone.fieldValues[0] );
        assertTrue( aif0Clone.fieldValues[0] instanceof ActionFieldValue );
        ActionFieldValue aif0f0Clone = (ActionFieldValue) aif0Clone.fieldValues[0];
        assertEquals( aif0f0.field,
                      aif0f0Clone.field );
        assertEquals( aif0f0.nature,
                      aif0f0Clone.nature );
        assertEquals( aif0f0.type,
                      aif0f0Clone.type );
        assertEquals( aif0f0.value,
                      aif0f0Clone.value );

        assertNotSame( aif0.fieldValues[1],
                       aif0Clone.fieldValues[1] );
        assertNotNull( aif0Clone.fieldValues[1] );
        assertTrue( aif0Clone.fieldValues[1] instanceof ActionFieldValue );
        ActionFieldValue aif0f1Clone = (ActionFieldValue) aif0Clone.fieldValues[1];
        assertEquals( aif0f1.field,
                      aif0f1Clone.field );
        assertEquals( aif0f1.nature,
                      aif0f1Clone.nature );
        assertEquals( aif0f1.type,
                      aif0f1Clone.type );
        assertEquals( aif0f1.value,
                      aif0f1Clone.value );

        assertNotSame( model.rhs[1],
                       clone.rhs[1] );
        assertNotNull( clone.rhs[1] );
        assertTrue( clone.rhs[1] instanceof ActionInsertFact );
        ActionInsertFact aif1Clone = (ActionInsertFact) clone.rhs[1];
        assertEquals( "AIF1",
                      aif1Clone.factType );
        assertEquals( "$t1",
                      aif1Clone.getBoundName() );
        assertEquals( 2,
                      aif1Clone.fieldValues.length );

        assertNotSame( aif1.fieldValues[0],
                       aif1Clone.fieldValues[0] );
        assertNotNull( aif1Clone.fieldValues[0] );
        assertTrue( aif1Clone.fieldValues[0] instanceof ActionFieldValue );
        ActionFieldValue aif1f0Clone = (ActionFieldValue) aif1Clone.fieldValues[0];
        assertEquals( aif1f0.field,
                      aif1f0Clone.field );
        assertEquals( aif1f0.nature,
                      aif1f0Clone.nature );
        assertEquals( aif1f0.type,
                      aif1f0Clone.type );
        assertEquals( aif1f0.value,
                      aif1f0Clone.value );

        assertNotSame( aif1.fieldValues[1],
                       aif1Clone.fieldValues[1] );
        assertNotNull( aif1Clone.fieldValues[1] );
        assertTrue( aif1Clone.fieldValues[1] instanceof ActionFieldValue );
        ActionFieldValue aif1f1Clone = (ActionFieldValue) aif1Clone.fieldValues[1];
        assertEquals( aif1f1.field,
                      aif1f1Clone.field );
        assertEquals( aif1f1.nature,
                      aif1f1Clone.nature );
        assertEquals( aif1f1.type,
View Full Code Here

        RuleModel model = new RuleModel();

        model.rhs = new IAction[2];
        ActionSetField asf0 = new ActionSetField( "ASF0" );
        asf0.variable = "$t0";
        ActionFieldValue asf0f0 = new ActionFieldValue( "ASF0F0",
                                                        "ASF0F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf0.addFieldValue( asf0f0 );
        ActionFieldValue asf0f1 = new ActionFieldValue( "ASF0F1",
                                                        "ASF0F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf0.addFieldValue( asf0f1 );
        model.rhs[0] = asf0;

        ActionSetField asf1 = new ActionSetField( "ASF1" );
        asf1.variable = "$t1";
        ActionFieldValue asf1f0 = new ActionFieldValue( "ASF1F0",
                                                        "ASF1F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf1f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf1.addFieldValue( asf1f0 );
        ActionFieldValue asf1f1 = new ActionFieldValue( "ASF1F1",
                                                        "ASF1F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        asf1f1.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        asf1.addFieldValue( asf1f1 );
        model.rhs[1] = asf1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
                       clone.rhs[0] );
        assertNotNull( clone.rhs[0] );
        assertTrue( clone.rhs[0] instanceof ActionSetField );
        ActionSetField asf0Clone = (ActionSetField) clone.rhs[0];
        assertEquals( "$t0",
                      asf0Clone.variable );
        assertEquals( 2,
                      asf0Clone.fieldValues.length );

        assertNotSame( asf0.fieldValues[0],
                       asf0Clone.fieldValues[0] );
        assertNotNull( asf0Clone.fieldValues[0] );
        assertTrue( asf0Clone.fieldValues[0] instanceof ActionFieldValue );
        ActionFieldValue asf0f0Clone = (ActionFieldValue) asf0Clone.fieldValues[0];
        assertEquals( asf0f0.field,
                      asf0f0Clone.field );
        assertEquals( asf0f0.nature,
                      asf0f0Clone.nature );
        assertEquals( asf0f0.type,
                      asf0f0Clone.type );
        assertEquals( asf0f0.value,
                      asf0f0Clone.value );

        assertNotSame( asf0.fieldValues[1],
                       asf0Clone.fieldValues[1] );
        assertNotNull( asf0Clone.fieldValues[1] );
        assertTrue( asf0Clone.fieldValues[1] instanceof ActionFieldValue );
        ActionFieldValue asf0f1Clone = (ActionFieldValue) asf0Clone.fieldValues[1];
        assertEquals( asf0f1.field,
                      asf0f1Clone.field );
        assertEquals( asf0f1.nature,
                      asf0f1Clone.nature );
        assertEquals( asf0f1.type,
                      asf0f1Clone.type );
        assertEquals( asf0f1.value,
                      asf0f1Clone.value );

        assertNotSame( model.rhs[1],
                       clone.rhs[1] );
        assertNotNull( clone.rhs[1] );
        assertTrue( clone.rhs[1] instanceof ActionSetField );
        ActionSetField asf1Clone = (ActionSetField) clone.rhs[1];
        assertEquals( "$t1",
                      asf1Clone.variable );
        assertEquals( 2,
                      asf1Clone.fieldValues.length );

        assertNotSame( asf1.fieldValues[0],
                       asf1Clone.fieldValues[0] );
        assertNotNull( asf1Clone.fieldValues[0] );
        assertTrue( asf1Clone.fieldValues[0] instanceof ActionFieldValue );
        ActionFieldValue asf1f0Clone = (ActionFieldValue) asf1Clone.fieldValues[0];
        assertEquals( asf1f0.field,
                      asf1f0Clone.field );
        assertEquals( asf1f0.nature,
                      asf1f0Clone.nature );
        assertEquals( asf1f0.type,
                      asf1f0Clone.type );
        assertEquals( asf1f0.value,
                      asf1f0Clone.value );

        assertNotSame( asf1.fieldValues[1],
                       asf1Clone.fieldValues[1] );
        assertNotNull( asf1Clone.fieldValues[1] );
        assertTrue( asf1Clone.fieldValues[1] instanceof ActionFieldValue );
        ActionFieldValue asf1f1Clone = (ActionFieldValue) asf1Clone.fieldValues[1];
        assertEquals( asf1f1.field,
                      asf1f1Clone.field );
        assertEquals( asf1f1.nature,
                      asf1f1Clone.nature );
        assertEquals( asf1f1.type,
View Full Code Here

        RuleModel model = new RuleModel();

        model.rhs = new IAction[2];
        ActionUpdateField auf0 = new ActionUpdateField();
        auf0.variable = "$t0";
        ActionFieldValue auf0f0 = new ActionFieldValue( "AUF0F0",
                                                        "AUF0F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf0.addFieldValue( auf0f0 );
        ActionFieldValue auf0f1 = new ActionFieldValue( "AUF0F1",
                                                        "AUF0F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf0f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf0.addFieldValue( auf0f1 );
        model.rhs[0] = auf0;

        ActionUpdateField auf1 = new ActionUpdateField();
        auf1.variable = "$t1";
        ActionFieldValue auf1f0 = new ActionFieldValue( "AUF1F0",
                                                        "AUF1F0Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf1f0.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf1.addFieldValue( auf1f0 );
        ActionFieldValue auf1f1 = new ActionFieldValue( "AUF1F1",
                                                        "AUF1F1Value",
                                                        SuggestionCompletionEngine.TYPE_STRING );
        auf1f1.setNature( BaseSingleFieldConstraint.TYPE_LITERAL );
        auf1.addFieldValue( auf1f1 );
        model.rhs[1] = auf1;

        RuleModelCloneVisitor cloneVisitor = new RuleModelCloneVisitor();
        RuleModel clone = cloneVisitor.visitRuleModel( model );

        assertEquals( 2,
                      clone.rhs.length );

        assertNotSame( model.rhs[0],
                       clone.rhs[0] );
        assertNotNull( clone.rhs[0] );
        assertTrue( clone.rhs[0] instanceof ActionUpdateField );
        ActionUpdateField auf0Clone = (ActionUpdateField) clone.rhs[0];
        assertEquals( "$t0",
                      auf0Clone.variable );
        assertEquals( 2,
                      auf0Clone.fieldValues.length );

        assertNotSame( auf0.fieldValues[0],
                       auf0Clone.fieldValues[0] );
        assertNotNull( auf0Clone.fieldValues[0] );
        assertTrue( auf0Clone.fieldValues[0] instanceof ActionFieldValue );
        ActionFieldValue auf0f0Clone = (ActionFieldValue) auf0Clone.fieldValues[0];
        assertEquals( auf0f0.field,
                      auf0f0Clone.field );
        assertEquals( auf0f0.nature,
                      auf0f0Clone.nature );
        assertEquals( auf0f0.type,
                      auf0f0Clone.type );
        assertEquals( auf0f0.value,
                      auf0f0Clone.value );

        assertNotSame( auf0.fieldValues[1],
                       auf0Clone.fieldValues[1] );
        assertNotNull( auf0Clone.fieldValues[1] );
        assertTrue( auf0Clone.fieldValues[1] instanceof ActionFieldValue );
        ActionFieldValue auf0f1Clone = (ActionFieldValue) auf0Clone.fieldValues[1];
        assertEquals( auf0f1.field,
                      auf0f1Clone.field );
        assertEquals( auf0f1.nature,
                      auf0f1Clone.nature );
        assertEquals( auf0f1.type,
                      auf0f1Clone.type );
        assertEquals( auf0f1.value,
                      auf0f1Clone.value );

        assertNotSame( model.rhs[1],
                       clone.rhs[1] );
        assertNotNull( clone.rhs[1] );
        assertTrue( clone.rhs[1] instanceof ActionUpdateField );
        ActionUpdateField auf1Clone = (ActionUpdateField) clone.rhs[1];
        assertEquals( "$t1",
                      auf1Clone.variable );
        assertEquals( 2,
                      auf1Clone.fieldValues.length );

        assertNotSame( auf1.fieldValues[0],
                       auf1Clone.fieldValues[0] );
        assertNotNull( auf1Clone.fieldValues[0] );
        assertTrue( auf1Clone.fieldValues[0] instanceof ActionFieldValue );
        ActionFieldValue auf1f0Clone = (ActionFieldValue) auf1Clone.fieldValues[0];
        assertEquals( auf1f0.field,
                      auf1f0Clone.field );
        assertEquals( auf1f0.nature,
                      auf1f0Clone.nature );
        assertEquals( auf1f0.type,
                      auf1f0Clone.type );
        assertEquals( auf1f0.value,
                      auf1f0Clone.value );

        assertNotSame( auf1.fieldValues[1],
                       auf1Clone.fieldValues[1] );
        assertNotNull( auf1Clone.fieldValues[1] );
        assertTrue( auf1Clone.fieldValues[1] instanceof ActionFieldValue );
        ActionFieldValue auf1f1Clone = (ActionFieldValue) auf1Clone.fieldValues[1];
        assertEquals( auf1f1.field,
                      auf1f1Clone.field );
        assertEquals( auf1f1.nature,
                      auf1f1Clone.nature );
        assertEquals( auf1f1.type,
View Full Code Here

        assertEquals( asf.variable,
                      "$r" );
        assertEquals( 4,
                      asf.fieldValues.length );

        ActionFieldValue fv1 = asf.fieldValues[0];
        assertNotNull( fv1 );
        assertTrue( fv1 instanceof ActionWorkItemFieldValue );
        ActionWorkItemFieldValue wifv1 = (ActionWorkItemFieldValue) fv1;
        assertEquals( "ResultBooleanField",
                      wifv1.field );
        assertEquals( SuggestionCompletionEngine.TYPE_BOOLEAN,
                      wifv1.type );
        assertEquals( "WorkItem",
                      wifv1.getWorkItemName() );
        assertEquals( "BooleanResult",
                      wifv1.getWorkItemParameterName() );
        assertEquals( Boolean.class.getName(),
                      wifv1.getWorkItemParameterClassName() );

        ActionFieldValue fv2 = asf.fieldValues[1];
        assertNotNull( fv2 );
        assertTrue( fv2 instanceof ActionWorkItemFieldValue );
        ActionWorkItemFieldValue wifv2 = (ActionWorkItemFieldValue) fv2;
        assertEquals( "ResultFloatField",
                      wifv2.field );
        assertEquals( SuggestionCompletionEngine.TYPE_NUMERIC,
                      wifv2.type );
        assertEquals( "WorkItem",
                      wifv2.getWorkItemName() );
        assertEquals( "FloatResult",
                      wifv2.getWorkItemParameterName() );
        assertEquals( Float.class.getName(),
                      wifv2.getWorkItemParameterClassName() );

        ActionFieldValue fv3 = asf.fieldValues[2];
        assertNotNull( fv3 );
        assertTrue( fv3 instanceof ActionWorkItemFieldValue );
        ActionWorkItemFieldValue wifv3 = (ActionWorkItemFieldValue) fv3;
        assertEquals( "ResultIntegerField",
                      wifv3.field );
        assertEquals( SuggestionCompletionEngine.TYPE_NUMERIC,
                      wifv3.type );
        assertEquals( "WorkItem",
                      wifv3.getWorkItemName() );
        assertEquals( "IntegerResult",
                      wifv3.getWorkItemParameterName() );
        assertEquals( Integer.class.getName(),
                      wifv3.getWorkItemParameterClassName() );

        ActionFieldValue fv4 = asf.fieldValues[3];
        assertNotNull( fv4 );
        assertTrue( fv4 instanceof ActionWorkItemFieldValue );
        ActionWorkItemFieldValue wifv4 = (ActionWorkItemFieldValue) fv4;
        assertEquals( "ResultStringField",
                      wifv4.field );
View Full Code Here

        assertEquals( asf.variable,
                      "$r" );
        assertEquals( 1,
                      asf.fieldValues.length );

        ActionFieldValue fv1 = asf.fieldValues[0];
        assertNotNull( fv1 );
        assertTrue( fv1 instanceof ActionWorkItemFieldValue );
        ActionWorkItemFieldValue wifv1 = (ActionWorkItemFieldValue) fv1;
        assertEquals( "ResultBooleanField",
                      wifv1.field );
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.brl.ActionFieldValue

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.