Search in sources :

Example 1 with Fields

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

Aggregations

ArrayList (java.util.ArrayList)1 Action (org.drools.workbench.services.verifier.api.client.index.Action)1 Column (org.drools.workbench.services.verifier.api.client.index.Column)1 Condition (org.drools.workbench.services.verifier.api.client.index.Condition)1 Field (org.drools.workbench.services.verifier.api.client.index.Field)1 Fields (org.drools.workbench.services.verifier.api.client.index.Fields)1