use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52 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.ActionWorkItemInsertFactCol52 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.ActionWorkItemInsertFactCol52 in project drools-wb by kiegroup.
the class ActionWorkItemInsertFactColumnConverter method makeHeaderMetaData.
@Override
public List<GridColumn.HeaderMetaData> makeHeaderMetaData(final BaseColumn column) {
final String workItemName = ((ActionWorkItemInsertFactCol52) column).getWorkItemName();
return new ArrayList<GridColumn.HeaderMetaData>() {
{
add(new BaseHeaderMetaData(workItemName, ActionCol52.class.getName()));
add(new BaseHeaderMetaData(column.getHeader(), workItemName + "-set"));
}
};
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52 in project drools-wb by kiegroup.
the class ActionWorkItemInsertFactColumnSynchronizer method append.
@Override
public void append(final ColumnMetaData metaData) throws VetoException {
// Check operation is supported
if (!handlesAppend(metaData)) {
return;
}
final ActionWorkItemInsertFactCol52 column = (ActionWorkItemInsertFactCol52) 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(c -> findLastIndexOfWorkItemColumn(c).ifPresent(index -> {
model.getActionCols().add(index + 1, column);
synchroniseAppendColumn(column);
}));
}
use of org.drools.workbench.models.guided.dtable.shared.model.ActionWorkItemInsertFactCol52 in project drools-wb by kiegroup.
the class ActionColumnSynchronizer method isWorkItemFragmentBeforeInsertFactCol.
protected boolean isWorkItemFragmentBeforeInsertFactCol(final List<? extends MetaData> metaData) {
final List<ActionCol52> columnsToMove = metaData.stream().map(c -> (MoveColumnToMetaData) c).map(MoveColumnToMetaData::getColumn).map(c -> (ActionCol52) c).collect(Collectors.toList());
final List<String> bindingsUsedByWID = new ArrayList<>();
bindingsUsedByWID.addAll(columnsToMove.stream().filter(c -> c instanceof ActionWorkItemInsertFactCol52).map(c -> (ActionWorkItemInsertFactCol52) c).map(ActionWorkItemInsertFactCol52::getBoundName).collect(Collectors.toList()));
final AtomicBoolean result = new AtomicBoolean(true);
final int tgtIndex = ((MoveColumnToMetaData) metaData.get(0)).getTargetColumnIndex();
final List<BaseColumn> modelColumns = model.getExpandedColumns();
// Cannot move "Insert and Set field" created by the WID to after other "Insert and Set field"
for (String binding : bindingsUsedByWID) {
model.getActionCols().stream().filter(c -> !columnsToMove.contains(c)).filter(c -> c instanceof ActionInsertFactCol52).filter(c -> !(c instanceof ActionWorkItemInsertFactCol52)).map(c -> (ActionInsertFactCol52) c).filter(c -> c.getBoundName().equals(binding)).map(modelColumns::indexOf).filter(i -> tgtIndex >= i).findFirst().ifPresent(i -> result.set(false));
}
return result.get();
}
Aggregations