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());
}
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"));
}
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;
}
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());
}
}
Aggregations