use of org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52 in project drools by kiegroup.
the class GuidedDecisionTableUpgradeHelper3 method upgrade.
/**
* Convert the Default Values in the Decision Table model
*
* @param source
* @return The new DTModel
*/
public GuidedDecisionTable52 upgrade(GuidedDecisionTable52 source) {
final GuidedDecisionTable52 destination = source;
for (BaseColumn column : source.getExpandedColumns()) {
DTColumnConfig52 dtColumn = null;
if (column instanceof MetadataCol52) {
dtColumn = (DTColumnConfig52) column;
} else if (column instanceof AttributeCol52) {
dtColumn = (DTColumnConfig52) column;
} else if (column instanceof ConditionCol52) {
dtColumn = (DTColumnConfig52) column;
} else if (column instanceof ActionCol52) {
dtColumn = (DTColumnConfig52) column;
}
if (dtColumn instanceof LimitedEntryCol) {
dtColumn = null;
}
if (dtColumn instanceof BRLVariableColumn) {
dtColumn = null;
}
if (dtColumn != null) {
final String legacyDefaultValue = dtColumn.defaultValue;
if (legacyDefaultValue != null) {
dtColumn.setDefaultValue(new DTCellValue52(legacyDefaultValue));
dtColumn.defaultValue = null;
}
}
}
return destination;
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52 in project drools-wb by kiegroup.
the class DefaultWidgetFactory method makeNewValue.
private DTCellValue52 makeNewValue() {
final DTColumnConfig52 column = getPlugin().editingCol();
final Pattern52 pattern = getPlugin().editingPattern();
if (column instanceof ActionSetFieldCol52) {
return factory().makeNewValue(pattern, (ActionSetFieldCol52) column);
} else if (column instanceof ConditionCol52) {
return factory().makeNewValue(pattern, (ConditionCol52) column);
} else {
return factory().makeNewValue(column);
}
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52 in project drools-wb by kiegroup.
the class DefaultWidgetFactory method getWidget.
private Widget getWidget(final DTCellValue52 defaultValue) {
final DTColumnConfig52 column = getPlugin().editingCol();
final Pattern52 pattern = getPlugin().editingPattern();
if (column instanceof ActionSetFieldCol52) {
final ActionSetFieldCol52 col52 = (ActionSetFieldCol52) column;
return factory().getWidget(pattern, col52, defaultValue);
} else if (column instanceof ConditionCol52) {
final ConditionCol52 col52 = (ConditionCol52) column;
return factory().getWidget(pattern, col52, defaultValue);
} else if (column instanceof ActionInsertFactCol52) {
final ActionInsertFactCol52 col52 = (ActionInsertFactCol52) column;
return factory().getWidget(col52, defaultValue);
}
throw new UnsupportedOperationException("The column type is not supported by the 'DefaultWidget'");
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52 in project drools-wb by kiegroup.
the class ActionWorkItemSetFieldPluginTest method testSetupValuesWhenColumnIsNotNew.
@Test
public void testSetupValuesWhenColumnIsNotNew() throws Exception {
final DTColumnConfig52 column = mock(DTColumnConfig52.class);
final ActionWorkItemWrapper actionWrapper = mock(ActionWorkItemWrapper.class);
final PatternWrapper patternWrapper = mock(PatternWrapper.class);
doReturn(model).when(presenter).getModel();
doReturn(column).when(plugin).getOriginalColumnConfig52();
doReturn(actionWrapper).when(plugin).newActionWorkItemWrapper(column);
doReturn(patternWrapper).when(plugin).newPatternWrapper(actionWrapper);
doReturn("WorkItemName").when(actionWrapper).getWorkItemName();
doReturn("WorkItemResultParameterName").when(actionWrapper).getWorkItemResultParameterName();
doReturn(new ArrayList<ActionCol52>()).when(model).getActionCols();
doReturn(false).when(plugin).isNewColumn();
plugin.setupValues();
verify(plugin).setupWorkItems();
verify(plugin).setWorkItem("WorkItemName:WorkItemResultParameterName");
verify(plugin).setWorkItemPageAsCompleted();
verify(plugin).fireChangeEvent(patternPage);
verify(plugin).fireChangeEvent(fieldPage);
verify(plugin).fireChangeEvent(additionalInfoPage);
}
use of org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52 in project drools-wb by kiegroup.
the class DefaultWidgetFactory method dataType.
private DataType.DataTypes dataType() {
final ColumnUtilities columnUtilities = columnUtilities();
final DTColumnConfig52 column = getPlugin().editingCol();
if (column instanceof ActionSetFieldCol52) {
return columnUtilities.getDataType(getPlugin().editingPattern(), (ActionSetFieldCol52) column);
} else if (column instanceof ConditionCol52) {
return columnUtilities.getDataType(getPlugin().editingPattern(), (ConditionCol52) column);
} else {
return columnUtilities.getDataType(column);
}
}
Aggregations