Search in sources :

Example 36 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 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 37 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 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 38 with Pattern52

use of org.drools.workbench.models.guided.dtable.shared.model.Pattern52 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 39 with Pattern52

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

the class LimitedGuidedDecisionTableBuilder method withIntegerColumn.

public LimitedGuidedDecisionTableBuilder withIntegerColumn(final String boundName, final String factType, final String field, final String operator, final int value) {
    final Pattern52 pattern = findPattern(boundName, factType);
    final LimitedEntryConditionCol52 condition = new LimitedEntryConditionCol52();
    condition.setConstraintValueType(BaseSingleFieldConstraint.TYPE_LITERAL);
    condition.setFieldType(DataType.TYPE_NUMERIC_INTEGER);
    condition.setFactField(field);
    condition.setHeader("Some header");
    condition.setOperator(operator);
    condition.setValue(new DTCellValue52() {

        {
            setNumericValue(new Integer(value));
        }
    });
    pattern.getChildColumns().add(condition);
    addPattern(pattern);
    return this;
}
Also used : Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) LimitedEntryConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)

Example 40 with Pattern52

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

the class ModelMetaDataEnhancerTest method conditionCol52Column.

@Test
public void conditionCol52Column() throws Exception {
    final ArrayList<BaseColumn> columns = new ArrayList<>();
    final ConditionCol52 conditionCol52 = new ConditionCol52();
    final Pattern52 pattern52 = new Pattern52();
    columns.add(conditionCol52);
    when(model.getExpandedColumns()).thenReturn(columns);
    when(model.getPattern(conditionCol52)).thenReturn(pattern52);
    final Map<Integer, ModelMetaData> metaData = new ModelMetaDataEnhancer(model).getHeaderMetaData().getPatternsByColumnNumber();
    assertEquals(1, metaData.size());
    assertEquals(pattern52, metaData.get(0).getPattern());
    assertEquals(PatternType.LHS, metaData.get(0).getPatternType());
}
Also used : ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ArrayList(java.util.ArrayList) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) ModelMetaData(org.drools.workbench.services.verifier.plugin.client.api.ModelMetaData) Test(org.junit.Test)

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