Search in sources :

Example 21 with ActionSetFieldCol52

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

the class ActionSetFieldsPage method makeResult.

@Override
public void makeResult(final GuidedDecisionTable52 model) {
    // Copy actions to decision table model. Assertion of bindings occurs in FactPatternsPage
    for (Map.Entry<Pattern52, List<ActionSetFieldCol52>> ps : patternToActionsMap.entrySet()) {
        final Pattern52 p = ps.getKey();
        // Patterns with no conditions don't get created
        if (p.getChildColumns().size() > 0) {
            final String binding = p.getBoundName();
            for (ActionSetFieldCol52 a : ps.getValue()) {
                a.setBoundName(binding);
                model.getActionCols().add(a);
            }
        }
    }
}
Also used : Pattern52(org.drools.workbench.models.guided.dtable.shared.model.Pattern52) ArrayList(java.util.ArrayList) List(java.util.List) Map(java.util.Map) IdentityHashMap(java.util.IdentityHashMap) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 22 with ActionSetFieldCol52

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

the class ActionSetFieldsPageViewImpl method makeNewActionColumn.

private ActionSetFieldCol52 makeNewActionColumn(final AvailableField f) {
    final GuidedDecisionTable52.TableFormat format = presenter.getTableFormat();
    if (format == GuidedDecisionTable52.TableFormat.EXTENDED_ENTRY) {
        final ActionSetFieldCol52 a = new ActionSetFieldCol52();
        a.setBoundName(availablePatternsSelection.getBoundName());
        a.setFactField(f.getName());
        a.setType(f.getType());
        return a;
    } else {
        final LimitedEntryActionSetFieldCol52 a = new LimitedEntryActionSetFieldCol52();
        a.setBoundName(availablePatternsSelection.getBoundName());
        a.setFactField(f.getName());
        a.setType(f.getType());
        return a;
    }
}
Also used : GuidedDecisionTable52(org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) LimitedEntryActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52) LimitedEntryActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)

Example 23 with ActionSetFieldCol52

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

the class RowExpander method addActionColumns.

private void addActionColumns() {
    for (ActionCol52 a : model.getActionCols()) {
        if (a instanceof ActionSetFieldCol52) {
            ActionSetFieldCol52 afc = (ActionSetFieldCol52) a;
            addColumn(afc);
        } else if (a instanceof ActionInsertFactCol52) {
            ActionInsertFactCol52 aif = (ActionInsertFactCol52) a;
            addColumn(aif);
        }
    }
}
Also used : ActionInsertFactCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 24 with ActionSetFieldCol52

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

the class ConditionColumnSynchronizerTest method actionUpdatePattern.

private ActionCol52 actionUpdatePattern(final String boundName) {
    final ActionSetFieldCol52 action = new ActionSetFieldCol52();
    action.setBoundName(boundName);
    action.setFactField("age");
    action.setHeader("action1");
    return action;
}
Also used : ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)

Example 25 with ActionSetFieldCol52

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

the class ActionSetFieldCol52DefinitionBuilderTest method simpleActionUpdateField.

@Test
public void simpleActionUpdateField() {
    final AtomicBoolean calledBack = new AtomicBoolean(false);
    setupPatternAndCondition();
    final ActionSetFieldCol52 asf = new ActionSetFieldCol52();
    asf.setBoundName("$p");
    asf.setFactField("name");
    asf.setUpdate(true);
    model.getActionCols().add(asf);
    when(dmo.getFieldType(eq("Person"), eq("name"))).thenReturn(DataType.TYPE_STRING);
    builder.generateDefinition(dtPresenter, asf, (String definition) -> {
        calledBack.set(true);
        assertEquals("modify( $p ) {<br/>" + "setName( \"x\" )<br/>" + "}", definition);
    });
    assertTrue(calledBack.get());
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ActionSetFieldCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52) Test(org.junit.Test)

Aggregations

ActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionSetFieldCol52)75 Test (org.junit.Test)49 Pattern52 (org.drools.workbench.models.guided.dtable.shared.model.Pattern52)39 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)38 ActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionInsertFactCol52)29 GuidedDecisionTable52 (org.drools.workbench.models.guided.dtable.shared.model.GuidedDecisionTable52)27 LimitedEntryActionSetFieldCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionSetFieldCol52)23 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)16 LimitedEntryConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryConditionCol52)16 LimitedEntryActionInsertFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.LimitedEntryActionInsertFactCol52)12 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)12 PackageDataModelOracleBaselinePayload (org.kie.workbench.common.services.datamodel.model.PackageDataModelOracleBaselinePayload)12 AsyncPackageDataModelOracle (org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracle)12 Path (org.uberfire.backend.vfs.Path)12 ModelField (org.kie.soup.project.datamodel.oracle.ModelField)11 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)11 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)10 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)9 ActionRetractFactCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionRetractFactCol52)8 AttributeCol52 (org.drools.workbench.models.guided.dtable.shared.model.AttributeCol52)8