Package org.drools.workbench.models.guided.dtable.backend.util

Examples of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider


        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        TemplateDataProvider rowDataProvider0 = new GuidedDTTemplateDataProvider( allColumns,
                                                                                  rowDTModel0 );

        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider0,
                        rowDTModel0,
                        DataUtilities.makeDataLists( data ),
                        rm );
        String drl0 = RuleModelDRLPersistenceImpl.getInstance().marshal( rm );

        assertEquals( 2,
                      rm.lhs.length );
        assertEquals( "Person",
                      ( (FactPattern) rm.lhs[ 0 ] ).getFactType() );
        assertEquals( "p1",
                      ( (FactPattern) rm.lhs[ 0 ] ).getBoundName() );

        assertEquals( "Person",
                      ( (FactPattern) rm.lhs[ 1 ] ).getFactType() );
        assertEquals( "p2",
                      ( (FactPattern) rm.lhs[ 1 ] ).getBoundName() );
        assertTrue( drl0.indexOf( "p1 : Person( name == \"Michael1\" )" ) > 0 );
        assertTrue( drl0.indexOf( "p2 : Person( name != \"Michael1\" )" ) > 0 );

        TemplateDataProvider rowDataProvider1 = new GuidedDTTemplateDataProvider( allColumns,
                                                                                  rowDTModel1 );

        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider1,
                        rowDTModel1,
                        DataUtilities.makeDataLists( data ),
                        rm );
        String drl1 = RuleModelDRLPersistenceImpl.getInstance().marshal( rm );

        assertEquals( 2,
                      rm.lhs.length );
        assertEquals( "Person",
                      ( (FactPattern) rm.lhs[ 0 ] ).getFactType() );
        assertEquals( "p1",
                      ( (FactPattern) rm.lhs[ 0 ] ).getBoundName() );

        assertEquals( "Person",
                      ( (FactPattern) rm.lhs[ 1 ] ).getFactType() );
        assertEquals( "p2",
                      ( (FactPattern) rm.lhs[ 1 ] ).getBoundName() );
        assertTrue( drl1.indexOf( "p1 : Person( name == \"Michael2\" )" ) > 0 );
        assertTrue( drl1.indexOf( "p2 : Person( name != \"Michael2\" )" ) > 0 );

        TemplateDataProvider rowDataProvider2 = new GuidedDTTemplateDataProvider( allColumns,
                                                                                  rowDTModel2 );

        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider2,
View Full Code Here


        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        //When using a TemplateDataProvider the assumption is that we
        //have a "complete" decision table including AnalysisCol52
        allColumns.add( new AnalysisCol52() );

        List<DTCellValue52> rowData = DataUtilities.makeDataRowList( row );
        TemplateDataProvider rowDataProvider = new GuidedDTTemplateDataProvider( allColumns,
                                                                                 rowData );

        p.doActions( allColumns,
                     cols,
                     rowDataProvider,
View Full Code Here

        List<CompositeColumn<? extends BaseColumn>> allPatterns = dtable.getConditions();
        List<List<DTCellValue52>> dtData = DataUtilities.makeDataLists( data );

        //Row 0
        List<DTCellValue52> dtRowData0 = DataUtilities.makeDataRowList( data[ 0 ] );
        TemplateDataProvider rowDataProvider0 = new GuidedDTTemplateDataProvider( allColumns,
                                                                                  dtRowData0 );
        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider0,
                        dtRowData0,
                        dtData,
                        rm );

        assertEquals( 2,
                      rm.lhs.length );
        assertEquals( "Baddie",
                      ( (FactPattern) rm.lhs[ 0 ] ).getFactType() );
        assertEquals( "Smurf",
                      ( (FactPattern) rm.lhs[ 1 ] ).getFactType() );

        // examine the first pattern
        FactPattern result0Fp1 = (FactPattern) rm.lhs[ 0 ];
        assertEquals( 1,
                      result0Fp1.getConstraintList().getConstraints().length );

        SingleFieldConstraint result0Fp1Con1 = (SingleFieldConstraint) result0Fp1.getConstraint( 0 );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      result0Fp1Con1.getConstraintValueType() );
        assertEquals( "name",
                      result0Fp1Con1.getFieldName() );
        assertEquals( "==",
                      result0Fp1Con1.getOperator() );
        assertEquals( "Gargamel",
                      result0Fp1Con1.getValue() );

        // examine the second pattern
        FactPattern result0Fp2 = (FactPattern) rm.lhs[ 1 ];
        assertEquals( 2,
                      result0Fp2.getConstraintList().getConstraints().length );

        SingleFieldConstraint result0Fp2Con1 = (SingleFieldConstraint) result0Fp2.getConstraint( 0 );
        assertEquals( BaseSingleFieldConstraint.TYPE_TEMPLATE,
                      result0Fp2Con1.getConstraintValueType() );
        assertEquals( "name",
                      result0Fp2Con1.getFieldName() );
        assertEquals( "==",
                      result0Fp2Con1.getOperator() );
        assertEquals( "$name",
                      result0Fp2Con1.getValue() );

        SingleFieldConstraint result0Fp2Con2 = (SingleFieldConstraint) result0Fp2.getConstraint( 1 );
        assertEquals( BaseSingleFieldConstraint.TYPE_TEMPLATE,
                      result0Fp2Con2.getConstraintValueType() );
        assertEquals( "age",
                      result0Fp2Con2.getFieldName() );
        assertEquals( "==",
                      result0Fp2Con2.getOperator() );
        assertEquals( "$age",
                      result0Fp2Con2.getValue() );

        //Row 1
        List<DTCellValue52> dtRowData1 = DataUtilities.makeDataRowList( data[ 1 ] );
        TemplateDataProvider rowDataProvider1 = new GuidedDTTemplateDataProvider( allColumns,
                                                                                  dtRowData1 );
        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider1,
                        dtRowData1,
                        dtData,
                        rm );

        assertEquals( 2,
                      rm.lhs.length );
        assertEquals( "Baddie",
                      ( (FactPattern) rm.lhs[ 0 ] ).getFactType() );

        // examine the first pattern
        FactPattern result1Fp1 = (FactPattern) rm.lhs[ 0 ];
        assertEquals( 1,
                      result1Fp1.getConstraintList().getConstraints().length );

        SingleFieldConstraint result1Fp1Con1 = (SingleFieldConstraint) result1Fp1.getConstraint( 0 );
        assertEquals( BaseSingleFieldConstraint.TYPE_LITERAL,
                      result1Fp1Con1.getConstraintValueType() );
        assertEquals( "name",
                      result1Fp1Con1.getFieldName() );
        assertEquals( "==",
                      result1Fp1Con1.getOperator() );
        assertEquals( "Gargamel",
                      result1Fp1Con1.getValue() );

        // examine the second pattern
        FactPattern result1Fp2 = (FactPattern) rm.lhs[ 1 ];
        assertEquals( 2,
                      result0Fp2.getConstraintList().getConstraints().length );

        SingleFieldConstraint result1Fp2Con1 = (SingleFieldConstraint) result0Fp2.getConstraint( 0 );
        assertEquals( BaseSingleFieldConstraint.TYPE_TEMPLATE,
                      result1Fp2Con1.getConstraintValueType() );
        assertEquals( "name",
                      result1Fp2Con1.getFieldName() );
        assertEquals( "==",
                      result1Fp2Con1.getOperator() );
        assertEquals( "$name",
                      result1Fp2Con1.getValue() );

        SingleFieldConstraint result1Fp2Con2 = (SingleFieldConstraint) result0Fp2.getConstraint( 1 );
        assertEquals( BaseSingleFieldConstraint.TYPE_TEMPLATE,
                      result1Fp2Con2.getConstraintValueType() );
        assertEquals( "age",
                      result1Fp2Con2.getFieldName() );
        assertEquals( "==",
                      result1Fp2Con2.getOperator() );
        assertEquals( "$age",
                      result1Fp2Con2.getValue() );

        //Row 2
        List<DTCellValue52> dtRowData2 = DataUtilities.makeDataRowList( data[ 2 ] );
        TemplateDataProvider rowDataProvider2 = new GuidedDTTemplateDataProvider( allColumns,
                                                                                  dtRowData2 );
        p.doConditions( allColumns,
                        allPatterns,
                        rowDataProvider2,
                        dtRowData2,
View Full Code Here

TOP

Related Classes of org.drools.workbench.models.guided.dtable.backend.util.GuidedDTTemplateDataProvider

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.