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

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


    private Widget literalEditor() {

        //Custom screen
        if ( this.constraint instanceof SingleFieldConstraint ) {
            final SingleFieldConstraint con = (SingleFieldConstraint) this.constraint;
            CustomFormConfiguration customFormConfiguration = WorkingSetManager.getInstance().getCustomFormConfiguration( modeller.getAsset().getMetaData().getPackageName(),
                                                                                                                          pattern.getFactType(),
                                                                                                                          fieldName );
            if ( customFormConfiguration != null ) {
                Button btnCustom = new Button( con.getValue(),
                                               new ClickHandler() {

                                                   public void onClick(ClickEvent event) {
                                                       showTypeChoice( (Widget) event.getSource(),
                                                                       constraint );
View Full Code Here


            }
            final CustomFormPopUp customFormPopUp = new CustomFormPopUp( images.newexWiz(),
                                                                         constants.FieldValue(),
                                                                         customFormConfiguration );

            final SingleFieldConstraint sfc = (SingleFieldConstraint) con;

            customFormPopUp.addOkButtonHandler( new ClickHandler() {

                public void onClick(ClickEvent event) {
                    sfc.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
                    sfc.setId( customFormPopUp.getFormId() );
                    sfc.setValue( customFormPopUp.getFormValue() );
                    doTypeChosen( customFormPopUp );
                }
            } );

            customFormPopUp.show( sfc.getId(),
                                  sfc.getValue() );
            return;
        }

        final FormStylePopup form = new FormStylePopup( images.newexWiz(),
                                                        constants.FieldValue() );

        Button lit = new Button( constants.LiteralValue() );
        lit.addClickHandler( new ClickHandler() {
            public void onClick(ClickEvent event) {
                con.setConstraintValueType( isDropDownDataEnum && dropDownData != null ? SingleFieldConstraint.TYPE_ENUM : SingleFieldConstraint.TYPE_LITERAL );
                doTypeChosen( form );
            }
        } );

        boolean showLiteralOrFormula = true;
        if ( con instanceof SingleFieldConstraint ) {
            SingleFieldConstraint sfc = (SingleFieldConstraint) con;
            if ( sfc.getFieldType().equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
                showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( sfc.getOperator() );
            }
        } else if ( con instanceof ConnectiveConstraint ) {
            ConnectiveConstraint cc = (ConnectiveConstraint) con;
            if ( cc.getFieldType().equals( SuggestionCompletionEngine.TYPE_THIS ) ) {
                showLiteralOrFormula = SuggestionCompletionEngine.isCEPOperator( cc.getOperator() );
View Full Code Here

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        ExpressionFormLine efl0 = new ExpressionFormLine();
        efl0.setBinding( "$efl0" );
        ExpressionText efl0p0 = new ExpressionText( "efl0p0" );
        efl0.appendPart( efl0p0 );
        sfc0.setExpressionValue( efl0 );
        fp0.addConstraint( sfc0 );

        model.lhs[0] = fp0;

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

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
        assertNotNull( clone.lhs[0] );
        assertTrue( clone.lhs[0] instanceof FactPattern );
        FactPattern fp0Clone = (FactPattern) clone.lhs[0];
        assertEquals( fp0.getBoundName(),
                      fp0Clone.getBoundName() );
        assertEquals( fp0.getFactType(),
                      fp0Clone.getFactType() );

        assertEquals( 1,
                      fp0Clone.constraintList.constraints.length );

        assertNotSame( fp0.constraintList.constraints[0],
                       fp0Clone.constraintList.constraints[0] );
        assertNotNull( fp0Clone.constraintList.constraints[0] );
        assertTrue( fp0Clone.constraintList.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc0Clone = (SingleFieldConstraint) fp0Clone.constraintList.constraints[0];

        assertNotSame( sfc0.getExpressionValue(),
                       sfc0Clone.getExpressionValue() );
        assertNotNull( sfc0Clone.getExpressionValue() );
        assertTrue( sfc0Clone.getExpressionValue() instanceof ExpressionFormLine );
        ExpressionFormLine efl0Clone = (ExpressionFormLine) sfc0Clone.getExpressionValue();

        assertEquals( 1,
                      sfc0Clone.getExpressionValue().getParts().size() );
        assertTrue( sfc0Clone.getExpressionValue().getParts().get( 0 ) instanceof ExpressionText );
        ExpressionText efl0p0Clone = (ExpressionText) sfc0Clone.getExpressionValue().getParts().get( 0 );
        assertEquals( efl0p0.getClassType(),
                      efl0p0Clone.getClassType() );
        assertEquals( efl0p0.getName(),
                      efl0p0Clone.getName() );
        assertEquals( efl0p0.getGenericType(),
View Full Code Here

        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );
        fp0.setNegated( true );

        SingleFieldConstraint fp0sfc0 = new SingleFieldConstraint();
        fp0sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        fp0sfc0.setFieldBinding( "$fp0sfc0" );
        fp0sfc0.setFieldName( "fp0sfc0" );
        fp0sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        fp0sfc0.setOperator( "==" );
        fp0sfc0.setParameter( "fp0sfc0p0",
                              "fp0sfc0p0Value" );
        fp0sfc0.setValue( "fp0sfc0Value" );
        fp0.addConstraint( fp0sfc0 );

        FactPattern fp1 = new FactPattern();
        fp1.setBoundName( "$t1" );
        fp1.setFactType( "FT1" );
        fp1.setNegated( true );

        SingleFieldConstraint fp1sfc0 = new SingleFieldConstraint();
        fp1sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        fp1sfc0.setFieldBinding( "$fp1sfc0" );
        fp1sfc0.setFieldName( "fp1sfc0" );
        fp1sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        fp1sfc0.setOperator( "==" );
        fp1sfc0.setParameter( "fp1sfc0p0",
                              "fp1sfc0p0Value" );
        fp1sfc0.setValue( "fp1sfc0Value" );
        fp1.addConstraint( fp1sfc0 );

        cfp0.addFactPattern( fp0 );
        cfp0.addFactPattern( fp1 );

        model.lhs[0] = cfp0;

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

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
        assertNotNull( clone.lhs[0] );
        assertTrue( clone.lhs[0] instanceof CompositeFactPattern );
        CompositeFactPattern cfp0Clone = (CompositeFactPattern) clone.lhs[0];
        assertEquals( cfp0.type,
                      cfp0Clone.type );
        assertEquals( cfp0.getPatterns().length,
                      cfp0Clone.getPatterns().length );

        assertNotSame( cfp0.getPatterns()[0],
                       cfp0Clone.getPatterns()[0] );
        assertNotNull( cfp0Clone.getPatterns()[0] );
        assertTrue( cfp0Clone.getPatterns()[0] instanceof FactPattern );
        FactPattern fp0Clone = (FactPattern) cfp0Clone.getPatterns()[0];
        assertEquals( fp0.getBoundName(),
                      fp0Clone.getBoundName() );
        assertEquals( fp0.getFactType(),
                      fp0Clone.getFactType() );

        assertEquals( fp0.constraintList.constraints.length,
                      fp0Clone.constraintList.constraints.length );
        assertNotSame( fp0.constraintList.constraints[0],
                       fp0Clone.constraintList.constraints[0] );
        assertNotNull( fp0Clone.constraintList.constraints[0] );
        assertTrue( fp0Clone.constraintList.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint fp0sfc0Clone = (SingleFieldConstraint) fp0Clone.constraintList.constraints[0];
        assertEquals( fp0sfc0.getFieldBinding(),
                      fp0sfc0Clone.getFieldBinding() );
        assertEquals( fp0sfc0.getFieldName(),
                      fp0sfc0Clone.getFieldName() );
        assertEquals( fp0sfc0.getFieldType(),
                      fp0sfc0Clone.getFieldType() );
        assertEquals( fp0sfc0.getOperator(),
                      fp0sfc0Clone.getOperator() );
        assertNotNull( fp0sfc0Clone.getParameter( "fp0sfc0p0" ) );
        assertEquals( fp0sfc0.getParameter( "fp0sfc0p0" ),
                      fp0sfc0Clone.getParameter( "fp0sfc0p0" ) );
        assertEquals( fp0sfc0.getValue(),
                      fp0sfc0Clone.getValue() );

        assertNotSame( cfp0.getPatterns()[1],
                       cfp0Clone.getPatterns()[1] );
        assertNotNull( cfp0Clone.getPatterns()[1] );
        assertTrue( cfp0Clone.getPatterns()[1] instanceof FactPattern );
        FactPattern fp1Clone = (FactPattern) cfp0Clone.getPatterns()[1];
        assertEquals( fp1.getBoundName(),
                      fp1Clone.getBoundName() );
        assertEquals( fp1.getFactType(),
                      fp1Clone.getFactType() );

        assertEquals( fp1.constraintList.constraints.length,
                      fp1Clone.constraintList.constraints.length );
        assertNotSame( fp1.constraintList.constraints[0],
                       fp1Clone.constraintList.constraints[0] );
        assertNotNull( fp1Clone.constraintList.constraints[0] );
        assertTrue( fp1Clone.constraintList.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint fp1sfc0Clone = (SingleFieldConstraint) fp1Clone.constraintList.constraints[0];
        assertEquals( fp1sfc0.getFieldBinding(),
                      fp1sfc0Clone.getFieldBinding() );
        assertEquals( fp1sfc0.getFieldName(),
                      fp1sfc0Clone.getFieldName() );
        assertEquals( fp1sfc0.getFieldType(),
                      fp1sfc0Clone.getFieldType() );
        assertEquals( fp1sfc0.getOperator(),
                      fp1sfc0Clone.getOperator() );
        assertNotNull( fp1sfc0Clone.getParameter( "fp1sfc0p0" ) );
        assertEquals( fp1sfc0.getParameter( "fp1sfc0p0" ),
                      fp1sfc0Clone.getParameter( "fp1sfc0p0" ) );
        assertEquals( fp1sfc0.getValue(),
                      fp1sfc0Clone.getValue() );
    }
View Full Code Here

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0.setFieldBinding( "$sfc0" );
        sfc0.setFieldName( "sfc0" );
        sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0.setOperator( "==" );
        sfc0.setParameter( "sfc0p0",
                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        fp0.addConstraint( sfc0 );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setFieldName( "sfc1" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc1.setOperator( "==" );
        sfc1.setParameter( "sfc1p0",
                           "sfc1p0Value" );
        sfc1.setValue( "sfc1Value" );
        fp0.addConstraint( sfc1 );

        model.lhs[0] = fp0;

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

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
        assertNotNull( clone.lhs[0] );
        assertTrue( clone.lhs[0] instanceof FactPattern );
        FactPattern fp0Clone = (FactPattern) clone.lhs[0];
        assertEquals( fp0.getBoundName(),
                      fp0Clone.getBoundName() );
        assertEquals( fp0.getFactType(),
                      fp0Clone.getFactType() );

        assertEquals( 2,
                      fp0Clone.constraintList.constraints.length );

        assertNotSame( fp0.constraintList.constraints[0],
                       fp0Clone.constraintList.constraints[0] );
        assertNotNull( fp0Clone.constraintList.constraints[0] );
        assertTrue( fp0Clone.constraintList.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc0Clone = (SingleFieldConstraint) fp0Clone.constraintList.constraints[0];
        assertEquals( sfc0.getConstraintValueType(),
                      sfc0Clone.getConstraintValueType() );
        assertEquals( sfc0.getFieldBinding(),
                      sfc0Clone.getFieldBinding() );
        assertEquals( sfc0.getFieldName(),
                      sfc0Clone.getFieldName() );
        assertEquals( sfc0.getFieldType(),
                      sfc0Clone.getFieldType() );
        assertEquals( sfc0.getOperator(),
                      sfc0Clone.getOperator() );
        assertNotNull( sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getParameter( "sfc0p0" ),
                      sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getValue(),
                      sfc0Clone.getValue() );

        assertNotSame( fp0.constraintList.constraints[1],
                       fp0Clone.constraintList.constraints[1] );
        assertNotNull( fp0Clone.constraintList.constraints[1] );
        assertTrue( fp0Clone.constraintList.constraints[1] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc1Clone = (SingleFieldConstraint) fp0Clone.constraintList.constraints[1];
        assertEquals( sfc1.getConstraintValueType(),
                      sfc1Clone.getConstraintValueType() );
        assertEquals( sfc1.getFieldBinding(),
                      sfc1Clone.getFieldBinding() );
        assertEquals( sfc1.getFieldName(),
                      sfc1Clone.getFieldName() );
        assertEquals( sfc1.getFieldType(),
                      sfc1Clone.getFieldType() );
        assertEquals( sfc1.getOperator(),
                      sfc1Clone.getOperator() );
        assertNotNull( sfc1Clone.getParameter( "sfc1p0" ) );
        assertEquals( sfc1.getParameter( "sfc1p0" ),
                      sfc1Clone.getParameter( "sfc1p0" ) );
        assertEquals( sfc1.getValue(),
                      sfc1Clone.getValue() );
    }
View Full Code Here

        model.lhs = new IPattern[1];
        FactPattern fp0 = new FactPattern();
        fp0.setBoundName( "$t0" );
        fp0.setFactType( "FT0" );

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0.setFieldBinding( "$sfc0" );
        sfc0.setFieldName( "sfc0" );
        sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0.setOperator( "==" );
        sfc0.setParameter( "sfc0p0",
                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        fp0.addConstraint( sfc0 );

        sfc0.addNewConnective();
        ConnectiveConstraint sfc0cc0 = sfc0.connectives[0];
        sfc0cc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0cc0.setFieldName( "sfc0" );
        sfc0cc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0cc0.setOperator( "|| ==" );
        sfc0cc0.setParameter( "sfc0cc0p0",
                              "sfc0cc0p0Value" );
        sfc0cc0.setValue( "sfc0cc0Value" );

        model.lhs[0] = fp0;

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

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
        assertNotNull( clone.lhs[0] );
        assertTrue( clone.lhs[0] instanceof FactPattern );
        FactPattern fp0Clone = (FactPattern) clone.lhs[0];
        assertEquals( fp0.getBoundName(),
                      fp0Clone.getBoundName() );
        assertEquals( fp0.getFactType(),
                      fp0Clone.getFactType() );

        assertEquals( 1,
                      fp0Clone.constraintList.constraints.length );

        assertNotSame( fp0.constraintList.constraints[0],
                       fp0Clone.constraintList.constraints[0] );
        assertNotNull( fp0Clone.constraintList.constraints[0] );
        assertTrue( fp0Clone.constraintList.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc0Clone = (SingleFieldConstraint) fp0Clone.constraintList.constraints[0];
        assertEquals( sfc0.getConstraintValueType(),
                      sfc0Clone.getConstraintValueType() );
        assertEquals( sfc0.getFieldBinding(),
                      sfc0Clone.getFieldBinding() );
        assertEquals( sfc0.getFieldName(),
                      sfc0Clone.getFieldName() );
        assertEquals( sfc0.getFieldType(),
                      sfc0Clone.getFieldType() );
        assertEquals( sfc0.getOperator(),
                      sfc0Clone.getOperator() );
        assertNotNull( sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getParameter( "sfc0p0" ),
                      sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getValue(),
                      sfc0Clone.getValue() );

        assertEquals( sfc0.connectives.length,
                      sfc0Clone.connectives.length );
        assertNotSame( sfc0.connectives[0],
                       sfc0Clone.connectives[0] );
View Full Code Here

        fp0.setFactType( "FT0" );

        CompositeFieldConstraint cfc0 = new CompositeFieldConstraint();
        cfc0.compositeJunctionType = CompositeFieldConstraint.COMPOSITE_TYPE_OR;

        SingleFieldConstraint sfc0 = new SingleFieldConstraint();
        sfc0.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc0.setFieldBinding( "$sfc0" );
        sfc0.setFieldName( "sfc0" );
        sfc0.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc0.setOperator( "==" );
        sfc0.setParameter( "sfc0p0",
                           "sfc0p0Value" );
        sfc0.setValue( "sfc0Value" );
        cfc0.addConstraint( sfc0 );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setFieldName( "sfc1" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        sfc1.setOperator( "==" );
        sfc1.setParameter( "sfc1p0",
                           "sfc1p0Value" );
        sfc1.setValue( "sfc1Value" );
        cfc0.addConstraint( sfc1 );

        fp0.addConstraint( cfc0 );

        model.lhs[0] = fp0;

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

        assertEquals( 1,
                      clone.lhs.length );
        assertNotSame( model.lhs[0],
                       clone.lhs[0] );
        assertNotNull( clone.lhs[0] );
        assertTrue( clone.lhs[0] instanceof FactPattern );
        FactPattern fp0Clone = (FactPattern) clone.lhs[0];
        assertEquals( fp0.getBoundName(),
                      fp0Clone.getBoundName() );
        assertEquals( fp0.getFactType(),
                      fp0Clone.getFactType() );

        assertEquals( 1,
                      fp0Clone.constraintList.constraints.length );

        assertNotSame( fp0.constraintList.constraints[0],
                       fp0Clone.constraintList.constraints[0] );
        assertNotNull( fp0Clone.constraintList.constraints[0] );
        assertTrue( fp0Clone.constraintList.constraints[0] instanceof CompositeFieldConstraint );
        CompositeFieldConstraint cfc0Clone = (CompositeFieldConstraint) fp0Clone.constraintList.constraints[0];
        assertEquals( cfc0.compositeJunctionType,
                      cfc0Clone.compositeJunctionType );

        assertNotSame( cfc0.constraints[0],
                       cfc0Clone.constraints[0] );
        assertNotNull( cfc0Clone.constraints[0] );
        assertTrue( cfc0Clone.constraints[0] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc0Clone = (SingleFieldConstraint) cfc0Clone.constraints[0];
        assertEquals( sfc0.getFieldBinding(),
                      sfc0Clone.getFieldBinding() );
        assertEquals( sfc0.getFieldName(),
                      sfc0Clone.getFieldName() );
        assertEquals( sfc0.getFieldType(),
                      sfc0Clone.getFieldType() );
        assertEquals( sfc0.getOperator(),
                      sfc0Clone.getOperator() );
        assertNotNull( sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getParameter( "sfc0p0" ),
                      sfc0Clone.getParameter( "sfc0p0" ) );
        assertEquals( sfc0.getValue(),
                      sfc0Clone.getValue() );

        assertNotSame( cfc0.constraints[1],
                       cfc0Clone.constraints[1] );
        assertNotNull( cfc0Clone.constraints[1] );
        assertTrue( cfc0Clone.constraints[1] instanceof SingleFieldConstraint );
        SingleFieldConstraint sfc1Clone = (SingleFieldConstraint) cfc0Clone.constraints[1];
        assertEquals( sfc1.getConstraintValueType(),
                      sfc1Clone.getConstraintValueType() );
        assertEquals( sfc1.getFieldBinding(),
                      sfc1Clone.getFieldBinding() );
        assertEquals( sfc1.getFieldName(),
                      sfc1Clone.getFieldName() );
        assertEquals( sfc1.getFieldType(),
                      sfc1Clone.getFieldType() );
        assertEquals( sfc1.getOperator(),
                      sfc1Clone.getOperator() );
        assertNotNull( sfc1Clone.getParameter( "sfc1p0" ) );
        assertEquals( sfc1.getParameter( "sfc1p0" ),
                      sfc1Clone.getParameter( "sfc1p0" ) );
        assertEquals( sfc1.getValue(),
                      sfc1Clone.getValue() );
    }
View Full Code Here

        BRLConditionColumn brlCondition = new BRLConditionColumn();
        FactPattern fp = new FactPattern( "Driver" );
        fp.setBoundName( "$brl1" );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setOperator( "==" );
        sfc1.setFieldName( "name" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );

        fp.addConstraint( sfc1 );
        brlCondition.getDefinition().add( fp );
        dt.getConditions().add( brlCondition );
View Full Code Here

        BRLConditionColumn brlCondition = new BRLConditionColumn();
        FactPattern fp = new FactPattern( "Driver" );
        fp.setBoundName( "$brl1" );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setOperator( "==" );
        sfc1.setFieldName( "name" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );

        fp.addConstraint( sfc1 );
        brlCondition.getDefinition().add( fp );
        dt.getConditions().add( brlCondition );
View Full Code Here

        BRLConditionColumn brlCondition = new BRLConditionColumn();
        FactPattern fp = new FactPattern( "Driver" );
        fp.setBoundName( "$brl1" );

        SingleFieldConstraint sfc1 = new SingleFieldConstraint();
        sfc1.setFieldBinding( "$sfc1" );
        sfc1.setOperator( "==" );
        sfc1.setFieldName( "name" );
        sfc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );

        fp.addConstraint( sfc1 );
        brlCondition.getDefinition().add( fp );
        dt.getConditions().add( brlCondition );

        ActionInsertFactCol52 ins = new ActionInsertFactCol52();
        ins.setBoundName( "$ins" );
        ins.setFactField( "rating" );
        ins.setFactType( "Person" );
        ins.setType( SuggestionCompletionEngine.TYPE_STRING );
        dt.getActionCols().add( ins );

        BRLRuleModel model = new BRLRuleModel( dt );

        FieldConstraint fcr1 = model.getLHSBoundField( "$sfc1" );
        assertNotNull( fcr1 );
        assertTrue( fcr1 instanceof SingleFieldConstraint );
        SingleFieldConstraint fcr1sfc = (SingleFieldConstraint) fcr1;
        assertEquals( "name",
                      fcr1sfc.getFieldName() );
        assertEquals( SuggestionCompletionEngine.TYPE_STRING,
                      fcr1sfc.getFieldType() );
    }
View Full Code Here

TOP

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

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.