Package org.drools.workbench.models.guided.dtable.shared.model

Examples of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn


        return variableList;
    }

    @Override
    protected BRLColumn<IPattern, BRLConditionVariableColumn> cloneBRLColumn( BRLColumn<IPattern, BRLConditionVariableColumn> col ) {
        BRLConditionColumn clone = new BRLConditionColumn();
        clone.setHeader( col.getHeader() );
        clone.setHideColumn( col.isHideColumn() );
        clone.setDefinition( cloneDefinition( col.getDefinition() ) );
        clone.setChildColumns( cloneVariables( col.getChildColumns() ) );
        return clone;
    }
View Full Code Here


        BaseColumn baseColumn = allColumns.get( iBaseColIndex );

        //Get values for all Constraints or Actions on the same pattern as the baseColumn
        if ( baseColumn instanceof BRLConditionVariableColumn ) {
            final BRLConditionVariableColumn baseBRLConditionColumn = (BRLConditionVariableColumn) baseColumn;
            final BRLConditionColumn brl = model.getBRLColumn( baseBRLConditionColumn );
            final RuleModel rm = new RuleModel();
            IPattern[] lhs = new IPattern[ brl.getDefinition().size() ];
            brl.getDefinition().toArray( lhs );
            rm.lhs = lhs;

            final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( rm,
                                                                                                       baseBRLConditionColumn.getVarName() );
            List<RuleModelPeerVariableVisitor.ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

            //Add other variables values
            for ( ValueHolder valueHolder : peerVariables ) {
                switch ( valueHolder.getType() ) {
                    case TEMPLATE_KEY:
                        final BRLConditionVariableColumn vc = getConditionVariableColumnIndex( brl.getChildColumns(),
                                                                                               valueHolder.getValue() );
                        final int iCol = model.getExpandedColumns().indexOf( vc );
                        final CellValue<?> cv = this.data.get( iBaseRowIndex ).get( iCol );
                        final String field = vc.getFactField();
                        final String value = getValue( vc,
                                                       cv );
                        currentValueMap.put( field,
                                             value );
                        break;
                    case VALUE:
                        currentValueMap.put( valueHolder.getFieldName(),
                                             valueHolder.getValue() );
                }
            }

        } else if ( baseColumn instanceof BRLActionVariableColumn ) {
            final BRLActionVariableColumn baseBRLActionColumn = (BRLActionVariableColumn) baseColumn;
            final BRLActionColumn brl = model.getBRLColumn( baseBRLActionColumn );
            final RuleModel rm = new RuleModel();
            IAction[] rhs = new IAction[ brl.getDefinition().size() ];
            brl.getDefinition().toArray( rhs );
            rm.rhs = rhs;

            final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( rm,
                                                                                                       baseBRLActionColumn.getVarName() );
            List<ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

            //Add other variables values
            for ( ValueHolder valueHolder : peerVariables ) {
                switch ( valueHolder.getType() ) {
                    case TEMPLATE_KEY:
                        final BRLActionVariableColumn vc = getActionVariableColumnIndex( brl.getChildColumns(),
                                                                                         valueHolder.getValue() );
                        final int iCol = model.getExpandedColumns().indexOf( vc );
                        final CellValue<?> cv = this.data.get( iBaseRowIndex ).get( iCol );
                        final String field = vc.getFactField();
                        final String value = getValue( vc,
View Full Code Here

        final BaseColumn baseColumn = allColumns.get( iBaseColIndex );

        //Get values for all Constraints or Actions on the same pattern as the baseColumn
        if ( baseColumn instanceof BRLConditionVariableColumn ) {
            final BRLConditionVariableColumn baseBRLConditionColumn = (BRLConditionVariableColumn) baseColumn;
            final BRLConditionColumn brl = model.getBRLColumn( baseBRLConditionColumn );
            final RuleModel rm = new RuleModel();
            IPattern[] lhs = new IPattern[ brl.getDefinition().size() ];
            brl.getDefinition().toArray( lhs );
            rm.lhs = lhs;

            final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( rm,
                                                                                                       baseBRLConditionColumn.getVarName() );
            List<ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

            //Add other variables values
            for ( ValueHolder valueHolder : peerVariables ) {
                switch ( valueHolder.getType() ) {
                    case TEMPLATE_KEY:
                        if ( oracle.isDependentEnum( baseBRLConditionColumn.getFactType(),
                                                     baseBRLConditionColumn.getFactField(),
                                                     valueHolder.getFieldName() ) ) {
                            final BRLConditionVariableColumn vc = getConditionVariableColumnIndex( brl.getChildColumns(),
                                                                                                   valueHolder.getValue() );
                            final int iCol = model.getExpandedColumns().indexOf( vc );
                            dependentColumnIndexes.add( iCol );
                        }
                        break;
                }
            }

        } else if ( baseColumn instanceof BRLActionVariableColumn ) {
            final BRLActionVariableColumn baseBRLActionColumn = (BRLActionVariableColumn) baseColumn;
            final BRLActionColumn brl = model.getBRLColumn( baseBRLActionColumn );
            final RuleModel rm = new RuleModel();
            IAction[] rhs = new IAction[ brl.getDefinition().size() ];
            brl.getDefinition().toArray( rhs );
            rm.rhs = rhs;

            final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( rm,
                                                                                                       baseBRLActionColumn.getVarName() );
            List<ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

            //Add other variables values
            for ( ValueHolder valueHolder : peerVariables ) {
                switch ( valueHolder.getType() ) {
                    case TEMPLATE_KEY:
                        if ( oracle.isDependentEnum( baseBRLActionColumn.getFactType(),
                                                     baseBRLActionColumn.getFactField(),
                                                     valueHolder.getFieldName() ) ) {
                            final BRLActionVariableColumn vc = getActionVariableColumnIndex( brl.getChildColumns(),
                                                                                             valueHolder.getValue() );
                            final int iCol = model.getExpandedColumns().indexOf( vc );
                            dependentColumnIndexes.add( iCol );
                        }
                        break;
View Full Code Here

                                                brl,
                                                colIndex++ ),
                                column.isVisible() );

            } else if ( cc instanceof BRLConditionColumn ) {
                BRLConditionColumn brl = (BRLConditionColumn) cc;
                for ( BRLConditionVariableColumn variable : brl.getChildColumns() ) {
                    DynamicColumn<BaseColumn> column = new DynamicColumn<BaseColumn>( variable,
                                                                                      cellFactory.getCell( variable ),
                                                                                      colIndex,
                                                                                      eventBus );
                    columnWidth = variable.getWidth();
                    column.setWidth( columnWidth <= 0 ? defaultColumnWidth : columnWidth );
                    column.setVisible( !variable.isHideColumn() );
                    columns.add( column );

                    data.addColumn( colIndex,
                                    makeColumnData( model,
                                                    variable,
                                                    colIndex++ ),
                                    column.isVisible() );
                }

            } else if ( cc instanceof Pattern52 ) {
                Pattern52 p = (Pattern52) cc;
                for ( ConditionCol52 col : p.getChildColumns() ) {
                    DynamicColumn<BaseColumn> column = new DynamicColumn<BaseColumn>( col,
                                                                                      cellFactory.getCell( col ),
                                                                                      colIndex,
                                                                                      eventBus );
                    columnWidth = col.getWidth();
                    column.setWidth( columnWidth <= 0 ? defaultColumnWidth : columnWidth );
                    column.setVisible( !col.isHideColumn() );
                    columns.add( column );

                    data.addColumn( colIndex,
                                    makeColumnData( model,
                                                    col,
                                                    colIndex++ ),
                                    column.isVisible() );
                }
            }
        }

        // Initialise CellTable's Action columns
        for ( ActionCol52 col : model.getActionCols() ) {
            if ( col instanceof LimitedEntryBRLActionColumn ) {
                LimitedEntryBRLActionColumn brl = (LimitedEntryBRLActionColumn) col;
                DynamicColumn<BaseColumn> column = new DynamicColumn<BaseColumn>( brl,
                                                                                  cellFactory.getCell( brl ),
                                                                                  colIndex,
                                                                                  eventBus );
                columnWidth = brl.getWidth();
                column.setWidth( columnWidth <= 0 ? defaultColumnWidth : columnWidth );
                column.setVisible( !brl.isHideColumn() );
                columns.add( column );

                data.addColumn( colIndex,
                                makeColumnData( model,
                                                brl,
                                                colIndex++ ),
                                column.isVisible() );

            } else if ( col instanceof BRLActionColumn ) {
                BRLActionColumn brl = (BRLActionColumn) col;
                for ( BRLActionVariableColumn variable : brl.getChildColumns() ) {
                    DynamicColumn<BaseColumn> column = new DynamicColumn<BaseColumn>( variable,
                                                                                      cellFactory.getCell( variable ),
                                                                                      colIndex,
                                                                                      eventBus );
                    columnWidth = variable.getWidth();
View Full Code Here

        p1.getChildColumns().add( con );

        dtable.getConditions().add( p1 );

        //BRL Column
        BRLConditionColumn brl1 = new BRLConditionColumn();

        //BRL Column definition
        List<IPattern> brl1Definition = new ArrayList<IPattern>();
        FactPattern brl1DefinitionFactPattern1 = new FactPattern( "Smurf" );

        SingleFieldConstraint brl1DefinitionFactPattern1Constraint1 = new SingleFieldConstraint();
        brl1DefinitionFactPattern1Constraint1.setFieldType( DataType.TYPE_STRING );
        brl1DefinitionFactPattern1Constraint1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionFactPattern1Constraint1.setFieldName( "name" );
        brl1DefinitionFactPattern1Constraint1.setOperator( "==" );
        brl1DefinitionFactPattern1Constraint1.setValue( "$name" );
        brl1DefinitionFactPattern1.addConstraint( brl1DefinitionFactPattern1Constraint1 );

        SingleFieldConstraint brl1DefinitionFactPattern1Constraint2 = new SingleFieldConstraint();
        brl1DefinitionFactPattern1Constraint2.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
        brl1DefinitionFactPattern1Constraint2.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionFactPattern1Constraint2.setFieldName( "age" );
        brl1DefinitionFactPattern1Constraint2.setOperator( "==" );
        brl1DefinitionFactPattern1Constraint2.setValue( "$age" );
        brl1DefinitionFactPattern1.addConstraint( brl1DefinitionFactPattern1Constraint2 );

        brl1Definition.add( brl1DefinitionFactPattern1 );

        brl1.setDefinition( brl1Definition );

        //Setup BRL column bindings
        BRLConditionVariableColumn brl1Variable1 = new BRLConditionVariableColumn( "$name",
                                                                                   DataType.TYPE_STRING,
                                                                                   "Person",
                                                                                   "name" );
        brl1.getChildColumns().add( brl1Variable1 );
        BRLConditionVariableColumn brl1Variable2 = new BRLConditionVariableColumn( "$age",
                                                                                   DataType.TYPE_NUMERIC_INTEGER,
                                                                                   "Person",
                                                                                   "age" );
        brl1.getChildColumns().add( brl1Variable2 );

        dtable.getConditions().add( brl1 );

        //Now to test conversion
        RuleModel rm = new RuleModel();
View Full Code Here

        p1.getChildColumns().add( con );

        dtable.getConditions().add( p1 );

        //BRL Column
        BRLConditionColumn brl1 = new BRLConditionColumn();

        //BRL Column definition
        List<IPattern> brl1Definition = new ArrayList<IPattern>();
        FactPattern brl1DefinitionFactPattern1 = new FactPattern( "Smurf" );

        SingleFieldConstraint brl1DefinitionFactPattern1Constraint1 = new SingleFieldConstraint();
        brl1DefinitionFactPattern1Constraint1.setFieldType( DataType.TYPE_STRING );
        brl1DefinitionFactPattern1Constraint1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionFactPattern1Constraint1.setFieldName( "name" );
        brl1DefinitionFactPattern1Constraint1.setOperator( "==" );
        brl1DefinitionFactPattern1Constraint1.setValue( "$name" );
        brl1DefinitionFactPattern1.addConstraint( brl1DefinitionFactPattern1Constraint1 );

        SingleFieldConstraint brl1DefinitionFactPattern1Constraint2 = new SingleFieldConstraint();
        brl1DefinitionFactPattern1Constraint2.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
        brl1DefinitionFactPattern1Constraint2.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionFactPattern1Constraint2.setFieldName( "age" );
        brl1DefinitionFactPattern1Constraint2.setOperator( "==" );
        brl1DefinitionFactPattern1Constraint2.setValue( "$age" );
        brl1DefinitionFactPattern1.addConstraint( brl1DefinitionFactPattern1Constraint2 );

        brl1Definition.add( brl1DefinitionFactPattern1 );

        brl1.setDefinition( brl1Definition );

        //Setup BRL column bindings
        BRLConditionVariableColumn brl1Variable1 = new BRLConditionVariableColumn( "$name",
                                                                                   DataType.TYPE_STRING,
                                                                                   "Person",
                                                                                   "name" );
        brl1.getChildColumns().add( brl1Variable1 );
        BRLConditionVariableColumn brl1Variable2 = new BRLConditionVariableColumn( "$age",
                                                                                   DataType.TYPE_NUMERIC_INTEGER,
                                                                                   "Person",
                                                                                   "age" );
        brl1.getChildColumns().add( brl1Variable2 );

        dtable.getConditions().add( brl1 );
        dtable.setData( DataUtilities.makeDataLists( data ) );

        //Now to test conversion
View Full Code Here

        //Simple (mandatory) columns
        dtable.setRowNumberCol( new RowNumberCol52() );
        dtable.setDescriptionCol( new DescriptionCol52() );

        //BRL Column
        BRLConditionColumn brl1 = new BRLConditionColumn();

        //BRL Column definition
        List<IPattern> brl1Definition = new ArrayList<IPattern>();
        FactPattern brl1DefinitionFactPattern1 = new FactPattern( "Baddie" );

        SingleFieldConstraint brl1DefinitionFactPattern1Constraint1 = new SingleFieldConstraint();
        brl1DefinitionFactPattern1Constraint1.setFieldType( DataType.TYPE_STRING );
        brl1DefinitionFactPattern1Constraint1.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        brl1DefinitionFactPattern1Constraint1.setFieldName( "name" );
        brl1DefinitionFactPattern1Constraint1.setOperator( "==" );
        brl1DefinitionFactPattern1Constraint1.setValue( "Gargamel" );
        brl1DefinitionFactPattern1.addConstraint( brl1DefinitionFactPattern1Constraint1 );

        brl1Definition.add( brl1DefinitionFactPattern1 );

        FactPattern brl1DefinitionFactPattern2 = new FactPattern( "Smurf" );

        SingleFieldConstraint brl1DefinitionFactPattern2Constraint1 = new SingleFieldConstraint();
        brl1DefinitionFactPattern2Constraint1.setFieldType( DataType.TYPE_STRING );
        brl1DefinitionFactPattern2Constraint1.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionFactPattern2Constraint1.setFieldName( "name" );
        brl1DefinitionFactPattern2Constraint1.setOperator( "==" );
        brl1DefinitionFactPattern2Constraint1.setValue( "$name" );
        brl1DefinitionFactPattern2.addConstraint( brl1DefinitionFactPattern2Constraint1 );

        SingleFieldConstraint brl1DefinitionFactPattern2Constraint2 = new SingleFieldConstraint();
        brl1DefinitionFactPattern2Constraint2.setFieldType( DataType.TYPE_NUMERIC_INTEGER );
        brl1DefinitionFactPattern2Constraint2.setConstraintValueType( SingleFieldConstraint.TYPE_TEMPLATE );
        brl1DefinitionFactPattern2Constraint2.setFieldName( "age" );
        brl1DefinitionFactPattern2Constraint2.setOperator( "==" );
        brl1DefinitionFactPattern2Constraint2.setValue( "$age" );
        brl1DefinitionFactPattern2.addConstraint( brl1DefinitionFactPattern2Constraint2 );

        brl1Definition.add( brl1DefinitionFactPattern2 );

        brl1.setDefinition( brl1Definition );

        //Setup BRL column bindings
        BRLConditionVariableColumn brl1Variable1 = new BRLConditionVariableColumn( "$name",
                                                                                   DataType.TYPE_STRING,
                                                                                   "Person",
                                                                                   "name" );
        brl1.getChildColumns().add( brl1Variable1 );
        BRLConditionVariableColumn brl1Variable2 = new BRLConditionVariableColumn( "$age",
                                                                                   DataType.TYPE_NUMERIC_INTEGER,
                                                                                   "Person",
                                                                                   "age" );
        brl1.getChildColumns().add( brl1Variable2 );

        dtable.getConditions().add( brl1 );
        dtable.setData( DataUtilities.makeDataLists( data ) );

        //Now to test conversion
View Full Code Here

        //Simple (mandatory) columns
        dtable.setRowNumberCol( new RowNumberCol52() );
        dtable.setDescriptionCol( new DescriptionCol52() );

        //BRL Column
        BRLConditionColumn brl1 = new BRLConditionColumn();

        //BRL Column definition
        List<IPattern> brl1Definition = new ArrayList<IPattern>();
        FactPattern brl1DefinitionFactPattern1 = new FactPattern( "Baddie" );

        SingleFieldConstraint brl1DefinitionFactPattern1Constraint1 = new SingleFieldConstraint();
        brl1DefinitionFactPattern1Constraint1.setFieldType( DataType.TYPE_STRING );
        brl1DefinitionFactPattern1Constraint1.setConstraintValueType( SingleFieldConstraint.TYPE_LITERAL );
        brl1DefinitionFactPattern1Constraint1.setFieldName( "name" );
        brl1DefinitionFactPattern1Constraint1.setOperator( "==" );
        brl1DefinitionFactPattern1Constraint1.setValue( "Gargamel" );
        brl1DefinitionFactPattern1.addConstraint( brl1DefinitionFactPattern1Constraint1 );

        brl1Definition.add( brl1DefinitionFactPattern1 );

        brl1.setDefinition( brl1Definition );

        //Setup BRL column bindings
        BRLConditionVariableColumn brl1Variable1 = new BRLConditionVariableColumn( "",
                                                                                   DataType.TYPE_BOOLEAN );
        brl1.getChildColumns().add( brl1Variable1 );

        dtable.getConditions().add( brl1 );
        dtable.setData( DataUtilities.makeDataLists( data ) );

        //Now to test conversion
View Full Code Here

        c1.setBinding( "$c1" );

        p1.getChildColumns().add( c1 );
        dt.getConditions().add( p1 );

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

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

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

        ActionInsertFactCol52 ins = new ActionInsertFactCol52();
        ins.setBoundName( "$ins" );
        ins.setFactField( "rating" );
View Full Code Here

        c1.setBinding( "$c1" );

        p1.getChildColumns().add( c1 );
        dt.getConditions().add( p1 );

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

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

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

        ActionInsertFactCol52 ins = new ActionInsertFactCol52();
        ins.setBoundName( "$ins" );
        ins.setFactField( "rating" );
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn

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.