use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class PluginHandler method edit.
public void edit(final ActionCol52 column) {
final DecisionTableColumnPlugin plugin;
if (column instanceof ActionWorkItemSetFieldCol52 || column instanceof ActionWorkItemInsertFactCol52) {
plugin = actionWorkItemSetFieldPlugin.get();
} else if (column instanceof ActionInsertFactCol52 || column instanceof ActionSetFieldCol52) {
plugin = actionSetFactPlugin.get();
} else if (column instanceof ActionRetractFactCol52) {
plugin = actionRetractFactPlugin.get();
} else if (column instanceof ActionWorkItemCol52) {
plugin = actionWorkItemPlugin.get();
} else if (column instanceof BRLActionColumn) {
plugin = brlActionColumnPlugin.get();
} else {
return;
}
plugin.setOriginalColumnConfig52(column);
openWizard(plugin);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class DecisionTableAnalyzer method getColumnIndex.
private int getColumnIndex(final BaseColumn baseColumn) {
List<BaseColumn> cols = model.getExpandedColumns();
final int indexOf = cols.indexOf(baseColumn);
if (indexOf < 0) {
if (baseColumn instanceof BRLConditionColumn) {
for (final BaseColumn column : model.getExpandedColumns()) {
if (column instanceof BRLConditionVariableColumn) {
if (((BRLConditionColumn) baseColumn).getChildColumns().contains(column)) {
return model.getExpandedColumns().indexOf(column);
}
}
}
throw new IllegalArgumentException("Could not find BRLConditionColumn: " + baseColumn.toString());
}
if (baseColumn instanceof BRLActionColumn) {
for (final BaseColumn column : model.getExpandedColumns()) {
if (column instanceof BRLActionVariableColumn) {
if (((BRLActionColumn) baseColumn).getChildColumns().contains(column)) {
return model.getExpandedColumns().indexOf(column);
}
}
}
throw new IllegalArgumentException("Could not find BRLActionColumn: " + baseColumn.toString());
} else if (baseColumn instanceof BRLVariableColumn) {
return model.getExpandedColumns().indexOf(model.getBRLColumn((BRLVariableColumn) baseColumn));
} else {
throw new IllegalArgumentException("Could not find baseColumn: " + baseColumn.toString());
}
} else {
return indexOf;
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class GuidedDecisionTablePresenterTest method addBrlInsertActionToModel.
private void addBrlInsertActionToModel(final GuidedDecisionTable52 model, final String factType, final String field) {
final BRLActionColumn brlAction = new BRLActionColumn();
final ActionInsertFact aif = new ActionInsertFact(factType);
final ActionFieldValue afv = new ActionFieldValue(field, "$var", DataType.TYPE_STRING);
afv.setNature(FieldNatureType.TYPE_VARIABLE);
aif.addFieldValue(afv);
brlAction.setDefinition(Collections.singletonList(aif));
BRLActionVariableColumn variableColumn = new BRLActionVariableColumn("$var", DataType.TYPE_STRING, factType, field);
brlAction.getChildColumns().add(variableColumn);
model.getActionCols().add(brlAction);
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class AuditLogEntryCellHelperTest method getSafeHtml_BrlAction.
@Test
public void getSafeHtml_BrlAction() {
// Definition diffs are currently not supported, maybe #soon?
BRLActionColumn originalColumn = new BRLActionColumn();
// originalColumn.setDefinition(Arrays.asList(new ActionRetractFact("fact1")));
originalColumn.setHeader("action1");
originalColumn.setHideColumn(false);
BRLActionColumn newColumn = new BRLActionColumn();
// newColumn.setDefinition(Arrays.asList(new ActionRetractFact("fact2"), new ActionRetractFact("fact3")));
newColumn.setHeader("action2");
newColumn.setHideColumn(true);
List<BaseColumnFieldDiff> diffs = originalColumn.diff(newColumn);
SafeHtml result = helper.getSafeHtml(new UpdateColumnAuditLogEntry("mock user", originalColumn, newColumn, diffs));
assertEquals(getHeaderRepre(newColumn.getHeader()) + getDiffRepre(diffs), result.asString());
}
use of org.drools.workbench.models.guided.dtable.shared.model.BRLActionColumn in project drools-wb by kiegroup.
the class ExtendedGuidedDecisionTableBuilder method withActionBRLFragment.
public AbstractDecisionTableBuilder withActionBRLFragment() {
final BRLActionColumn brlActionColumn = createBRLActionColumn();
ArrayList<BRLActionVariableColumn> childColumns = new ArrayList<>();
childColumns.add(new BRLActionVariableColumn());
brlActionColumn.setChildColumns(childColumns);
table.getActionCols().add(brlActionColumn);
return this;
}
Aggregations