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

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


    private void traverseSingleFieldConstraints(List<FieldConstraint> sortedConst,
                                                final DirtyableFlexTable table,
                                                List<FieldConstraint> parents,
                                                int i) {
        int tabs = -1;
        FieldConstraint current = sortedConst.get( i );
        if ( current instanceof SingleFieldConstraint ) {
            SingleFieldConstraint single = (SingleFieldConstraint) current;
            FieldConstraint parent = single.getParent();

            for ( int j = 0; j < parents.size(); j++ ) {
                FieldConstraint storedParent = parents.get( j );
                if ( storedParent != null && storedParent.equals( parent ) ) {
                    tabs = j + 1;
                    traverseForRemoval( parents,
                                        j );
                    parents.add( current );
                    break;
View Full Code Here


     * @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

                    applicableBindingsInScope.add( v );
                }
            }

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

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

                String[] splitTypeFields = typeFields.split( "," );
                for ( int j = 0; j < splitTypeFields.length; j++ ) {
                    String typeField = splitTypeFields[j];

                    for ( int i = 0; i < cons.length; i++ ) {
                        FieldConstraint con = cons[i];
                        if ( con instanceof SingleFieldConstraint ) {
                            SingleFieldConstraint sfc = (SingleFieldConstraint) con;

                            if ( sfc.fieldName.trim().equals( typeField.trim() ) ) {
                                if ( addOpeninColumn ) {
                                    key += "[";
                                    addOpeninColumn = false;
                                }
                                key += typeField + "=" + sfc.value;

                                if ( j != (splitTypeFields.length - 1) ) {
                                    key += ",";
                                }
                            }
                        }
                    }
                }

                if ( !addOpeninColumn ) {
                    key += "]";
                }

                DropDownData data = DropDownData.create( this.dataEnumLists.get( key ) );
                if ( data != null ) {
                    return DropDownData.create( this.dataEnumLists.get( key ) );
                }
            } else if ( _typeFields != null ) {
                // these enums are calculated on demand, server side...
                String[] fieldsNeeded = (String[]) _typeFields;

                String queryString = getQueryString( pat.factType,
                                                     field,
                                                     fieldsNeeded,
                                                     this.dataEnumLists );

                String[] valuePairs = new String[fieldsNeeded.length];

                // collect all the values of the fields needed, then return it
                // as a string...
                for ( int i = 0; i < fieldsNeeded.length; i++ ) {
                    for ( int j = 0; j < pat.constraintList.constraints.length; j++ ) {
                        FieldConstraint con = pat.constraintList.constraints[j];
                        if ( con instanceof SingleFieldConstraint ) {
                            SingleFieldConstraint sfc = (SingleFieldConstraint) con;
                            if ( sfc.fieldName.equals( fieldsNeeded[i] ) ) {
                                valuePairs[i] = fieldsNeeded[i] + "=" + sfc.value;
                            }
View Full Code Here

                String[] splitTypeFields = typeFields.split( "," );
                for ( int j = 0; j < splitTypeFields.length; j++ ) {
                    String typeField = splitTypeFields[j];

                    for ( int i = 0; i < cons.length; i++ ) {
                        FieldConstraint con = cons[i];
                        if ( con instanceof SingleFieldConstraint ) {
                            SingleFieldConstraint sfc = (SingleFieldConstraint) con;

                            if ( sfc.getFieldName().trim().equals( typeField.trim() ) ) {
                                if ( addOpeninColumn ) {
                                    key += "[";
                                    addOpeninColumn = false;
                                }
                                key += typeField + "=" + sfc.getValue();

                                if ( j != (splitTypeFields.length - 1) ) {
                                    key += ",";
                                }
                            }
                        }
                    }
                }

                if ( !addOpeninColumn ) {
                    key += "]";
                }

                DropDownData data = DropDownData.create( this.dataEnumLists.get( key ) );
                if ( data != null ) {
                    return DropDownData.create( this.dataEnumLists.get( key ) );
                }
            } else if ( _typeFields != null ) {
                // these enums are calculated on demand, server side...
                String[] fieldsNeeded = (String[]) _typeFields;

                String queryString = getQueryString( pat.factType,
                                                     field,
                                                     fieldsNeeded,
                                                     this.dataEnumLists );

                String[] valuePairs = new String[fieldsNeeded.length];

                // collect all the values of the fields needed, then return it
                // as a string...
                for ( int i = 0; i < fieldsNeeded.length; i++ ) {
                    for ( int j = 0; j < pat.constraintList.constraints.length; j++ ) {
                        FieldConstraint con = pat.constraintList.constraints[j];
                        if ( con instanceof SingleFieldConstraint ) {
                            SingleFieldConstraint sfc = (SingleFieldConstraint) con;
                            if ( sfc.getFieldName().equals( fieldsNeeded[i] ) ) {
                                valuePairs[i] = fieldsNeeded[i] + "=" + sfc.getValue();
                            }
View Full Code Here

        };
    }

    private void traverseSingleFieldConstraints(List<FieldConstraint> sortedConst, final DirtyableFlexTable table, List<FieldConstraint> parents, int i) {
        int tabs = -1;
        FieldConstraint current = sortedConst.get( i );
        if ( current instanceof SingleFieldConstraint ) {
            SingleFieldConstraint single = (SingleFieldConstraint) current;
            FieldConstraint parent = single.getParent();

            for ( int j = 0; j < parents.size(); j++ ) {
                FieldConstraint storedParent = parents.get( j );
                if ( storedParent != null && storedParent.equals( parent ) ) {
                    tabs = j + 1;
                    traverseForRemoval( parents, j );
                    parents.add( current );
                    break;
                }
View Full Code Here

     * @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

                    //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

                    applicableBindingsInScope.add( v );
                }
            }

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

TOP

Related Classes of org.drools.ide.common.client.modeldriven.brl.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.