use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.
the class ActionSetFieldsPage method makeResult.
@Override
public void makeResult(final GuidedDecisionTable52 model) {
// Copy actions to decision table model. Assertion of bindings occurs in FactPatternsPage
for (Map.Entry<Pattern52, List<ActionSetFieldCol52>> ps : patternToActionsMap.entrySet()) {
final Pattern52 p = ps.getKey();
// Patterns with no conditions don't get created
if (p.getChildColumns().size() > 0) {
final String binding = p.getBoundName();
for (ActionSetFieldCol52 a : ps.getValue()) {
a.setBoundName(binding);
model.getActionCols().add(a);
}
}
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.
the class ActionSetFieldsPageViewImpl method makeNewActionColumn.
private ActionSetFieldCol52 makeNewActionColumn(final AvailableField f) {
final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
if (format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) {
final ActionSetFieldCol52 a = new ActionSetFieldCol52();
a.setBoundName(availablePatternsSelection.getBoundName());
a.setFactField(f.getName());
a.setType(f.getType());
return a;
} else {
final LimitedEntryActionSetFieldCol52 a = new LimitedEntryActionSetFieldCol52();
a.setBoundName(availablePatternsSelection.getBoundName());
a.setFactField(f.getName());
a.setType(f.getType());
return a;
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.
the class RowExpander method addActionColumns.
private void addActionColumns() {
for (ActionCol52 a : model.getActionCols()) {
if (a instanceof ActionSetFieldCol52) {
ActionSetFieldCol52 afc = (ActionSetFieldCol52) a;
addColumn(afc);
} else if (a instanceof ActionInsertFactCol52) {
ActionInsertFactCol52 aif = (ActionInsertFactCol52) a;
addColumn(aif);
}
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.
the class ConditionColumnSynchronizerTest method actionUpdatePattern.
private ActionCol52 actionUpdatePattern(final String boundName) {
final ActionSetFieldCol52 action = new ActionSetFieldCol52();
action.setBoundName(boundName);
action.setFactField("age");
action.setHeader("action1");
return action;
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52 in project drools-wb by kiegroup.
the class ActionSetFieldCol52DefinitionBuilderTest method simpleActionUpdateField.
@Test
public void simpleActionUpdateField() {
final AtomicBoolean calledBack = new AtomicBoolean(false);
setupPatternAndCondition();
final ActionSetFieldCol52 asf = new ActionSetFieldCol52();
asf.setBoundName("$p");
asf.setFactField("name");
asf.setUpdate(true);
model.getActionCols().add(asf);
when(dmo.getFieldType(eq("Person"), eq("name"))).thenReturn(DataType.TYPE_STRING);
builder.generateDefinition(dtPresenter, asf, (String definition) -> {
calledBack.set(true);
assertEquals("modify( $p ) {<br/>" + "setName( \"x\" )<br/>" + "}", definition);
});
assertTrue(calledBack.get());
}
Aggregations