Search in sources :

Example 1 with Rule

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

the class DTableUpdateManager method makeRule.

public void makeRule(final GuidedDecisionTable52 model, final HeaderMetaData headerMetaData, final FactTypes factTypes, final int rowIndex) throws BuildException {
    PortablePreconditions.checkNotNull("model", model);
    PortablePreconditions.checkNotNull("fieldTypes", factTypes);
    PortablePreconditions.checkNotNull("index", rowIndex);
    final Rule rule = new BuilderFactory(new VerifierColumnUtilities(model, headerMetaData, factTypes), this.index, model, headerMetaData, configuration).getRuleBuilder().with(rowIndex).build();
    analyzer.newRule(rule);
    analyzer.analyze();
}
Also used : Rule(org.drools.workbench.services.verifier.api.client.index.Rule) VerifierColumnUtilities(org.drools.workbench.services.verifier.plugin.client.builders.VerifierColumnUtilities) BuilderFactory(org.drools.workbench.services.verifier.plugin.client.builders.BuilderFactory)

Example 2 with Rule

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

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

the class RuleInspectorCache method reset.

public void reset() {
    for (final RuleInspector ruleInspector : ruleInspectors.values()) {
        ruleInspector.clearChecks();
    }
    ruleInspectors.clear();
    generalChecks.clear();
    for (final Rule rule : index.getRules().where(Rule.uuid().any()).select().all()) {
        add(new RuleInspector(rule, checkStorage, this, configuration));
    }
    generalChecks.add(new SingleRangeCheck(configuration, ruleInspectors.values()));
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector) SingleRangeCheck(org.drools.workbench.services.verifier.core.checks.SingleRangeCheck) Rule(org.drools.workbench.services.verifier.api.client.index.Rule)

Example 4 with Rule

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

the class RuleInspectorCache method removeRow.

public RuleInspector removeRow(final int rowNumber) {
    final Rule rule = getRule(rowNumber);
    final RuleInspector remove = ruleInspectors.remove(rule);
    index.getRules().remove(rule);
    return remove;
}
Also used : RuleInspector(org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector) Rule(org.drools.workbench.services.verifier.api.client.index.Rule)

Example 5 with Rule

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

the class RuleInspectorCacheTest method setUp.

@Before
public void setUp() throws Exception {
    final Index index = new IndexImpl();
    final AnalyzerConfiguration configuration = new AnalyzerConfigurationMock();
    cache = new RuleInspectorCache(index, configuration);
    cache.addRule(new Rule(0, configuration));
    cache.addRule(new Rule(1, configuration));
    cache.addRule(new Rule(2, configuration));
    cache.addRule(new Rule(3, configuration));
    cache.addRule(new Rule(4, configuration));
    cache.addRule(new Rule(5, configuration));
    cache.addRule(new Rule(6, configuration));
}
Also used : AnalyzerConfigurationMock(org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock) RuleInspectorCache(org.drools.workbench.services.verifier.core.cache.RuleInspectorCache) IndexImpl(org.drools.workbench.services.verifier.api.client.index.IndexImpl) Index(org.drools.workbench.services.verifier.api.client.index.Index) Rule(org.drools.workbench.services.verifier.api.client.index.Rule) AnalyzerConfiguration(org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration) Before(org.junit.Before)

Aggregations

Rule (org.drools.workbench.services.verifier.api.client.index.Rule)6 Column (org.drools.workbench.services.verifier.api.client.index.Column)2 RuleInspector (org.drools.workbench.services.verifier.core.cache.inspectors.RuleInspector)2 BuilderFactory (org.drools.workbench.services.verifier.plugin.client.builders.BuilderFactory)2 VerifierColumnUtilities (org.drools.workbench.services.verifier.plugin.client.builders.VerifierColumnUtilities)2 Before (org.junit.Before)2 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 AnalyzerConfiguration (org.drools.workbench.services.verifier.api.client.configuration.AnalyzerConfiguration)1 Columns (org.drools.workbench.services.verifier.api.client.index.Columns)1 Index (org.drools.workbench.services.verifier.api.client.index.Index)1 IndexImpl (org.drools.workbench.services.verifier.api.client.index.IndexImpl)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 RuleInspectorCache (org.drools.workbench.services.verifier.core.cache.RuleInspectorCache)1 AnalyzerConfigurationMock (org.drools.workbench.services.verifier.core.checks.AnalyzerConfigurationMock)1 SingleRangeCheck (org.drools.workbench.services.verifier.core.checks.SingleRangeCheck)1