Search in sources :

Example 1 with Action

use of org.drools.workbench.services.verifier.api.client.index.Action in project drools-wb by kiegroup.

the class RuleInspectorCache method deleteColumns.

public void deleteColumns(final int firstColumnIndex) {
    final Collection<Column> all = index.getColumns().where(Column.index().is(firstColumnIndex)).select().all();
    final Fields.FieldSelector fieldSelector = index.getRules().where(UUIDMatcher.uuid().any()).select().patterns().where(UUIDMatcher.uuid().any()).select().fields().where(UUIDMatcher.uuid().any()).select();
    final ArrayList<Action> actions = new ArrayList<>();
    final ArrayList<Condition> conditions = new ArrayList<>();
    for (final Field field : fieldSelector.all()) {
        for (final Column column : all) {
            final Collection<Action> all1 = field.getActions().where(Action.columnUUID().is(column.getUuidKey())).select().all();
            final Collection<Condition> all2 = field.getConditions().where(Condition.columnUUID().is(column.getUuidKey())).select().all();
            actions.addAll(all1);
            conditions.addAll(all2);
        }
    }
    for (final Action action : actions) {
        action.getUuidKey().retract();
    }
    for (final Condition condition : conditions) {
        condition.getUuidKey().retract();
    }
    for (final Column column : all) {
        column.getUuidKey().retract();
    }
    reset();
}
Also used : Condition(org.drools.workbench.services.verifier.api.client.index.Condition) Field(org.drools.workbench.services.verifier.api.client.index.Field) Action(org.drools.workbench.services.verifier.api.client.index.Action) Fields(org.drools.workbench.services.verifier.api.client.index.Fields) Column(org.drools.workbench.services.verifier.api.client.index.Column) ArrayList(java.util.ArrayList)

Example 2 with Action

use of org.drools.workbench.services.verifier.api.client.index.Action in project drools-wb by kiegroup.

the class ActionBuilder method addAction.

private Action addAction(final ActionCol52 actionCol, final DTCellValue52 visibleCellValue) throws BuildException {
    final Field field = resolveField(actionCol);
    final Action action = buildAction(field, visibleCellValue);
    field.getActions().add(action);
    return action;
}
Also used : Field(org.drools.workbench.services.verifier.api.client.index.Field) BRLAction(org.drools.workbench.services.verifier.api.client.index.BRLAction) FieldAction(org.drools.workbench.services.verifier.api.client.index.FieldAction) RetractAction(org.drools.workbench.services.verifier.api.client.index.RetractAction) Action(org.drools.workbench.services.verifier.api.client.index.Action)

Example 3 with Action

use of org.drools.workbench.services.verifier.api.client.index.Action 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)

Example 4 with Action

use of org.drools.workbench.services.verifier.api.client.index.Action in project drools-wb by kiegroup.

the class CellBuilder method build.

public void build() throws BuildException {
    if (baseColumn instanceof ActionCol52) {
        final Action action = builderFactory.getActionBuilder().with(rule).with(row).with(columnIndex).with((ActionCol52) baseColumn).build();
        rule.getActions().add(action);
    } else if (baseColumn instanceof ConditionCol52) {
        if (baseColumn instanceof BRLConditionVariableColumn) {
            final Condition condition = builderFactory.getBRLConditionBuilder().with((BRLConditionVariableColumn) baseColumn).with(getRealCellValue((BRLConditionVariableColumn) baseColumn, row.get(columnIndex))).with(columnIndex).build();
            rule.getConditions().add(condition);
        } else {
            final Condition condition = builderFactory.getFieldConditionsBuilder().with(resolvePattern(rule)).with((ConditionCol52) baseColumn).with(getRealCellValue((ConditionCol52) baseColumn, row.get(columnIndex))).with(columnIndex).build();
            rule.getConditions().add(condition);
        }
    }
}
Also used : Condition(org.drools.workbench.services.verifier.api.client.index.Condition) Action(org.drools.workbench.services.verifier.api.client.index.Action) ConditionCol52(org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52) ActionCol52(org.drools.workbench.models.guided.dtable.shared.model.ActionCol52) BRLConditionVariableColumn(org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)

Example 5 with Action

use of org.drools.workbench.services.verifier.api.client.index.Action in project drools-wb by kiegroup.

the class FieldInspectorUpdateTest method makeAction.

private FieldAction makeAction(final Field field) {
    final FieldAction fieldAction = new FieldAction(field, mock(Column.class), DataType.DataTypes.NUMERIC, new Values(11), configurationMock);
    final ArrayList<Action> actionsList = new ArrayList<>();
    actionsList.add(fieldAction);
    final Actions actions = new Actions(actionsList);
    when(field.getActions()).thenReturn(actions);
    return fieldAction;
}
Also used : FieldAction(org.drools.workbench.services.verifier.api.client.index.FieldAction) Action(org.drools.workbench.services.verifier.api.client.index.Action) Column(org.drools.workbench.services.verifier.api.client.index.Column) Actions(org.drools.workbench.services.verifier.api.client.index.Actions) Values(org.drools.workbench.services.verifier.api.client.index.keys.Values) ArrayList(java.util.ArrayList) FieldAction(org.drools.workbench.services.verifier.api.client.index.FieldAction)

Aggregations

Action (org.drools.workbench.services.verifier.api.client.index.Action)5 Condition (org.drools.workbench.services.verifier.api.client.index.Condition)3 ArrayList (java.util.ArrayList)2 ActionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ActionCol52)2 ConditionCol52 (org.drools.workbench.models.guided.dtable.shared.model.ConditionCol52)2 Column (org.drools.workbench.services.verifier.api.client.index.Column)2 Field (org.drools.workbench.services.verifier.api.client.index.Field)2 FieldAction (org.drools.workbench.services.verifier.api.client.index.FieldAction)2 BRLConditionVariableColumn (org.drools.workbench.models.guided.dtable.shared.model.BRLConditionVariableColumn)1 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)1 Actions (org.drools.workbench.services.verifier.api.client.index.Actions)1 BRLAction (org.drools.workbench.services.verifier.api.client.index.BRLAction)1 Fields (org.drools.workbench.services.verifier.api.client.index.Fields)1 RetractAction (org.drools.workbench.services.verifier.api.client.index.RetractAction)1 Values (org.drools.workbench.services.verifier.api.client.index.keys.Values)1