Search in sources :

Example 1 with DTColumnConfig52

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;
}
Also used : MetadataCol52(org.drools.workbench.models.guided.dtable.shared.model.MetadataCol52) AttributeCol52(org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) BRLVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLVariableColumn) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) LimitedEntryCol(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryCol)

Example 2 with DTColumnConfig52

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);
    }
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 3 with DTColumnConfig52

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'");
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 4 with DTColumnConfig52

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);
}
Also used : ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionWorkItemWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.ActionWorkItemWrapper) PatternWrapper(org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper) Test(org.junit.Test)

Example 5 with DTColumnConfig52

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);
    }
}
Also used : ColumnUtilities(org.drools.workbench.screens.guided.dtable.client.widget.table.utilities.ColumnUtilities) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) DTColumnConfig52(org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Aggregations

DTColumnConfig52 (org.drools.workbench.models.guided.dtable.shared.model.DTColumnConfig52)10 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)4 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)3 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)2 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)2 LimitedEntryCol (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryCol)2 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)2 PatternWrapper (org.drools.workbench.screens.guided.dtable.client.wizard.column.plugins.commons.PatternWrapper)2 Test (org.junit.Test)2 ChangeEvent (com.google.gwt.event.dom.client.ChangeEvent)1 ChangeHandler (com.google.gwt.event.dom.client.ChangeHandler)1 ValueChangeEvent (com.google.gwt.event.logical.shared.ValueChangeEvent)1 ValueChangeHandler (com.google.gwt.event.logical.shared.ValueChangeHandler)1 BigInteger (java.math.BigInteger)1 Set (java.util.Set)1 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)1 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)1 BRLVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLVariableColumn)1 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)1 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)1