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

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


    }

    private int getVariableColumnIndex( final String variableName ) {
        final InterpolationVariable[] allVariables = this.model.getInterpolationVariablesList();
        for ( int iCol = 0; iCol < allVariables.length; iCol++ ) {
            final InterpolationVariable var = allVariables[ iCol ];
            if ( var.getVarName().equals( variableName ) ) {
                return iCol;
            }
        }
        //This should never happen
        throw new IllegalArgumentException( "Variable '" + variableName + "' not found. This suggests an programming error." );
View Full Code Here


        final int iBaseColIndex = context.getColumn();
        final Set<Integer> dependentColumnIndexes = new HashSet<Integer>();

        //Get variable for the column being edited
        final InterpolationVariable[] allVariables = this.model.getInterpolationVariablesList();
        final InterpolationVariable baseVariable = allVariables[ iBaseColIndex ];
        final String baseVariableName = baseVariable.getVarName();

        //Get other variables (and literals) in the same scope as the base variable
        final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( model,
                                                                                                   baseVariableName );
        List<RuleModelPeerVariableVisitor.ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

        //Add other variables values
        for ( RuleModelPeerVariableVisitor.ValueHolder valueHolder : peerVariables ) {
            switch ( valueHolder.getType() ) {
                case TEMPLATE_KEY:
                    final int iCol = getVariableColumnIndex( valueHolder.getValue() );
                    final InterpolationVariable variable = allVariables[ iCol ];
                    final String field = variable.getFactField();

                    if ( sce.isDependentEnum( baseVariable.getFactType(),
                                              baseVariable.getFactField(),
                                              field ) ) {
                        dependentColumnIndexes.add( iCol );
View Full Code Here

        }

        //Convert to columns for use in the Decision Table
        BRLConditionVariableColumn[] variables = new BRLConditionVariableColumn[ ivs.size() ];
        for ( Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet() ) {
            InterpolationVariable iv = me.getKey();
            int index = me.getValue();
            BRLConditionVariableColumn variable = new BRLConditionVariableColumn( iv.getVarName(),
                                                                                  iv.getDataType(),
                                                                                  iv.getFactType(),
                                                                                  iv.getFactField() );
            variable.setHeader( editingCol.getHeader() );
            variable.setHideColumn( editingCol.isHideColumn() );
            variables[ index ] = variable;
        }
View Full Code Here

        }

        //Convert to columns for use in the Decision Table
        BRLActionVariableColumn[] variables = new BRLActionVariableColumn[ ivs.size() ];
        for ( Map.Entry<InterpolationVariable, Integer> me : ivs.entrySet() ) {
            InterpolationVariable iv = me.getKey();
            int index = me.getValue();
            BRLActionVariableColumn variable = new BRLActionVariableColumn( iv.getVarName(),
                                                                            iv.getDataType(),
                                                                            iv.getFactType(),
                                                                            iv.getFactField() );
            variable.setHeader( editingCol.getHeader() );
            variable.setHideColumn( editingCol.isHideColumn() );
            variables[ index ] = variable;
        }
View Full Code Here

                int targetRowIndex = originRowIndex + iRow;
                for ( int iCol = 0; iCol < rowData.size(); iCol++ ) {
                    int targetColumnIndex = originColumnIndex + iCol;
                    CellValue<? extends Comparable<?>> changedCell = rowData.get( iCol );

                    InterpolationVariable var = vars[ targetColumnIndex ];
                    TemplateDataColumn col = new TemplateDataColumn( var.getVarName(),
                                                                     var.getDataType(),
                                                                     var.getFactType(),
                                                                     var.getFactField() );

                    String dcv = cellValueFactory.convertToModelCell( col,
                                                                      changedCell );

                    List<String> columnData = model.getTable().get( var.getVarName() );
                    columnData.set( targetRowIndex,
                                    dcv );
                }
            }
        }
View Full Code Here

        final int iBaseRowIndex = context.getIndex();
        final int iBaseColIndex = context.getColumn();

        //Get variable for the column being edited
        InterpolationVariable[] allVariables = this.model.getInterpolationVariablesList();
        InterpolationVariable baseVariable = allVariables[ iBaseColIndex ];
        final String baseVariableName = baseVariable.getVarName();

        //Get other variables (and literals) in the same scope as the base variable
        final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( model,
                                                                                                   baseVariableName );
        List<RuleModelPeerVariableVisitor.ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

        //Add other variables values
        for ( RuleModelPeerVariableVisitor.ValueHolder valueHolder : peerVariables ) {
            switch ( valueHolder.getType() ) {
                case TEMPLATE_KEY:
                    final int iCol = getVariableColumnIndex( valueHolder.getValue() );
                    final InterpolationVariable variable = allVariables[ iCol ];
                    final String field = variable.getFactField();

                    //The generic class CellValue can have different data-types so
                    //we need to convert the cell's value to a String used by the
                    //dependent enumerations services
                    final CellValue<?> cv = this.data.get( iBaseRowIndex ).get( iCol );
View Full Code Here

    }

    private int getVariableColumnIndex( final String variableName ) {
        final InterpolationVariable[] allVariables = this.model.getInterpolationVariablesList();
        for ( int iCol = 0; iCol < allVariables.length; iCol++ ) {
            final InterpolationVariable var = allVariables[ iCol ];
            if ( var.getVarName().equals( variableName ) ) {
                return iCol;
            }
        }
        //This should never happen
        throw new IllegalArgumentException( "Variable '" + variableName + "' not found. This suggests an programming error." );
View Full Code Here

        final int iBaseColIndex = context.getColumn();
        final Set<Integer> dependentColumnIndexes = new HashSet<Integer>();

        //Get variable for the column being edited
        final InterpolationVariable[] allVariables = this.model.getInterpolationVariablesList();
        final InterpolationVariable baseVariable = allVariables[ iBaseColIndex ];
        final String baseVariableName = baseVariable.getVarName();

        //Get other variables (and literals) in the same scope as the base variable
        final RuleModelPeerVariableVisitor peerVariableVisitor = new RuleModelPeerVariableVisitor( model,
                                                                                                   baseVariableName );
        List<RuleModelPeerVariableVisitor.ValueHolder> peerVariables = peerVariableVisitor.getPeerVariables();

        //Add other variables values
        for ( RuleModelPeerVariableVisitor.ValueHolder valueHolder : peerVariables ) {
            switch ( valueHolder.getType() ) {
                case TEMPLATE_KEY:
                    final int iCol = getVariableColumnIndex( valueHolder.getValue() );
                    final InterpolationVariable variable = allVariables[ iCol ];
                    final String field = variable.getFactField();

                    if ( oracle.isDependentEnum( baseVariable.getFactType(),
                                                 baseVariable.getFactField(),
                                                 field ) ) {
                        dependentColumnIndexes.add( iCol );
View Full Code Here

                                    pos + 2 );
            if ( end != -1 ) {
                final String varName = text.substring( pos + 2,
                                                       end );
                pos = end + 1;
                InterpolationVariable var = new InterpolationVariable( varName,
                                                                       DataType.TYPE_OBJECT );
                if ( !vars.contains( var ) ) {
                    vars.add( var );
                }
            }
View Full Code Here

    //ActionInsertFact, ActionSetField, ActionpdateField
    private void visitActionFieldList( final ActionInsertFact afl ) {
        String factType = afl.getFactType();
        for ( ActionFieldValue afv : afl.getFieldValues() ) {
            InterpolationVariable var = new InterpolationVariable( afv.getValue(),
                                                                   afv.getType(),
                                                                   factType,
                                                                   afv.getField() );
            if ( afv.getNature() == FieldNatureType.TYPE_TEMPLATE && !vars.contains( var ) ) {
                vars.add( var );
View Full Code Here

TOP

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

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.