use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools by kiegroup.
the class GuidedDTDRLPersistence method doActions.
void doActions(List<BaseColumn> allColumns, List<ActionCol52> actionCols, TemplateDataProvider rowDataProvider, List<DTCellValue52> row, RuleModel rm) {
List<LabelledAction> actions = new ArrayList<LabelledAction>();
for (ActionCol52 c : actionCols) {
if (c instanceof LimitedEntryBRLActionColumn) {
doAction(allColumns, (LimitedEntryBRLActionColumn) c, actions, rowDataProvider, row, rm);
} else if (c instanceof BRLActionColumn) {
doAction(allColumns, (BRLActionColumn) c, actions, rowDataProvider, row, rm);
} else {
int index = allColumns.indexOf(c);
DTCellValue52 dcv = row.get(index);
String cell = "";
if (c instanceof LimitedEntryCol) {
if (dcv.getBooleanValue() == true) {
LimitedEntryCol lec = (LimitedEntryCol) c;
cell = GuidedDTDRLUtilities.convertDTCellValueToString(lec.getValue());
}
} else {
cell = GuidedDTDRLUtilities.convertDTCellValueToString(dcv);
}
if (validCell(cell, dcv.getDataType())) {
if (c instanceof ActionWorkItemInsertFactCol52) {
doAction(actions, (ActionWorkItemInsertFactCol52) c, cell);
} else if (c instanceof ActionInsertFactCol52) {
doAction(actions, (ActionInsertFactCol52) c, cell);
} else if (c instanceof ActionWorkItemSetFieldCol52) {
doAction(actions, (ActionWorkItemSetFieldCol52) c, cell);
} else if (c instanceof ActionSetFieldCol52) {
doAction(actions, (ActionSetFieldCol52) c, cell);
} else if (c instanceof ActionRetractFactCol52) {
doAction(actions, cell);
} else if (c instanceof ActionWorkItemCol52) {
doAction(actions, (ActionWorkItemCol52) c, cell);
}
}
}
}
rm.rhs = new IAction[actions.size()];
for (int i = 0; i < rm.rhs.length; i++) {
rm.rhs[i] = actions.get(i).action;
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 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.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testNewActionWrapperWhenColumnIsAnActionSetFactWrapper.
@Test
public void testNewActionWrapperWhenColumnIsAnActionSetFactWrapper() throws Exception {
when(model.getTableFormat()).thenReturn(GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY);
when(presenter.getModel()).thenReturn(model);
final ActionWorkItemWrapper wrapper = plugin.newActionWorkItemWrapper(mock(ActionWorkItemSetFieldCol52.class));
assertTrue(wrapper instanceof ActionWorkItemSetWrapper);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetWrapperTest method testClone.
@Test
public void testClone() throws Exception {
final ActionWorkItemSetFieldCol52 column = new ActionWorkItemSetFieldCol52();
column.setFactField("factField");
column.setBoundName("boundName");
column.setValueList("valueList");
column.setHeader("header");
column.setUpdate(false);
column.setDefaultValue(new DTCellValue52("defaultValue"));
column.setHideColumn(false);
column.setType("type");
column.setParameterClassName("parameterClassName");
column.setWorkItemName("workItemName");
column.setWorkItemResultParameterName("workItemResultParameterName");
final ActionWorkItemSetWrapper wrapper = new ActionWorkItemSetWrapper(plugin, column);
final ActionWorkItemSetFieldCol52 clone = wrapper.getActionCol52();
assertEquals("factField", column.getFactField());
assertEquals("boundName", column.getBoundName());
assertEquals("valueList", column.getValueList());
assertEquals("header", column.getHeader());
assertEquals(false, column.isUpdate());
assertEquals(new DTCellValue52("defaultValue"), column.getDefaultValue());
assertEquals(false, column.isHideColumn());
assertEquals("type", column.getType());
assertEquals("parameterClassName", column.getParameterClassName());
assertEquals("workItemName", column.getWorkItemName());
assertEquals("workItemResultParameterName", column.getWorkItemResultParameterName());
assertNotSame(column, clone);
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemSetFieldCol52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldColumnSynchronizer method append.
@Override
public void append(final ColumnMetaData metaData) throws VetoException {
// Check operation is supported
if (!handlesAppend(metaData)) {
return;
}
final ActionWorkItemSetFieldCol52 column = (ActionWorkItemSetFieldCol52) metaData.getColumn();
final String workItemName = column.getWorkItemName();
model.getActionCols().stream().filter(c -> c instanceof ActionWorkItemCol52).map(c -> ((ActionWorkItemCol52) c)).filter(c -> c.getWorkItemDefinition().getName().equals(workItemName)).findFirst().ifPresent(p -> findLastIndexOfWorkItemColumn(p).ifPresent(index -> {
model.getActionCols().add(index + 1, column);
synchroniseAppendColumn(column);
}));
}
Aggregations