Search in sources :

Example 51 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.

the class LimitedEntryDropDownManager method getCurrentValueMap.

@Override
public Map<String, String> getCurrentValueMap(Context context) {
    Map<String, String> currentValueMap = new HashMap<String, String>();
    final Pattern52 basePattern = context.getBasePattern();
    final BaseColumn baseColumn = context.getBaseColumn();
    // Get values for all Constraints or Actions on the same pattern as the baseColumn
    if (baseColumn instanceof ConditionCol52 && basePattern != null) {
        for (ConditionCol52 cc : basePattern.getChildColumns()) {
            if (cc instanceof LimitedEntryCol) {
                currentValueMap.put(cc.getFactField(), getValue((LimitedEntryCol) cc));
            }
        }
    } else if (baseColumn instanceof ActionSetFieldCol52) {
        ActionSetFieldCol52 baseActionColumn = (ActionSetFieldCol52) baseColumn;
        final String binding = baseActionColumn.getBoundName();
        for (ActionCol52 ac : this.model.getActionCols()) {
            if (ac instanceof ActionSetFieldCol52) {
                final ActionSetFieldCol52 asf = (ActionSetFieldCol52) ac;
                if (asf.getBoundName().equals(binding)) {
                    if (asf instanceof LimitedEntryCol) {
                        currentValueMap.put(asf.getFactField(), getValue((LimitedEntryCol) asf));
                    }
                }
            }
        }
    } else if (baseColumn instanceof ActionInsertFactCol52) {
        ActionInsertFactCol52 baseActionColumn = (ActionInsertFactCol52) baseColumn;
        final String binding = baseActionColumn.getBoundName();
        for (ActionCol52 ac : this.model.getActionCols()) {
            if (ac instanceof ActionInsertFactCol52) {
                final ActionInsertFactCol52 aif = (ActionInsertFactCol52) ac;
                if (aif.getBoundName().equals(binding)) {
                    if (aif instanceof LimitedEntryCol) {
                        currentValueMap.put(aif.getFactField(), getValue((LimitedEntryCol) aif));
                    }
                }
            }
        }
    }
    return currentValueMap;
}
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) HashMap(java.util.HashMap) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) LimitedEntryCol(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryCol)

Example 52 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.

the class DefaultValueDropDownManager method getCurrentValueMap.

@Override
public Map<String, String> getCurrentValueMap(Context context) {
    Map<String, String> currentValueMap = new HashMap<String, String>();
    final Pattern52 basePattern = context.getBasePattern();
    final BaseColumn baseColumn = context.getBaseColumn();
    // Get values for all Constraints or Actions on the same pattern as the baseColumn
    if (baseColumn instanceof ConditionCol52) {
        for (ConditionCol52 cc : basePattern.getChildColumns()) {
            currentValueMap.put(cc.getFactField(), getValue(cc));
        }
    } else if (baseColumn instanceof ActionSetFieldCol52) {
        ActionSetFieldCol52 baseActionColumn = (ActionSetFieldCol52) baseColumn;
        final String binding = baseActionColumn.getBoundName();
        for (ActionCol52 ac : this.model.getActionCols()) {
            if (ac instanceof ActionSetFieldCol52) {
                final ActionSetFieldCol52 asf = (ActionSetFieldCol52) ac;
                if (asf.getBoundName().equals(binding)) {
                    currentValueMap.put(asf.getFactField(), getValue(asf));
                }
            }
        }
    } else if (baseColumn instanceof ActionInsertFactCol52) {
        ActionInsertFactCol52 baseActionColumn = (ActionInsertFactCol52) baseColumn;
        final String binding = baseActionColumn.getBoundName();
        for (ActionCol52 ac : this.model.getActionCols()) {
            if (ac instanceof ActionInsertFactCol52) {
                final ActionInsertFactCol52 aif = (ActionInsertFactCol52) ac;
                if (aif.getBoundName().equals(binding)) {
                    currentValueMap.put(aif.getFactField(), getValue(aif));
                }
            }
        }
    }
    return currentValueMap;
}
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) HashMap(java.util.HashMap) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 53 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.

the class ValueOptionsPage method newCEPWindowOperatorsDropdown.

private CEPWindowOperatorsDropdown newCEPWindowOperatorsDropdown() {
    final Pattern52 editingPattern = editingPattern();
    return new CEPWindowOperatorsDropdown(editingPattern, false) {

        {
            addValueChangeHandler(event -> {
                final CEPWindow cepWindow = editingPattern.getWindow();
                final String operator = event.getValue().getValue();
                cepWindow.setOperator(operator);
            });
        }
    };
}
Also used : CEPWindowOperatorsDropdown(org.drools.workbench.screens.guided.rule.client.editor.CEPWindowOperatorsDropdown) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) CEPWindow(org.drools.workbench.models.datamodel.rule.CEPWindow)

Example 54 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.

the class ColumnManagementView method renderColumns.

public void renderColumns(final Map<String, List<BaseColumn>> columnGroups) {
    clear();
    for (String groupLabel : columnGroups.keySet()) {
        final VerticalPanel columnGroup = new VerticalPanel();
        final HorizontalPanel columnGroupHeader = new HorizontalPanel();
        final VerticalPanel columnGroupColumns = new VerticalPanel();
        columnGroupHeader.add(new Label(groupLabel));
        columnGroup.add(columnGroupHeader);
        columnGroup.add(columnGroupColumns);
        add(columnGroup);
        for (final BaseColumn column : columnGroups.get(groupLabel)) {
            if (column instanceof ActionCol52) {
                columnGroupColumns.add(renderColumn((ActionCol52) column));
            } else if (column instanceof BRLConditionColumn) {
                columnGroupColumns.add(renderColumn((BRLConditionColumn) column));
            } else if (column instanceof Pattern52) {
                renderColumn((Pattern52) column).forEach(columnGroupColumns::add);
            }
        }
    }
}
Also used : BRLConditionColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionColumn) VerticalPanel(com.google.gwt.user.client.ui.VerticalPanel) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) HorizontalPanel(com.google.gwt.user.client.ui.HorizontalPanel) Label(com.google.gwt.user.client.ui.Label) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)

Example 55 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 in project drools-wb by kiegroup.

the class ConditionColumnConverter method getPatternHeader.

private String getPatternHeader(final BaseColumn column) {
    final Pattern52 pattern = model.getPattern((ConditionCol52) column);
    final StringBuilder sb = new StringBuilder();
    if (pattern.isNegated()) {
        sb.append("not ");
    } else if (!(pattern.getBoundName() == null || pattern.getBoundName().isEmpty())) {
        sb.append(pattern.getBoundName()).append(" : ");
    }
    sb.append(pattern.getFactType());
    return sb.toString();
}
Also used : Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52)

Aggregations

Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)243 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)184 Test (org.junit.Test)180 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)92 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)66 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)45 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)39 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)34 ArrayList (java.util.ArrayList)31 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)31 SingleFieldConstraint (org.drools.workbench.models.datamodel.rule.SingleFieldConstraint)28 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)27 Path (org.uberfire.backend.vfs.Path)27 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)26 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)26 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)26 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)25 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)24 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)24 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)24