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

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


    public List<DTCellValue52> makeDataRowList(Object[] oldRow) {
        List<DTCellValue52> row = new ArrayList<DTCellValue52>();

        //Row numbers are numerical
        if ( oldRow[0] instanceof String ) {
            DTCellValue52 rowDcv = new DTCellValue52( new BigDecimal( (String) oldRow[0] ) );
            row.add( rowDcv );
        } else if ( oldRow[0] instanceof Long ) {
            DTCellValue52 rowDcv = new DTCellValue52( new BigDecimal( (Long) oldRow[0] ) );
            row.add( rowDcv );
        } else {
            DTCellValue52 rowDcv = new DTCellValue52( 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
            DTCellValue52 dcv = new DTCellValue52( oldRow[iCol] );
            row.add( dcv );
        }
        return row;
    }
View Full Code Here


                          rm );

            } else {

                int index = allColumns.indexOf( c );
                DTCellValue52 dcv = row.get( index );
                String cell = "";

                if ( c instanceof LimitedEntryCol ) {
                    if ( dcv.getBooleanValue() == true ) {
                        LimitedEntryCol lec = (LimitedEntryCol) c;
                        cell = GuidedDTDRLUtilities.convertDTCellValueToString( lec.getValue() );
                    }
                } else {
                    cell = GuidedDTDRLUtilities.convertDTCellValueToString( dcv );
View Full Code Here

            boolean addAction = true;

            if ( column instanceof LimitedEntryCol ) {
                int index = allColumns.indexOf( column );
                DTCellValue52 dcv = row.get( index );
                addAction = dcv.getBooleanValue();

            } else {

                //Get interpolation variables used by the Action
                Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>();
View Full Code Here

            boolean addPattern = true;

            if ( column instanceof LimitedEntryCol ) {
                int index = allColumns.indexOf( column );
                DTCellValue52 dcv = row.get( index );
                addPattern = dcv.getBooleanValue();

            } else {

                //Get interpolation variables used by the Pattern
                Map<InterpolationVariable, Integer> ivs = new HashMap<InterpolationVariable, Integer>();
View Full Code Here

        for ( ConditionCol52 c : cols ) {

            int index = allColumns.indexOf( c );

            DTCellValue52 dcv = row.get( index );
            String cell = "";

            if ( c instanceof LimitedEntryCol ) {
                if ( dcv.getBooleanValue() == true ) {
                    LimitedEntryCol lec = (LimitedEntryCol) c;
                    DTCellValue52 value = lec.getValue();
                    if ( value != null ) {
                        cell = GuidedDTDRLUtilities.convertDTCellValueToString( value );
                    }
                }
            } else {
View Full Code Here

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

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

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

    }
View Full Code Here

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

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

        CellValue< ? extends Comparable< ? >> cell1 = factory.makeCellValue( at1,
                                                                             0,
                                                                             0,
                                                                             dcv1 );
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( "01-JAN-2000" );
        DTCellValue52 dcv6 = new DTCellValue52( "true" );
        DTCellValue52 dcv7 = new DTCellValue52( "Mike" );
        DTCellValue52 dcv8 = new DTCellValue52( "Mike" );

        CellValue< ? extends Comparable< ? >> cell1 = factory.makeCellValue( at1,
                                                                             0,
                                                                             0,
                                                                             dcv1 );
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( "" );

        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(),
                      DTDataTypes52.NUMERIC );
        assertEquals( dcv2.getDataType(),
                      DTDataTypes52.BOOLEAN );
        assertEquals( dcv3.getDataType(),
                      DTDataTypes52.STRING );
        assertEquals( dcv4.getDataType(),
                      DTDataTypes52.NUMERIC );
        assertEquals( dcv5.getDataType(),
                      DTDataTypes52.DATE );
        assertEquals( dcv6.getDataType(),
                      DTDataTypes52.BOOLEAN );
        assertEquals( dcv7.getDataType(),
                      DTDataTypes52.STRING );
        assertEquals( dcv8.getDataType(),
                      DTDataTypes52.STRING );

    }
View Full Code Here

        // works. I wouldn't be too surprised if this changes at some time, but
        // GuidedDTDRLPersistence.marshal does not support empty patterns at
        // present.
        LimitedEntryConditionCol52 cc1 = new LimitedEntryConditionCol52();
        cc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        cc1.setValue( new DTCellValue52( "y" ) );
        p1.getChildColumns().add( cc1 );

        dt.setData( upgrader.makeDataLists( new Object[][]{
                                                           new Object[]{1l, "desc", true},
                                                           new Object[]{2l, "desc", 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.