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

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


     * @return a sorted list of constraints ready for display.
     */
    private List<FieldConstraint> sortConstraints( FieldConstraint[] constraints ) {
        List<FieldConstraint> sortedConst = new ArrayList<FieldConstraint>( constraints.length );
        for ( int i = 0; i < constraints.length; i++ ) {
            FieldConstraint current = constraints[ i ];
            if ( current instanceof SingleFieldConstraint ) {
                SingleFieldConstraint single = (SingleFieldConstraint) current;
                int index = sortedConst.indexOf( single.getParent() );
                if ( single.getParent() == null ) {
                    sortedConst.add( single );
View Full Code Here


                    bindings.add( v );
                }
            }

            //LHS FieldConstraint
            FieldConstraint fc = modeller.getModel().getLHSBoundField( v );
            if ( fc != null ) {
                if ( isLHSFieldTypeEquivalent( v ) ) {
                    bindings.add( v );
                }
            }
View Full Code Here

        //If the fieldTypes are SuggestionCompletionEngine.TYPE_COMPARABLE check the enums are equivalent
        if ( boundFieldType.equals( DataType.TYPE_COMPARABLE ) ) {
            if ( !this.variableType.equals( DataType.TYPE_COMPARABLE ) ) {
                return false;
            }
            FieldConstraint fc = this.modeller.getModel().getLHSBoundField( boundVariable );
            if ( fc instanceof SingleFieldConstraint ) {
                String fieldName = ( (SingleFieldConstraint) fc ).getFieldName();
                String parentFactTypeForBinding = this.modeller.getModel().getLHSParentFactPatternForBinding( boundVariable ).getFactType();
                String[] dd = this.modeller.getDataModelOracle().getEnumValues( parentFactTypeForBinding,
                                                                                fieldName );
View Full Code Here

        ins.setType( DataType.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() );
View Full Code Here

                //Add the constraint from this cell
                switch ( c.getConstraintValueType() ) {
                    case BaseSingleFieldConstraint.TYPE_LITERAL:
                    case BaseSingleFieldConstraint.TYPE_RET_VALUE:
                        if ( !isOtherwise ) {
                            FieldConstraint fc = makeSingleFieldConstraint( c,
                                                                            cell );
                            fp.addConstraint( fc );
                        } else {
                            FieldConstraint fc = makeSingleFieldConstraint( c,
                                                                            allColumns,
                                                                            data );
                            fp.addConstraint( fc );
                        }
                        break;
View Full Code Here

                      fp.getFactType() );

        assertEquals( 1,
                      fp.getNumberOfConstraints() );

        FieldConstraint fc = fp.getConstraint( 0 );
        assertNotNull( fc );
        assertTrue( fc instanceof SingleFieldConstraint );

        SingleFieldConstraint sfc = (SingleFieldConstraint) fc;
        assertEquals( "<=",
View Full Code Here

        assertNotNull( pattern.getFactPattern() );
        FactPattern factPattern = pattern.getFactPattern();
        assertEquals( "total", factPattern.getBoundName() );
        assertNotNull( factPattern.getConstraintList() );
        assertEquals( 1, factPattern.getConstraintList().getNumberOfConstraints() );
        FieldConstraint constraint = factPattern.getConstraintList().getConstraint( 0 );
        assertTrue( constraint instanceof SingleFieldConstraint );
        SingleFieldConstraint fieldConstraint = (SingleFieldConstraint) constraint;
        assertEquals( "Number", fieldConstraint.getFactType() );
        assertEquals( "intValue", fieldConstraint.getFieldName() );
        assertEquals( "Integer", fieldConstraint.getFieldType() );
View Full Code Here

        private void generateConstraints( final FactPattern pattern,
                                          final LHSGeneratorContext parentContext ) {
            LHSGeneratorContext gctx = null;
            for ( int constraintIndex = 0; constraintIndex < pattern.getFieldConstraints().length; constraintIndex++ ) {
                FieldConstraint constr = pattern.getConstraintList().getConstraints()[ constraintIndex ];

                if ( constraintIndex == 0 ) {
                    gctx = generatorContextFactory.newChildGeneratorContext( parentContext,
                                                                             constr );
                } else {
View Full Code Here

                    if ( parentContext.getParent().getFieldConstraint() instanceof CompositeFieldConstraint ) {
                        buf.append( "( " );
                    }
                    LHSGeneratorContext gctx = null;
                    for ( int nestedConstraintIndex = 0; nestedConstraintIndex < nestedConstraints.length; nestedConstraintIndex++ ) {
                        FieldConstraint nestedConstr = nestedConstraints[ nestedConstraintIndex ];

                        if ( nestedConstraintIndex == 0 ) {
                            gctx = generatorContextFactory.newChildGeneratorContext( nestedGctx,
                                                                                     nestedConstr );
                        } else {
View Full Code Here

    private Set<String> visitCompositeFieldConstraint( CompositeFieldConstraint cfc ) {
        final Set<String> factTypes = new HashSet<String>();
        if ( cfc.getConstraints() != null ) {
            for ( int i = 0; i < cfc.getConstraints().length; i++ ) {
                FieldConstraint fc = cfc.getConstraints()[ i ];
                factTypes.addAll( visit( fc ) );
            }
        }
        return factTypes;
    }
View Full Code Here

TOP

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

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.