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

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


        assertFalse( index > -1 );
    }

    @Test
    public void testLimitedEntryLHSIsNotNullOperator() {
        GuidedDecisionTable52 dt = new GuidedDecisionTable52();
        dt.setTableFormat( TableFormat.LIMITED_ENTRY );
        dt.setTableName( "limited-entry" );

        Pattern52 p1 = new Pattern52();
        p1.setBoundName( "p1" );
        p1.setFactType( "Smurf" );
        dt.getConditions().add( p1 );

        LimitedEntryConditionCol52 cc1 = new LimitedEntryConditionCol52();
        cc1.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        cc1.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        cc1.setFactField( "name" );
        cc1.setOperator( "!= null" );
        p1.getChildColumns().add( cc1 );

        LimitedEntryConditionCol52 cc2 = new LimitedEntryConditionCol52();
        cc2.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        cc2.setFieldType( SuggestionCompletionEngine.TYPE_NUMERIC );
        cc2.setFactField( "age" );
        cc2.setOperator( "!= null" );
        p1.getChildColumns().add( cc2 );

        LimitedEntryConditionCol52 cc3 = new LimitedEntryConditionCol52();
        cc3.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        cc3.setFieldType( SuggestionCompletionEngine.TYPE_DATE );
        cc3.setFactField( "dateOfBirth" );
        cc3.setOperator( "!= null" );
        p1.getChildColumns().add( cc3 );

        dt.setData( upgrader.makeDataLists( new Object[][]{
                                                           new Object[]{1l, "desc", true, true, true},
                                                           new Object[]{2l, "desc", false, false, false}
                                                           } ) );

        GuidedDTDRLPersistence p = GuidedDTDRLPersistence.getInstance();
View Full Code Here


                                     format );

        //Set the Table Format and check-in
        //TODO Is it possible to alter the content and save without checking-in?
        Asset asset = repositoryAssetService.loadRuleAsset( uuid );
        GuidedDecisionTable52 content = (GuidedDecisionTable52) asset.getContent();
        content.setTableFormat( configuration.getTableFormat() );
        asset.setCheckinComment( "Table Format automatically set to [" + configuration.getTableFormat().toString() + "]" );
        repositoryAssetService.checkinVersion( asset );

        return uuid;
    }
View Full Code Here

        rule1.updateFormat( AssetFormats.DRL );
        rule1.updateContent( "rule 'rule1' \n when \np : Person() \n then \np.setAge(42); \n end" );
        rule1.checkin( "" );
        repo.save();

        GuidedDecisionTable52 dt = new GuidedDecisionTable52();

        Pattern52 p1 = new Pattern52();
        p1.setBoundName( "p" );
        p1.setFactType( "Person" );

        ConditionCol52 col = new ConditionCol52();
        col.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        col.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        col.setFactField( "hair" );
        col.setOperator( "==" );
        p1.getConditions().add( col );

        dt.getConditionPatterns().add( p1 );

        ActionSetFieldCol52 ac = new ActionSetFieldCol52();
        ac.setBoundName( "p" );
        ac.setFactField( "likes" );
        ac.setType( SuggestionCompletionEngine.TYPE_STRING );
        dt.getActionCols().add( ac );

        dt.setData( RepositoryUpgradeHelper.makeDataLists( new String[][]{new String[]{"1", "descrip", "pink", "cheese"}} ) );

        String uid = impl.createNewRule( "decTable",
                                         "",
                                         "decisiontables",
                                         pkg.getName(),
View Full Code Here

                                       "desc" );
        repositoryCategoryService.createCategory( "",
                                                  "testCreateNewGuidedDecisionTableUsingConfiguration",
                                                  "this is a cat" );

        final GuidedDecisionTable52 content = new GuidedDecisionTable52();
        content.setTableFormat( TableFormat.LIMITED_ENTRY );

        NewGuidedDecisionTableAssetConfiguration config = new NewGuidedDecisionTableAssetConfiguration( "testCreateNewGuidedDecisionTableUsingConfigurationName",
                                                                                                        "testCreateNewGuidedDecisionTableUsingConfiguration",
                                                                                                        null,
                                                                                                        "an initial desc",
                                                                                                        "testCreateNewGuidedDecisionTableUsingConfiguration",
                                                                                                        AssetFormats.DECISION_TABLE_GUIDED,
                                                                                                        content );

        String uuid = serviceImplementation.createNewRule( config );
        assertNotNull( uuid );
        assertFalse( "".equals( uuid ) );

        AssetItem dtItem = rulesRepository.loadAssetByUUID( uuid );
        assertEquals( dtItem.getDescription(),
                      "an initial desc" );

        Asset asset = this.repositoryAssetService.loadRuleAsset( uuid );
        GuidedDecisionTable52 retrievedContent = (GuidedDecisionTable52) asset.getContent();

        assertNotNull( retrievedContent );
        assertEquals( TableFormat.LIMITED_ENTRY,
                      retrievedContent.getTableFormat() );

    }
View Full Code Here

        rule1.updateFormat( AssetFormats.DRL );
        rule1.updateContent( "rule 'rule1' \n when \np : Person() \n then \np.setAge(42); \n end" );
        rule1.checkin( "" );
        rulesRepository.save();

        GuidedDecisionTable52 dt = new GuidedDecisionTable52();

        Pattern52 p1 = new Pattern52();
        p1.setBoundName( "p" );
        p1.setFactType( "Person" );

        ConditionCol52 col = new ConditionCol52();
        col.setConstraintValueType( BaseSingleFieldConstraint.TYPE_LITERAL );
        col.setFieldType( SuggestionCompletionEngine.TYPE_STRING );
        col.setFactField( "hair" );
        col.setOperator( "==" );
        p1.getChildColumns().add( col );

        dt.getConditions().add( p1 );

        ActionSetFieldCol52 ac = new ActionSetFieldCol52();
        ac.setBoundName( "p" );
        ac.setFactField( "likes" );
        ac.setType( SuggestionCompletionEngine.TYPE_STRING );
        dt.getActionCols().add( ac );

        dt.setData( upgrader.makeDataLists( new String[][]{new String[]{"1", "descrip", "pink", "cheese"}} ) );

        String uid = serviceImplementation.createNewRule( "decTable",
                                                          "",
                                                          "testGuidedDTExecuteCategory",
                                                          pkg.getName(),
View Full Code Here

        //Command to invoke wizard, if asset does not already exist
        final Command cmdInvokeWizard = new Command() {

            public void execute() {
                final GuidedDecisionTable52 content = new GuidedDecisionTable52();
                content.setTableFormat( guidedDecisionTableOptions.getTableFormat() );
                final NewGuidedDecisionTableAssetConfiguration config = new NewGuidedDecisionTableAssetConfiguration( assetName,
                                                                                                                packageName,
                                                                                                                packageUUID,
                                                                                                                description,
                                                                                                                initialCategory,
View Full Code Here

                                                       final String packageUUID,
                                                       final String description,
                                                       final String initialCategory,
                                                       final String format) {

        final GuidedDecisionTable52 content = new GuidedDecisionTable52();
        content.setTableFormat( guidedDecisionTableOptions.getTableFormat() );
        final NewGuidedDecisionTableAssetConfiguration config = new NewGuidedDecisionTableAssetConfiguration( assetName,
                                                                                                              packageName,
                                                                                                              packageUUID,
                                                                                                              description,
                                                                                                              initialCategory,
View Full Code Here

        assertNotNull( dtables );
        assertEquals( 1,
                      dtables.size() );

        GuidedDecisionTable52 dtable = dtables.get( 0 );

        assertEquals( "AttributesTest",
                      dtable.getTableName() );
        assertEquals( GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY,
                      dtable.getTableFormat() );

        //Check expanded columns
        List<BaseColumn> columns = dtable.getExpandedColumns();
        assertNotNull( columns );
        assertEquals( 13,
                      columns.size() );
        assertTrue( columns.get( 0 ) instanceof RowNumberCol52 );
        assertTrue( columns.get( 1 ) instanceof DescriptionCol52 );
        assertTrue( columns.get( 2 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 3 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 4 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 5 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 6 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 7 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 8 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 9 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 10 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 11 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 12 ) instanceof AnalysisCol52 );

        //Check individual attributes
        AttributeCol52 attrCol2 = ((AttributeCol52) columns.get( 2 ));
        assertEquals( GuidedDecisionTable52.SALIENCE_ATTR,
                      attrCol2.getAttribute() );
        assertFalse( attrCol2.isUseRowNumber() );
        assertFalse( attrCol2.isReverseOrder() );

        AttributeCol52 attrCol3 = ((AttributeCol52) columns.get( 3 ));
        assertEquals( GuidedDecisionTable52.ACTIVATION_GROUP_ATTR,
                      attrCol3.getAttribute() );

        AttributeCol52 attrCol4 = ((AttributeCol52) columns.get( 4 ));
        assertEquals( GuidedDecisionTable52.DURATION_ATTR,
                      attrCol4.getAttribute() );

        AttributeCol52 attrCol5 = ((AttributeCol52) columns.get( 5 ));
        assertEquals( GuidedDecisionTable52.TIMER_ATTR,
                      attrCol5.getAttribute() );

        AttributeCol52 attrCol6 = ((AttributeCol52) columns.get( 6 ));
        assertEquals( GuidedDecisionTable52.CALENDARS_ATTR,
                      attrCol6.getAttribute() );

        AttributeCol52 attrCol7 = ((AttributeCol52) columns.get( 7 ));
        assertEquals( GuidedDecisionTable52.NO_LOOP_ATTR,
                      attrCol7.getAttribute() );

        AttributeCol52 attrCol8 = ((AttributeCol52) columns.get( 8 ));
        assertEquals( GuidedDecisionTable52.LOCK_ON_ACTIVE_ATTR,
                      attrCol8.getAttribute() );

        AttributeCol52 attrCol9 = ((AttributeCol52) columns.get( 9 ));
        assertEquals( GuidedDecisionTable52.AUTO_FOCUS_ATTR,
                      attrCol9.getAttribute() );

        AttributeCol52 attrCol10 = ((AttributeCol52) columns.get( 10 ));
        assertEquals( GuidedDecisionTable52.AGENDA_GROUP_ATTR,
                      attrCol10.getAttribute() );

        AttributeCol52 attrCol11 = ((AttributeCol52) columns.get( 11 ));
        assertEquals( GuidedDecisionTable52.RULEFLOW_GROUP_ATTR,
                      attrCol11.getAttribute() );

        //Check data
        assertEquals( 2,
                      dtable.getData().size() );
        assertTrue( isRowEquivalent( new String[]{"1", "Specific rule 1", "1", "g1", "100", "T1", "CAL1", "TRUE", "TRUE", "TRUE", "AG1", "RFG1"},
                                     dtable.getData().get( 0 ) ) );
        assertTrue( isRowEquivalent( new String[]{"2", "Specific rule 2", "2", "g2", "200", "T2", "CAL2", "FALSE", "FALSE", "FALSE", "AG2", "RFG2"},
                                     dtable.getData().get( 1 ) ) );
    }
View Full Code Here

        assertNotNull( dtables );
        assertEquals( 1,
                      dtables.size() );

        GuidedDecisionTable52 dtable = dtables.get( 0 );

        assertEquals( "SequentialSalienceTest",
                      dtable.getTableName() );
        assertEquals( GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY,
                      dtable.getTableFormat() );

        //Check expanded columns
        List<BaseColumn> columns = dtable.getExpandedColumns();
        assertNotNull( columns );
        assertEquals( 4,
                      columns.size() );
        assertTrue( columns.get( 0 ) instanceof RowNumberCol52 );
        assertTrue( columns.get( 1 ) instanceof DescriptionCol52 );
        assertTrue( columns.get( 2 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 3 ) instanceof AnalysisCol52 );

        //Check attribute column
        AttributeCol52 attrCol2 = ((AttributeCol52) columns.get( 2 ));
        assertEquals( GuidedDecisionTable52.SALIENCE_ATTR,
                      attrCol2.getAttribute() );
        assertTrue( attrCol2.isUseRowNumber() );
        assertTrue( attrCol2.isReverseOrder() );

        //Check data
        assertEquals( 2,
                      dtable.getData().size() );
        assertTrue( isRowEquivalent( new String[]{"1", "Created from row 8", "2"},
                                     dtable.getData().get( 0 ) ) );
        assertTrue( isRowEquivalent( new String[]{"2", "Created from row 9", "1"},
                                     dtable.getData().get( 1 ) ) );
    }
View Full Code Here

        assertNotNull( dtables );
        assertEquals( 1,
                      dtables.size() );

        GuidedDecisionTable52 dtable = dtables.get( 0 );

        assertEquals( "SalienceWarningsTest",
                      dtable.getTableName() );
        assertEquals( GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY,
                      dtable.getTableFormat() );

        //Check expanded columns
        List<BaseColumn> columns = dtable.getExpandedColumns();
        assertNotNull( columns );
        assertEquals( 4,
                      columns.size() );
        assertTrue( columns.get( 0 ) instanceof RowNumberCol52 );
        assertTrue( columns.get( 1 ) instanceof DescriptionCol52 );
        assertTrue( columns.get( 2 ) instanceof AttributeCol52 );
        assertTrue( columns.get( 3 ) instanceof AnalysisCol52 );

        //Check attribute column
        AttributeCol52 attrCol2 = ((AttributeCol52) columns.get( 2 ));
        assertEquals( GuidedDecisionTable52.SALIENCE_ATTR,
                      attrCol2.getAttribute() );
        assertFalse( attrCol2.isUseRowNumber() );
        assertFalse( attrCol2.isReverseOrder() );

        //Check data
        assertEquals( 2,
                      dtable.getData().size() );
        assertTrue( isRowEquivalent( new String[]{"1", "Created from row 7", ""},
                                     dtable.getData().get( 0 ) ) );
        assertTrue( isRowEquivalent( new String[]{"2", "Created from row 8", ""},
                                     dtable.getData().get( 1 ) ) );
    }
View Full Code Here

TOP

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

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.