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

Examples of org.drools.ide.common.client.modeldriven.dt52.DTCellValue52


        cdob.set( 2000,
                  0,
                  1 );
        Date dob = cdob.getTime();

        DTCellValue52 dcv1 = new DTCellValue52( new Integer( 1 ) );
        DTCellValue52 dcv2 = new DTCellValue52( Boolean.TRUE );
        DTCellValue52 dcv3 = new DTCellValue52( "Michael" );
        DTCellValue52 dcv4 = new DTCellValue52( new BigDecimal( 11 ) );
        DTCellValue52 dcv5 = new DTCellValue52( new BigInteger( "11" ) );
        DTCellValue52 dcv6 = new DTCellValue52( new Byte( "11" ) );
        DTCellValue52 dcv7 = new DTCellValue52( 11.0d );
        DTCellValue52 dcv8 = new DTCellValue52( 11.0f );
        DTCellValue52 dcv9 = new DTCellValue52( new Integer( 11 ) );
        DTCellValue52 dcv10 = new DTCellValue52( 11l );
        DTCellValue52 dcv11 = new DTCellValue52( new Short( "11" ) );
        DTCellValue52 dcv12 = new DTCellValue52( dob );
        DTCellValue52 dcv13 = new DTCellValue52( Boolean.TRUE );
        DTCellValue52 dcv14 = new DTCellValue52( "Mike" );
        DTCellValue52 dcv15 = new DTCellValue52( "Mike" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.convertModelCellValue( at1,
                                                                                     dcv1 );
        CellValue< ? extends Comparable< ? >> cell2 = factory.convertModelCellValue( at2,
                                                                                     dcv2 );
View Full Code Here


        cdob.set( 2000,
                  0,
                  1 );
        Date dob = cdob.getTime();

        DTCellValue52 dcv1 = new DTCellValue52( "1" );
        DTCellValue52 dcv2 = new DTCellValue52( "true" );
        DTCellValue52 dcv3 = new DTCellValue52( "Michael" );
        DTCellValue52 dcv4 = new DTCellValue52( "11" );
        DTCellValue52 dcv5 = new DTCellValue52( "11" );
        DTCellValue52 dcv6 = new DTCellValue52( "11" );
        DTCellValue52 dcv7 = new DTCellValue52( "11" );
        DTCellValue52 dcv8 = new DTCellValue52( "11" );
        DTCellValue52 dcv9 = new DTCellValue52( "11" );
        DTCellValue52 dcv10 = new DTCellValue52( "11" );
        DTCellValue52 dcv11 = new DTCellValue52( "11" );
        DTCellValue52 dcv12 = new DTCellValue52( "01-JAN-2000" );
        DTCellValue52 dcv13 = new DTCellValue52( "true" );
        DTCellValue52 dcv14 = new DTCellValue52( "Mike" );
        DTCellValue52 dcv15 = new DTCellValue52( "Mike" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.convertModelCellValue( at1,
                                                                                     dcv1 );
        CellValue< ? extends Comparable< ? >> cell2 = factory.convertModelCellValue( at2,
                                                                                     dcv2 );
View Full Code Here

    }

    @Test
    public void testConversionEmptyValues() {

        DTCellValue52 dcv1 = new DTCellValue52( "" );
        DTCellValue52 dcv2 = new DTCellValue52( "" );
        DTCellValue52 dcv3 = new DTCellValue52( "" );
        DTCellValue52 dcv4 = new DTCellValue52( "" );
        DTCellValue52 dcv5 = new DTCellValue52( "" );
        DTCellValue52 dcv6 = new DTCellValue52( "" );
        DTCellValue52 dcv7 = new DTCellValue52( "" );
        DTCellValue52 dcv8 = new DTCellValue52( "" );
        DTCellValue52 dcv9 = new DTCellValue52( "" );
        DTCellValue52 dcv10 = new DTCellValue52( "" );
        DTCellValue52 dcv11 = new DTCellValue52( "" );
        DTCellValue52 dcv12 = new DTCellValue52( "" );
        DTCellValue52 dcv13 = new DTCellValue52( "" );
        DTCellValue52 dcv14 = new DTCellValue52( "" );
        DTCellValue52 dcv15 = new DTCellValue52( "" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.convertModelCellValue( at1,
                                                                                     dcv1 );
        CellValue< ? extends Comparable< ? >> cell2 = factory.convertModelCellValue( at2,
                                                                                     dcv2 );
        CellValue< ? extends Comparable< ? >> cell3 = factory.convertModelCellValue( c1,
                                                                                     dcv3 );
        CellValue< ? extends Comparable< ? >> cell4 = factory.convertModelCellValue( c2,
                                                                                     dcv4 );
        CellValue< ? extends Comparable< ? >> cell5 = factory.convertModelCellValue( c3,
                                                                                     dcv5 );
        CellValue< ? extends Comparable< ? >> cell6 = factory.convertModelCellValue( c4,
                                                                                     dcv6 );
        CellValue< ? extends Comparable< ? >> cell7 = factory.convertModelCellValue( c5,
                                                                                     dcv7 );
        CellValue< ? extends Comparable< ? >> cell8 = factory.convertModelCellValue( c6,
                                                                                     dcv8 );
        CellValue< ? extends Comparable< ? >> cell9 = factory.convertModelCellValue( c7,
                                                                                     dcv9 );
        CellValue< ? extends Comparable< ? >> cell10 = factory.convertModelCellValue( c8,
                                                                                      dcv10 );
        CellValue< ? extends Comparable< ? >> cell11 = factory.convertModelCellValue( c9,
                                                                                      dcv11 );
        CellValue< ? extends Comparable< ? >> cell12 = factory.convertModelCellValue( c10,
                                                                                      dcv12 );
        CellValue< ? extends Comparable< ? >> cell13 = factory.convertModelCellValue( c11,
                                                                                      dcv13 );
        CellValue< ? extends Comparable< ? >> cell14 = factory.convertModelCellValue( a1,
                                                                                      dcv14 );
        CellValue< ? extends Comparable< ? >> cell15 = factory.convertModelCellValue( a2,
                                                                                      dcv15 );

        assertEquals( cell1.getValue(),
                      null );
        assertEquals( cell2.getValue(),
                      Boolean.FALSE );
        assertEquals( cell3.getValue(),
                      null );
        assertEquals( cell4.getValue(),
                      null );
        assertEquals( cell5.getValue(),
                      null );
        assertEquals( cell6.getValue(),
                      null );
        assertEquals( cell7.getValue(),
                      null );
        assertEquals( cell8.getValue(),
                      null );
        assertEquals( cell9.getValue(),
                      null );
        assertEquals( cell10.getValue(),
                      null );
        assertEquals( cell11.getValue(),
                      null );
        assertEquals( cell12.getValue(),
                      null );
        assertEquals( cell13.getValue(),
                      Boolean.FALSE );
        assertEquals( cell14.getValue(),
                      null );
        assertEquals( cell15.getValue(),
                      null );

        assertEquals( dcv1.getDataType(),
                      DTDataTypes52.NUMERIC_INTEGER );
        assertEquals( dcv2.getDataType(),
                      DTDataTypes52.BOOLEAN );
        assertEquals( dcv3.getDataType(),
                      DTDataTypes52.STRING );
        assertEquals( dcv4.getDataType(),
                      DTDataTypes52.NUMERIC_BIGDECIMAL );
        assertEquals( dcv5.getDataType(),
                      DTDataTypes52.NUMERIC_BIGINTEGER );
        assertEquals( dcv6.getDataType(),
                      DTDataTypes52.NUMERIC_BYTE );
        assertEquals( dcv7.getDataType(),
                      DTDataTypes52.NUMERIC_DOUBLE );
        assertEquals( dcv8.getDataType(),
                      DTDataTypes52.NUMERIC_FLOAT );
        assertEquals( dcv9.getDataType(),
                      DTDataTypes52.NUMERIC_INTEGER );
        assertEquals( dcv10.getDataType(),
                      DTDataTypes52.NUMERIC_LONG );
        assertEquals( dcv11.getDataType(),
                      DTDataTypes52.NUMERIC_SHORT );
        assertEquals( dcv12.getDataType(),
                      DTDataTypes52.DATE );
        assertEquals( dcv13.getDataType(),
                      DTDataTypes52.BOOLEAN );
        assertEquals( dcv14.getDataType(),
                      DTDataTypes52.STRING );
        assertEquals( dcv15.getDataType(),
                      DTDataTypes52.STRING );
    }
View Full Code Here

        ConditionCol52 c1 = new ConditionCol52();
        c1.setFactField( "name" );
        c1.setOperator( "==" );
        c1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c1.setValueList( "c1a,c1b" );
        c1.setDefaultValue( new DTCellValue52( "c1default" ) );
        p1.getChildColumns().add( c1 );
        dtable.getConditions().add( p1 );

        Pattern52 p2 = new Pattern52();
        p2.setBoundName( "c2" );
        p2.setFactType( "Driver" );

        ConditionCol52 c2 = new ConditionCol52();
        c2.setFactField( "age" );
        c2.setOperator( "==" );
        c2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c2.setValueList( "c2a,c2b" );
        c2.setDefaultValue( new DTCellValue52( "c2default" ) );
        p2.getChildColumns().add( c2 );
        dtable.getConditions().add( p2 );

        Pattern52 p3 = new Pattern52();
        p3.setBoundName( "c3" );
        p3.setFactType( "Driver" );

        ConditionCol52 c3 = new ConditionCol52();
        c3.setFactField( "dateOfBirth" );
        c3.setOperator( "==" );
        c3.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c3.setDefaultValue( new DTCellValue52( "c3default" ) );
        p3.getChildColumns().add( c3 );
        dtable.getConditions().add( p3 );

        RowExpander re = new RowExpander( dtable,
                                          sce );
View Full Code Here

        ConditionCol52 c2 = new ConditionCol52();
        c2.setFactField( "age" );
        c2.setOperator( "==" );
        c2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c2.setValueList( "c2a,c2b" );
        c2.setDefaultValue( new DTCellValue52( "c2default" ) );
        p2.getChildColumns().add( c2 );
        dtable.getConditions().add( p2 );

        Pattern52 p3 = new Pattern52();
        p3.setBoundName( "c3" );
View Full Code Here

        LimitedEntryConditionCol52 c1 = new LimitedEntryConditionCol52();
        c1.setFactField( "name" );
        c1.setOperator( "==" );
        c1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c1.setValue( new DTCellValue52( "Mike" ) );
        p1.getChildColumns().add( c1 );
        dtable.getConditions().add( p1 );

        Pattern52 p2 = new Pattern52();
        p2.setBoundName( "c2" );
        p2.setFactType( "Driver" );

        LimitedEntryConditionCol52 c2 = new LimitedEntryConditionCol52();
        c2.setFactField( "age" );
        c2.setOperator( "==" );
        c2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        c1.setValue( new DTCellValue52( 25 ) );
        p2.getChildColumns().add( c2 );
        dtable.getConditions().add( p2 );

        LimitedEntryActionSetFieldCol52 a1 = new LimitedEntryActionSetFieldCol52();
        a1.setBoundName( "c1" );
        a1.setFactField( "name" );
        a1.setValue( new DTCellValue52( "a1name" ) );
        dtable.getActionCols().add( a1 );

        LimitedEntryActionInsertFactCol52 a2 = new LimitedEntryActionInsertFactCol52();
        a2.setBoundName( "a2" );
        a2.setFactType( "Driver" );
        a2.setFactField( "name" );
        a2.setValue( new DTCellValue52( "a2name" ) );
        dtable.getActionCols().add( a2 );

        RowExpander re = new RowExpander( dtable,
                                          sce );
View Full Code Here

        private String getLimitedEntryValue(DTColumnConfig52 c) {
            if ( !(c instanceof LimitedEntryCol) ) {
                return null;
            }
            LimitedEntryCol lec = (LimitedEntryCol) c;
            DTCellValue52 cv = lec.getValue();
            if ( cv == null ) {
                return null;
            }
            DTDataTypes52 type = cv.getDataType();
            switch ( type ) {
                case BOOLEAN :
                    return cv.getBooleanValue().toString();
                case NUMERIC :
                    final BigDecimal numeric = (BigDecimal) cv.getNumericValue();
                    return numeric.toPlainString();
                case NUMERIC_BIGDECIMAL :
                    final BigDecimal numericBigDecimal = (BigDecimal) cv.getNumericValue();
                    return numericBigDecimal.toPlainString();
                case NUMERIC_BIGINTEGER :
                    final BigInteger numericBigInteger = (BigInteger) cv.getNumericValue();
                    return numericBigInteger.toString();
                case NUMERIC_BYTE :
                    final Byte numericByte = (Byte) cv.getNumericValue();
                    return numericByte.toString();
                case NUMERIC_DOUBLE :
                    final Double numericDouble = (Double) cv.getNumericValue();
                    return numericDouble.toString();
                case NUMERIC_FLOAT :
                    final Float numericFloat = (Float) cv.getNumericValue();
                    return numericFloat.toString();
                case NUMERIC_INTEGER :
                    final Integer numericInteger = (Integer) cv.getNumericValue();
                    return numericInteger.toString();
                case NUMERIC_LONG :
                    final Long numericLong = (Long) cv.getNumericValue();
                    return numericLong.toString();
                case NUMERIC_SHORT :
                    final Short numericShort = (Short) cv.getNumericValue();
                    return numericShort.toString();
                case DATE :
                    return format.format( cv.getDateValue() );
                default :
                    return cv.getStringValue();
            }
        }
View Full Code Here

            final Integer rowNumber = ((Integer) row.get( 0 ).getNumericValue()) - 1;
            RowDetector rowDetector = new RowDetector( rowNumber );
            for ( Pattern52 pattern : model.getPatterns() ) {
                for ( ConditionCol52 conditionCol : pattern.getChildColumns() ) {
                    int columnIndex = model.getExpandedColumns().indexOf( conditionCol );
                    DTCellValue52 visibleCellValue = row.get( columnIndex );
                    DTCellValue52 realCellValue;
                    boolean cellIsNotBlank;
                    if ( conditionCol instanceof LimitedEntryCol ) {
                        realCellValue = ((LimitedEntryCol) conditionCol).getValue();
                        cellIsNotBlank = visibleCellValue.getBooleanValue();
                    } else {
                        realCellValue = visibleCellValue;
                        cellIsNotBlank = visibleCellValue.hasValue();
                    }
                    // Blank cells are ignored
                    if ( cellIsNotBlank ) {
                        ConditionDetector conditionDetector = buildConditionDetector( model,
                                                                                      pattern,
                                                                                      conditionCol,
                                                                                      realCellValue );
                        rowDetector.putOrMergeConditionDetector( conditionDetector );
                    }
                }
            }
            for ( ActionCol52 actionCol : model.getActionCols() ) {
                //BRLActionColumns cannot be analysed
                if ( actionCol instanceof BRLActionColumn ) {
                    continue;
                }
                int columnIndex = model.getExpandedColumns().indexOf( actionCol );
                DTCellValue52 visibleCellValue = row.get( columnIndex );
                DTCellValue52 realCellValue;
                boolean cellIsNotBlank;
                if ( actionCol instanceof LimitedEntryCol ) {
                    realCellValue = ((LimitedEntryCol) actionCol).getValue();
                    cellIsNotBlank = visibleCellValue.getBooleanValue();
                } else {
View Full Code Here

    // Retrieve the data for a particular column
    private List<CellValue< ? extends Comparable< ? >>> getColumnData(BaseColumn column) {
        int iColIndex = model.getExpandedColumns().indexOf( column );
        List<CellValue< ? extends Comparable< ? >>> columnData = new ArrayList<CellValue< ? extends Comparable< ? >>>();
        for ( List<DTCellValue52> row : model.getData() ) {
            DTCellValue52 dcv = row.get( iColIndex );
            columnData.add( cellValueFactory.convertModelCellValue( column,
                                                                    dcv ) );
        }
        return columnData;
    }
View Full Code Here

    //Remove Otherwise state from column cells
    private void removeOtherwiseStates(DTColumnConfig52 column) {
        int index = this.model.getExpandedColumns().indexOf( column );
        for ( List<DTCellValue52> row : this.model.getData() ) {
            DTCellValue52 dcv = row.get( index );
            dcv.setOtherwise( false );
        }
    }
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.dt52.DTCellValue52

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.