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

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


        assertEquals( "x",
                      fb.get( 0 ) );
        assertEquals( "y",
                      fb.get( 1 ) );

        FieldConstraint fc = model.getLHSBoundField( "qbc" );
        assertEquals( con,
                      fc );

        FactPattern parentFactPattern = model.getLHSParentFactPatternForBinding( "qbc" );
        assertEquals( y,
View Full Code Here


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

                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.getFactType(),
                                                     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

                                                final DirtyableFlexTable table,
                                                List<FieldConstraint> parents,
                                                HasConstraints hasConstraints,
                                                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

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.