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

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


    @Test
    public void testImpossibleMatchesString() throws ParseException {
        SuggestionCompletionEngine sce = buildSuggestionCompletionEngine();

        GuidedDecisionTable52 dt = new GuidedDecisionTable52();

        Pattern52 driverPattern = new Pattern52();
        driverPattern.setBoundName("driverPattern");
        driverPattern.setFactType("Driver");

        ConditionCol52 name = new ConditionCol52();
        name.setFactField("name");
        name.setOperator("==");
        name.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(name);

        ConditionCol52 notName = new ConditionCol52();
        notName.setFactField("name");
        notName.setOperator("!=");
        notName.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(notName);

        ConditionCol52 nameIn = new ConditionCol52();
        nameIn.setFactField("name");
        nameIn.setOperator("in");
        nameIn.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(nameIn);

        dt.getConditions().add(driverPattern);

        ActionSetFieldCol52 message = new ActionSetFieldCol52();
        message.setBoundName("m");
        message.setFactField("message");
        dt.getActionCols().add(message);

        @SuppressWarnings("unchecked")
        List<List<DTCellValue52>> data = Arrays.asList(
                Arrays.asList(
                        new DTCellValue52(1),
                        new DTCellValue52("Row 1 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52("Bart"),
                        new DTCellValue52((String) null),
                        new DTCellValue52("Row 1 message")
                ),
                Arrays.asList(
                        new DTCellValue52(2),
                        new DTCellValue52("Row 2 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52((String) null),
                        new DTCellValue52("Row 2 message")
                ),
                Arrays.asList(
                        new DTCellValue52(3),
                        new DTCellValue52("Row 3 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52((String) null),
                        new DTCellValue52((String) null),
                        new DTCellValue52("Row 3 message")
                ),
                Arrays.asList(
                        new DTCellValue52(4),
                        new DTCellValue52("Row 4 description"),
                        new DTCellValue52((String) null),
                        new DTCellValue52("Bart"),
                        new DTCellValue52((String) null),
                        new DTCellValue52("Row 4 message")
                ),
                Arrays.asList(
                        new DTCellValue52(5),
                        new DTCellValue52("Row 5 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52((String) null),
                        new DTCellValue52("Marge,Lisa"),
                        new DTCellValue52("Row 5 message")
                )
        );

        dt.setData(data);

        DecisionTableAnalyzer analyzer = new DecisionTableAnalyzer(sce);
        List<Analysis> analysisData = analyzer.analyze(dt);

        assertEquals(data.size(), analysisData.size());
View Full Code Here


    @Test
    public void testImpossibleMatchesDate() throws ParseException {
        SuggestionCompletionEngine sce = buildSuggestionCompletionEngine();
        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");

        GuidedDecisionTable52 dt = new GuidedDecisionTable52();

        Pattern52 driverPattern = new Pattern52();
        driverPattern.setBoundName("driverPattern");
        driverPattern.setFactType("Driver");

        ConditionCol52 dateOfBirthMinimum = new ConditionCol52();
        dateOfBirthMinimum.setFactField("dateOfBirth");
        dateOfBirthMinimum.setOperator(">=");
        dateOfBirthMinimum.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(dateOfBirthMinimum);

        ConditionCol52 dateOfBirthMaximum = new ConditionCol52();
        dateOfBirthMaximum.setFactField("dateOfBirth");
        dateOfBirthMaximum.setOperator("<=");
        dateOfBirthMaximum.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(dateOfBirthMaximum);

        dt.getConditions().add(driverPattern);

        ActionSetFieldCol52 message = new ActionSetFieldCol52();
        message.setBoundName("m");
        message.setFactField("message");
        dt.getActionCols().add(message);

        @SuppressWarnings("unchecked")
        List<List<DTCellValue52>> data = Arrays.asList(
                Arrays.asList(
                        new DTCellValue52(1),
                        new DTCellValue52("Row 1 description"),
                        new DTCellValue52(dateFormat.parse("1981-01-01")),
                        new DTCellValue52(dateFormat.parse("2001-01-01")),
                        new DTCellValue52("Row 1 message")
                ),
                Arrays.asList(
                        new DTCellValue52(2),
                        new DTCellValue52("Row 2 description"),
                        new DTCellValue52(dateFormat.parse("2001-01-01")),
                        new DTCellValue52(dateFormat.parse("1981-01-01")),
                        new DTCellValue52("Row 2 message")
                ),
                Arrays.asList(
                        new DTCellValue52(3),
                        new DTCellValue52("Row 3 description"),
                        new DTCellValue52((Date) null),
                        new DTCellValue52(dateFormat.parse("2001-01-01")),
                        new DTCellValue52("Row 3 message")
                ),
                Arrays.asList(
                        new DTCellValue52(4),
                        new DTCellValue52("Row 4 description"),
                        new DTCellValue52(dateFormat.parse("1981-01-01")),
                        new DTCellValue52((Date) null),
                        new DTCellValue52("Row 4 message")
                )
        );

        dt.setData(data);
       
        DecisionTableAnalyzer analyzer = new DecisionTableAnalyzer(sce);
        List<Analysis> analysisData = analyzer.analyze(dt);

        assertEquals(data.size(), analysisData.size());
View Full Code Here

    @Test
    public void testImpossibleMatchesCombination() throws ParseException {
        SuggestionCompletionEngine sce = buildSuggestionCompletionEngine();

        GuidedDecisionTable52 dt = new GuidedDecisionTable52();

        Pattern52 driverPattern = new Pattern52();
        driverPattern.setBoundName("driverPattern");
        driverPattern.setFactType("Driver");

        ConditionCol52 name = new ConditionCol52();
        name.setFactField("name");
        name.setOperator("==");
        name.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(name);

        ConditionCol52 ageMinimum = new ConditionCol52();
        ageMinimum.setFactField("age");
        ageMinimum.setOperator(">=");
        ageMinimum.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(ageMinimum);

        ConditionCol52 ageMaximum = new ConditionCol52();
        ageMaximum.setFactField("age");
        ageMaximum.setOperator("<=");
        ageMaximum.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(ageMaximum);

        dt.getConditions().add(driverPattern);

        ActionSetFieldCol52 message = new ActionSetFieldCol52();
        message.setBoundName("m");
        message.setFactField("message");
        dt.getActionCols().add(message);

        @SuppressWarnings("unchecked")
        List<List<DTCellValue52>> data = Arrays.asList(
                Arrays.asList(
                        new DTCellValue52(1),
                        new DTCellValue52("Row 1 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52(new Integer("20")),
                        new DTCellValue52(new Integer("50")),
                        new DTCellValue52("Row 1 message")
                ),
                Arrays.asList(
                        new DTCellValue52(2),
                        new DTCellValue52("Row 2 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52(new Integer("40")),
                        new DTCellValue52(new Integer("30")),
                        new DTCellValue52("Row 2 message")
                ),
                Arrays.asList(
                        new DTCellValue52(3),
                        new DTCellValue52("Row 3 description"),
                        new DTCellValue52((String) null),
                        new DTCellValue52(new Integer("40")),
                        new DTCellValue52(new Integer("30")),
                        new DTCellValue52("Row 3 message")
                ),
                Arrays.asList(
                        new DTCellValue52(4),
                        new DTCellValue52("Row 4 description"),
                        new DTCellValue52("Homer"),
                        new DTCellValue52(new Integer("20")),
                        new DTCellValue52((Integer) null),
                        new DTCellValue52("Row 4 message")
                ),
                Arrays.asList(
                        new DTCellValue52(5),
                        new DTCellValue52("Row 5 description"),
                        new DTCellValue52((String) null),
                        new DTCellValue52((Integer) null),
                        new DTCellValue52((Integer) null),
                        new DTCellValue52("Row 5 message")
                )
        );

        dt.setData(data);

        DecisionTableAnalyzer analyzer = new DecisionTableAnalyzer(sce);
        List<Analysis> analysisData = analyzer.analyze(dt);

        assertEquals(data.size(), analysisData.size());
View Full Code Here

    @Test
    public void testImpossibleMatchesLimitedEntry() throws ParseException {
        SuggestionCompletionEngine sce = buildSuggestionCompletionEngine();

        GuidedDecisionTable52 dt = new GuidedDecisionTable52();

        Pattern52 driverPattern = new Pattern52();
        driverPattern.setBoundName("driverPattern");
        driverPattern.setFactType("Driver");

        LimitedEntryConditionCol52 child = new LimitedEntryConditionCol52();
        child.setFactField("age");
        child.setOperator("<");
        child.setValue(new DTCellValue52(new Integer("18")));
        child.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(child);

        LimitedEntryConditionCol52 pensioner = new LimitedEntryConditionCol52();
        pensioner.setFactField("age");
        pensioner.setOperator(">=");
        pensioner.setValue(new DTCellValue52(new Integer("65")));
        pensioner.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
        driverPattern.getChildColumns().add(pensioner);

        dt.getConditions().add(driverPattern);

        ActionSetFieldCol52 message = new ActionSetFieldCol52();
        message.setBoundName("m");
        message.setFactField("message");
        dt.getActionCols().add(message);

        @SuppressWarnings("unchecked")
        List<List<DTCellValue52>> data = Arrays.asList(
                Arrays.asList(
                        new DTCellValue52(1),
                        new DTCellValue52("Row 1 description"),
                        new DTCellValue52(Boolean.TRUE),
                        new DTCellValue52(Boolean.FALSE),
                        new DTCellValue52("Row 1 message")
                ),
                Arrays.asList(
                        new DTCellValue52(2),
                        new DTCellValue52("Row 2 description"),
                        new DTCellValue52(Boolean.TRUE),
                        new DTCellValue52(Boolean.TRUE),
                        new DTCellValue52("Row 2 message")
                ),
                Arrays.asList(
                        new DTCellValue52(3),
                        new DTCellValue52("Row 3 description"),
                        new DTCellValue52(Boolean.FALSE),
                        new DTCellValue52(Boolean.TRUE),
                        new DTCellValue52("Row 3 message")
                )
        );

        dt.setData(data);

        DecisionTableAnalyzer analyzer = new DecisionTableAnalyzer(sce);
        List<Analysis> analysisData = analyzer.analyze(dt);

        assertEquals(data.size(), analysisData.size());
View Full Code Here

        availablePatternsSelection.setChildColumns( chosenConditions );
        presenter.stateChanged();
    }

    private ConditionCol52 makeNewConditionColumn(AvailableField f) {
        TableFormat format = presenter.getTableFormat();
        if ( format == TableFormat.EXTENDED_ENTRY ) {
            ConditionCol52 c = new ConditionCol52();
            c.setFactField( f.getName() );
            c.setFieldType( f.getType() );
            c.setConstraintValueType( f.getCalculationType() );
View Full Code Here

        setChosenFields( chosenFields );
        presenter.stateChanged();
    }

    private ActionInsertFactCol52 makeNewActionColumn(AvailableField f) {
        TableFormat format = presenter.getTableFormat();
        if ( format == TableFormat.EXTENDED_ENTRY ) {
            ActionInsertFactCol52 a = new ActionInsertFactCol52();
            a.setBoundName( chosenPatternsSelection.getBoundName() );
            a.setFactType( chosenPatternsSelection.getFactType() );
            a.setFactField( f.getName() );
View Full Code Here

        public WizardPlace<NewGuidedDecisionTableAssetWizardContext> getPlace(String token) {
            String assetName = getAssetName( token );
            String packageName = getPackageName( token );
            String packageUUID = getPackageUUID( token );
            TableFormat tableFormat = getTableFormat( token );
            String description = getDescription( token );
            String category = getCategory( token );
            String format = getFormat( token );

            NewGuidedDecisionTableAssetConfiguration config = new NewGuidedDecisionTableAssetConfiguration( assetName,
View Full Code Here

        setChosenFields( chosenFields );
        presenter.stateChanged();
    }

    private ActionSetFieldCol52 makeNewActionColumn(AvailableField f) {
        TableFormat format = presenter.getTableFormat();
        if ( format == TableFormat.EXTENDED_ENTRY ) {
            ActionSetFieldCol52 a = new ActionSetFieldCol52();
            a.setBoundName( availablePatternsSelection.getBoundName() );
            a.setFactField( f.getName() );
            a.setType( f.getType() );
View Full Code Here

        availablePatternsSelection.setChildColumns( chosenConditions );
        presenter.stateChanged();
    }

    private ConditionCol52 makeNewConditionColumn(AvailableField f) {
        TableFormat format = presenter.getTableFormat();
        if ( format == TableFormat.EXTENDED_ENTRY ) {
            ConditionCol52 c = new ConditionCol52();
            c.setFactField( f.getName() );
            c.setFieldType( f.getType() );
            c.setConstraintValueType( f.getCalculationType() );
View Full Code Here

        public WizardPlace<NewGuidedDecisionTableAssetWizardContext> getPlace(String token) {
            String assetName = getAssetName( token );
            String packageName = getPackageName( token );
            String packageUUID = getPackageUUID( token );
            TableFormat tableFormat = getTableFormat( token );
            String description = getDescription( token );
            String category = getCategory( token );
            String format = getFormat( token );

            final GuidedDecisionTable52 content = new GuidedDecisionTable52();
View Full Code Here

TOP

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

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.