Search in sources :

Example 31 with ConditionCol52

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

the class ExtendedGuidedDecisionTableBuilder method withStringColumn.

public ExtendedGuidedDecisionTableBuilder withStringColumn(String boundName, String factType, String field, String operator) {
    Pattern52 pattern = findPattern(boundName, factType);
    ConditionCol52 con1 = new ConditionCol52();
    con1.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    con1.setFieldType(DataType.TYPE_STRING);
    con1.setFactField(field);
    con1.setHeader("Applicant age");
    con1.setOperator(operator);
    pattern.getChildColumns().add(con1);
    addPattern(pattern);
    return this;
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52)

Example 32 with ConditionCol52

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

the class ExtendedGuidedDecisionTableBuilder method withConditionIntegerColumn.

public ExtendedGuidedDecisionTableBuilder withConditionIntegerColumn(String boundName, String factType, String field, String operator) {
    Pattern52 pattern = findPattern(boundName, factType);
    ConditionCol52 con1 = new ConditionCol52();
    con1.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    con1.setFieldType(DataType.TYPE_NUMERIC_INTEGER);
    con1.setFactField(field);
    con1.setHeader("Applicant age");
    con1.setOperator(operator);
    pattern.getChildColumns().add(con1);
    addPattern(pattern);
    return this;
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52)

Example 33 with ConditionCol52

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

the class ExtendedGuidedDecisionTableBuilder method withNumericColumn.

public ExtendedGuidedDecisionTableBuilder withNumericColumn(String boundName, String factType, String field, String operator) {
    Pattern52 pattern = findPattern(boundName, factType);
    ConditionCol52 con1 = new ConditionCol52();
    con1.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    con1.setFieldType(DataType.TYPE_NUMERIC);
    con1.setFactField(field);
    con1.setHeader("Applicant age");
    con1.setOperator(operator);
    pattern.getChildColumns().add(con1);
    addPattern(pattern);
    return this;
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52)

Example 34 with ConditionCol52

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

the class ModelMetaDataEnhancer method getHeaderMetaData.

public HeaderMetaData getHeaderMetaData() {
    int columnIndex = 0;
    final Map<Integer, ModelMetaData> map = new HashMap<>();
    for (final BaseColumn baseColumn : model.getExpandedColumns()) {
        if (baseColumn instanceof ConditionCol52) {
            map.put(columnIndex, new ModelMetaData(model.getPattern((ConditionCol52) baseColumn), PatternType.LHS));
        } else if (baseColumn instanceof ActionInsertFactCol52) {
            final ActionInsertFactCol52 aif = (ActionInsertFactCol52) baseColumn;
            map.put(columnIndex, new ModelMetaData(aif.getFactType(), aif.getBoundName(), PatternType.RHS));
        } else if (baseColumn instanceof ActionSetFieldCol52) {
            final ActionSetFieldCol52 asf = (ActionSetFieldCol52) baseColumn;
            map.put(columnIndex, new ModelMetaData(getFactType(asf), asf.getBoundName(), PatternType.RHS));
        }
        columnIndex++;
    }
    return new HeaderMetaData(map);
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) HashMap(java.util.HashMap) HeaderMetaData(org.drools.workbench.services.verifier.plugin.client.api.HeaderMetaData) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) ModelMetaData(org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData)

Example 35 with ConditionCol52

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

the class RuleBuilder method resolveColumns.

private void resolveColumns() throws BuildException {
    int columnIndex = 0;
    for (final BaseColumn baseColumn : model.getExpandedColumns()) {
        if (baseColumn instanceof ConditionCol52) {
            final Condition condition = builderFactory.getConditionBuilder().with((ConditionCol52) baseColumn).with(rule).with(row).with(columnIndex).build();
            rule.getConditions().add(condition);
        } else if (baseColumn instanceof ActionCol52) {
            final Action action = builderFactory.getActionBuilder().with(rule).with((ActionCol52) baseColumn).with(row).with(columnIndex).build();
            rule.getActions().add(action);
        }
        columnIndex++;
    }
}
Also used : Condition(org.drools.workbench.services.verifier.api.client.index.Condition) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Action(org.drools.workbench.services.verifier.api.client.index.Action) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)

Aggregations

ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)229 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)184 Test (org.junit.Test)170 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)74 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)59 ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)38 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)38 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)34 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)31 ArrayList (java.util.ArrayList)27 Path (org.uberfire.backend.vfs.Path)27 StringUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.StringUiColumn)25 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)25 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)25 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)25 BaseSingleFieldConstraint (org.drools.workbench.models.datamodel.rule.BaseSingleFieldConstraint)24 IntegerUiColumn (org.drools.workbench.screens.guided.dtable.client.widget.table.columns.IntegerUiColumn)24 DescriptionCol52 (org.drools.workbench.models.guided.dtable.shared.model.DescriptionCol52)23 RowNumberCol52 (org.drools.workbench.models.guided.dtable.shared.model.RowNumberCol52)23 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)23