Search in sources :

Example 6 with DefaultIndexBuilder

use of org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder in project drools-wb by kiegroup.

the class DslFileIndexer method getIndexBuilder.

@Override
protected DefaultIndexBuilder getIndexBuilder(Path path) {
    final Module module = moduleService.resolveModule(Paths.convert(path));
    if (module == null) {
        logger.error("Unable to index " + path.toUri().toString() + ": module could not be resolved.");
        return null;
    }
    final Package pkg = moduleService.resolvePackage(Paths.convert(path));
    if (pkg == null) {
        logger.error("Unable to index " + path.toUri().toString() + ": package could not be resolved.");
        return null;
    }
    // responsible for basic index info: module name, branch, etc
    return new DefaultIndexBuilder(Paths.convert(path).getFileName(), module, pkg) {

        @Override
        public DefaultIndexBuilder addGenerator(final IndexElementsGenerator generator) {
            // Don't include the rule created to parse DSL
            if (generator instanceof Resource && ((Resource) generator).getResourceFQN().endsWith(MOCK_RULE_NAME)) {
                return this;
            }
            return super.addGenerator(generator);
        }
    };
}
Also used : IndexElementsGenerator(org.kie.workbench.common.services.refactoring.IndexElementsGenerator) Resource(org.kie.workbench.common.services.refactoring.Resource) Package(org.guvnor.common.services.project.model.Package) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder) Module(org.guvnor.common.services.project.model.Module)

Aggregations

DefaultIndexBuilder (org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)6 ModuleDataModelOracle (org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle)3 Module (org.guvnor.common.services.project.model.Module)2 Package (org.guvnor.common.services.project.model.Package)2 ScoreCardModel (org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel)1 TemplateModel (org.drools.workbench.models.guided.template.shared.TemplateModel)1 Scenario (org.drools.workbench.models.testscenarios.shared.Scenario)1 GuidedDecisionTableEditorGraphModel (org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel)1 DataEnumLoader (org.kie.workbench.common.services.datamodel.backend.server.builder.util.DataEnumLoader)1 IndexElementsGenerator (org.kie.workbench.common.services.refactoring.IndexElementsGenerator)1 Resource (org.kie.workbench.common.services.refactoring.Resource)1