Search in sources :

Example 1 with LimitedEntryActionRetractFactCol52

use of org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52 in project drools-wb by kiegroup.

the class LimitedEntryActionRetractFactCol52DefinitionBuilderTest method simpleAction.

@Test
public void simpleAction() {
    final AtomicBoolean calledBack = new AtomicBoolean(false);
    final LimitedEntryActionRetractFactCol52 arf = new LimitedEntryActionRetractFactCol52();
    arf.setValue(new DTCellValue52("$a"));
    model.getActionCols().add(arf);
    builder.generateDefinition(dtPresenter, arf, (String definition) -> {
        calledBack.set(true);
        assertEquals("retract( $a );", definition);
    });
    assertTrue(calledBack.get());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) Test(org.junit.Test)

Example 2 with LimitedEntryActionRetractFactCol52

use of org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52 in project drools by kiegroup.

the class BRLRuleModelTest method testRuleModelWithRHSBoundFactsUsageWithLimitedEntryActionRetractFact.

@Test
public void testRuleModelWithRHSBoundFactsUsageWithLimitedEntryActionRetractFact() {
    final GuidedDecisionTable52 dt = new GuidedDecisionTable52();
    // Setup Decision Table columns
    final Pattern52 p1 = new Pattern52();
    p1.setFactType("Driver");
    p1.setBoundName("$d");
    dt.getConditions().add(p1);
    final LimitedEntryActionRetractFactCol52 del = new LimitedEntryActionRetractFactCol52();
    del.setValue(new DTCellValue52("$d"));
    dt.getActionCols().add(del);
    final BRLRuleModel model = new BRLRuleModel(dt);
    // Checks
    assertTrue(model.isBoundFactUsed("$d"));
    assertFalse(model.isBoundFactUsed("$cheese"));
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BRLRuleModel(org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel) Test(org.junit.Test)

Example 3 with LimitedEntryActionRetractFactCol52

use of org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52 in project drools-wb by kiegroup.

the class ActionRetractFactPlugin method clone.

ActionRetractFactCol52 clone(final ActionRetractFactCol52 col52) {
    final ActionRetractFactCol52 clone;
    if (col52 instanceof LimitedEntryCol) {
        clone = new LimitedEntryActionRetractFactCol52();
        final DTCellValue52 oldValue = ((LimitedEntryCol) col52).getValue();
        final DTCellValue52 newValue = new DTCellValue52(oldValue.getStringValue());
        ((LimitedEntryCol) clone).setValue(newValue);
    } else {
        clone = new ActionRetractFactCol52();
    }
    clone.setHeader(col52.getHeader());
    clone.setHideColumn(col52.isHideColumn());
    return clone;
}
Also used : LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) LimitedEntryCol(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryCol)

Example 4 with LimitedEntryActionRetractFactCol52

use of org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52 in project drools-wb by kiegroup.

the class ActionRetractFactPlugin method newColumn.

ActionRetractFactCol52 newColumn() {
    switch(tableFormat()) {
        case EXTENDED_ENTRY:
            return new ActionRetractFactCol52();
        case LIMITED_ENTRY:
            final LimitedEntryActionRetractFactCol52 col52 = new LimitedEntryActionRetractFactCol52();
            col52.setValue(new DTCellValue52(""));
            return col52;
        default:
            throw new UnsupportedOperationException("Unsupported table format: " + tableFormat());
    }
}
Also used : LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) LimitedEntryActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52) ActionRetractFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Aggregations

DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)4 LimitedEntryActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionRetractFactCol52)4 ActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52)2 Test (org.junit.Test)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 BRLRuleModel (org.drools.workbench.models.guided.dtable.shared.model.BRLRuleModel)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1 LimitedEntryCol (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryCol)1 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)1