Search in sources :

Example 1 with Column

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

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

the class DTableUpdateManager method newColumn.

public void newColumn(final GuidedDecisionTable52 model, final HeaderMetaData headerMetaData, final FactTypes factTypes, final int columnIndex) throws BuildException {
    PortablePreconditions.checkNotNull("model", model);
    PortablePreconditions.checkNotNull("headerMetaData", headerMetaData);
    PortablePreconditions.checkNotNull("fieldTypes", factTypes);
    PortablePreconditions.checkNotNull("columnIndex", columnIndex);
    final BuilderFactory builderFactory = new BuilderFactory(new VerifierColumnUtilities(model, headerMetaData, factTypes), index, model, headerMetaData, configuration);
    final Column column = builderFactory.getColumnBuilder().with(columnIndex).build();
    analyzer.newColumn(column);
    int rowIndex = 0;
    for (final List<DTCellValue52> row : model.getData()) {
        final BaseColumn baseColumn = model.getExpandedColumns().get(columnIndex);
        final Rule rule = index.getRules().where(Rule.index().is(rowIndex)).select().first();
        builderFactory.getCellBuilder().with(columnIndex).with(baseColumn).with(rule).with(row).build();
        rowIndex++;
    }
    analyzer.resetChecks();
    analyzer.analyze();
}
Also used : BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Column(org.drools.workbench.services.verifier.api.client.index.Column) BaseColumn(org.drools.workbench.models.guided.dtable.shared.model.BaseColumn) Rule(org.drools.workbench.services.verifier.api.client.index.Rule) VerifierColumnUtilities(org.drools.workbench.services.verifier.plugin.client.builders.VerifierColumnUtilities) DTCellValue52(org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52) BuilderFactory(org.drools.workbench.services.verifier.plugin.client.builders.BuilderFactory)

Example 3 with Column

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

the class QueryableIndexTest method setUp.

@Before
public void setUp() throws Exception {
    configuration = new AnalyzerConfigurationMock();
    final Rules rules = new Rules();
    rules.add(new Rule(0, configuration));
    rules.add(new Rule(1, configuration));
    rules.add(new Rule(2, configuration));
    final Columns columns = new Columns();
    firstColumn = new Column(0, configuration);
    columns.add(firstColumn);
    columns.add(new Column(1, configuration));
    final ObjectTypes objectTypes = new ObjectTypes();
    objectTypes.add(new ObjectType("Person", configuration));
    objectTypes.add(new ObjectType("Address", configuration));
    queryableIndex = new QueryableIndex(rules, columns, objectTypes);
}
Also used : ObjectType(org.drools.workbench.services.verifier.api.client.index.ObjectType) Column(org.drools.workbench.services.verifier.api.client.index.Column) AnalyzerConfigurationMock(org.drools.workbench.services.verifier.api.client.AnalyzerConfigurationMock) Columns(org.drools.workbench.services.verifier.api.client.index.Columns) ObjectTypes(org.drools.workbench.services.verifier.api.client.index.ObjectTypes) Rule(org.drools.workbench.services.verifier.api.client.index.Rule) Rules(org.drools.workbench.services.verifier.api.client.index.Rules) Before(org.junit.Before)

Aggregations

Column (org.drools.workbench.services.verifier.api.client.index.Column)3 Rule (org.drools.workbench.services.verifier.api.client.index.Rule)2 ArrayList (java.util.ArrayList)1 BaseColumn (org.drools.workbench.models.guided.dtable.shared.model.BaseColumn)1 DTCellValue52 (org.drools.workbench.models.guided.dtable.shared.model.DTCellValue52)1 AnalyzerConfigurationMock (org.drools.workbench.services.verifier.api.client.AnalyzerConfigurationMock)1 Action (org.drools.workbench.services.verifier.api.client.index.Action)1 Columns (org.drools.workbench.services.verifier.api.client.index.Columns)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 ObjectType (org.drools.workbench.services.verifier.api.client.index.ObjectType)1 ObjectTypes (org.drools.workbench.services.verifier.api.client.index.ObjectTypes)1 Rules (org.drools.workbench.services.verifier.api.client.index.Rules)1 BuilderFactory (org.drools.workbench.services.verifier.plugin.client.builders.BuilderFactory)1 VerifierColumnUtilities (org.drools.workbench.services.verifier.plugin.client.builders.VerifierColumnUtilities)1 Before (org.junit.Before)1