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

Examples of org.drools.ide.common.client.modeldriven.dt.DTCellValue


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

        DTCellValue dcv1 = new DTCellValue( Boolean.TRUE );
        DTCellValue dcv2 = new DTCellValue( dob );
        DTCellValue dcv3 = new DTCellValue( 1 );
        DTCellValue dcv4 = new DTCellValue( 1.0 );
        DTCellValue dcv5 = new DTCellValue( new BigDecimal( 1 ) );
        DTCellValue dcv6 = new DTCellValue( "Smurf" );

        assertEquals( dcv1.getDataType(),
                      DTDataTypes.BOOLEAN );
        assertEquals( dcv2.getDataType(),
                      DTDataTypes.DATE );
        assertEquals( dcv3.getDataType(),
                      DTDataTypes.NUMERIC );
        assertEquals( dcv4.getDataType(),
                      DTDataTypes.NUMERIC );
        assertEquals( dcv5.getDataType(),
                      DTDataTypes.NUMERIC );
        assertEquals( dcv6.getDataType(),
                      DTDataTypes.STRING );

    }
View Full Code Here


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

        DTCellValue dcv1 = new DTCellValue( 1 );
        DTCellValue dcv2 = new DTCellValue( Boolean.TRUE );
        DTCellValue dcv3 = new DTCellValue( "Michael" );
        DTCellValue dcv4 = new DTCellValue( 11 );
        DTCellValue dcv5 = new DTCellValue( dob );
        DTCellValue dcv6 = new DTCellValue( Boolean.TRUE );
        DTCellValue dcv7 = new DTCellValue( "Mike" );
        DTCellValue dcv8 = new DTCellValue( "Mike" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.makeCellValue( at1,
                                                                             0,
                                                                             0,
                                                                             dcv1 );
View Full Code Here

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

        DTCellValue dcv1 = new DTCellValue( "1" );
        DTCellValue dcv2 = new DTCellValue( "true" );
        DTCellValue dcv3 = new DTCellValue( "Michael" );
        DTCellValue dcv4 = new DTCellValue( "11" );
        DTCellValue dcv5 = new DTCellValue( "01-JAN-2000" );
        DTCellValue dcv6 = new DTCellValue( "true" );
        DTCellValue dcv7 = new DTCellValue( "Mike" );
        DTCellValue dcv8 = new DTCellValue( "Mike" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.makeCellValue( at1,
                                                                             0,
                                                                             0,
                                                                             dcv1 );
View Full Code Here

    }

    @Test
    public void testConversionEmptyValues() {

        DTCellValue dcv1 = new DTCellValue( "" );
        DTCellValue dcv2 = new DTCellValue( "" );
        DTCellValue dcv3 = new DTCellValue( "" );
        DTCellValue dcv4 = new DTCellValue( "" );
        DTCellValue dcv5 = new DTCellValue( "" );
        DTCellValue dcv6 = new DTCellValue( "" );
        DTCellValue dcv7 = new DTCellValue( "" );
        DTCellValue dcv8 = new DTCellValue( "" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.makeCellValue( at1,
                                                                             0,
                                                                             0,
                                                                             dcv1 );
        CellValue< ? extends Comparable< ? >> cell2 = factory.makeCellValue( at2,
                                                                             0,
                                                                             1,
                                                                             dcv2 );
        CellValue< ? extends Comparable< ? >> cell3 = factory.makeCellValue( c1,
                                                                             0,
                                                                             2,
                                                                             dcv3 );
        CellValue< ? extends Comparable< ? >> cell4 = factory.makeCellValue( c2,
                                                                             0,
                                                                             3,
                                                                             dcv4 );
        CellValue< ? extends Comparable< ? >> cell5 = factory.makeCellValue( c3,
                                                                             0,
                                                                             4,
                                                                             dcv5 );
        CellValue< ? extends Comparable< ? >> cell6 = factory.makeCellValue( c4,
                                                                             0,
                                                                             4,
                                                                             dcv6 );
        CellValue< ? extends Comparable< ? >> cell7 = factory.makeCellValue( a1,
                                                                             0,
                                                                             5,
                                                                             dcv7 );
        CellValue< ? extends Comparable< ? >> cell8 = factory.makeCellValue( a2,
                                                                             0,
                                                                             6,
                                                                             dcv8 );

        assertEquals( cell1.getValue(),
                      null );
        assertEquals( cell2.getValue(),
                      Boolean.FALSE );
        assertEquals( cell3.getValue(),
                      null );
        assertEquals( cell4.getValue(),
                      null );
        assertEquals( cell5.getValue(),
                      null );
        assertEquals( cell6.getValue(),
                      Boolean.FALSE );
        assertEquals( cell7.getValue(),
                      null );
        assertEquals( cell8.getValue(),
                      null );

        assertEquals( dcv1.getDataType(),
                      DTDataTypes.NUMERIC );
        assertEquals( dcv2.getDataType(),
                      DTDataTypes.BOOLEAN );
        assertEquals( dcv3.getDataType(),
                      DTDataTypes.STRING );
        assertEquals( dcv4.getDataType(),
                      DTDataTypes.NUMERIC );
        assertEquals( dcv5.getDataType(),
                      DTDataTypes.DATE );
        assertEquals( dcv6.getDataType(),
                      DTDataTypes.BOOLEAN );
        assertEquals( dcv7.getDataType(),
                      DTDataTypes.STRING );
        assertEquals( dcv8.getDataType(),
                      DTDataTypes.STRING );

    }
View Full Code Here

        BigDecimal newRowNum = row.get(0).getNumericValue();
        BigDecimal oldRowNum = new BigDecimal(array[0]);
        assertEquals( newRowNum, oldRowNum );
       
        for ( int iCol = 1; iCol < row.size(); iCol++ ) {
            DTCellValue cell = row.get( iCol );
            String v1 = cell.getStringValue();
            String v2 = array[iCol];
            assertTrue( isEqualOrNull( v1,
                                       v2 ) );
            assertEquals( v1,
                          v2 );
View Full Code Here

        BigDecimal newRowNum = row.get(0).getNumericValue();
        BigDecimal oldRowNum = new BigDecimal(array[0]);
        assertEquals( newRowNum, oldRowNum );
       
        for ( int iCol = 1; iCol < row.size(); iCol++ ) {
            DTCellValue cell = row.get( iCol );
            String v1 = cell.getStringValue();
            String v2 = array[iCol];
            assertTrue( isEqualOrNull( v1,
                                       v2 ) );
            assertEquals( v1,
                          v2 );
View Full Code Here

        for ( int i = 0; i < conditionCols.size(); i++ ) {

            ConditionCol c = (ConditionCol) conditionCols.get( i );
            int index = allColumns.indexOf( c );

            DTCellValue dcv = row.get( index );
            String cell = GuidedDTDRLOtherwiseHelper.convertDTCellValueToString( dcv );
            boolean isOtherwise = dcv.isOtherwise();
            boolean isValid = isOtherwise;

            //Otherwise values are automatically valid as they're constructed from the other rules
            if ( !isOtherwise ) {
                isValid = validCell( cell );
View Full Code Here

     * @return New row
     */
    public static List<DTCellValue> makeDataRowList(String[] oldRow) {
        List<DTCellValue> row = new ArrayList<DTCellValue>();

        DTCellValue rowDcv = new DTCellValue( new BigDecimal( oldRow[0] ) );
        row.add( rowDcv );

        for ( int iCol = 1; iCol < oldRow.length; iCol++ ) {

            //The original model was purely String based. Conversion to typed fields
            //occurs when the Model is re-saved in Guvnor. Ideally the conversion
            //should occur here but that requires reference to a SuggestionCompletionEngine
            //which requires RepositoryServices. I did not want to make a dependency between
            //common IDE classes and the Repository
            DTCellValue dcv = new DTCellValue( oldRow[iCol] );
            row.add( dcv );
        }
        return row;
    }
View Full Code Here

TOP

Related Classes of org.drools.ide.common.client.modeldriven.dt.DTCellValue

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.