Search in sources :

Example 1 with DefaultIndexBuilder

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

the class TestScenarioFileIndexer method fillIndexBuilder.

@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
    final String content = ioService.readAllString(path);
    final Scenario model = ScenarioXMLPersistence.getInstance().unmarshal(content);
    final ModuleDataModelOracle dmo = getModuleDataModelOracle(path);
    final Module project = moduleService.resolveModule(Paths.convert(path));
    final Package pkg = moduleService.resolvePackage(Paths.convert(path));
    final DefaultIndexBuilder builder = new DefaultIndexBuilder(Paths.convert(path).getFileName(), project, pkg);
    final TestScenarioIndexVisitor visitor = new TestScenarioIndexVisitor(dmo, builder, model);
    visitor.visit();
    addReferencedResourcesToIndexBuilder(builder, visitor);
    return builder;
}
Also used : ModuleDataModelOracle(org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle) 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) Scenario(org.drools.workbench.models.testscenarios.shared.Scenario)

Example 2 with DefaultIndexBuilder

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

the class GuidedDecisionTableGraphFileIndexer method fillIndexBuilder.

@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
    final String content = ioService.readAllString(path);
    final GuidedDecisionTableEditorGraphModel model = GuidedDTGraphXMLPersistence.getInstance().unmarshal(content);
    final DefaultIndexBuilder builder = getIndexBuilder(path);
    if (builder == null) {
        return null;
    }
    final GuidedDecisionTableGraphModelIndexVisitor visitor = new GuidedDecisionTableGraphModelIndexVisitor(builder, model);
    visitor.visit();
    addReferencedResourcesToIndexBuilder(builder, visitor);
    return builder;
}
Also used : GuidedDecisionTableEditorGraphModel(org.drools.workbench.screens.guided.dtable.model.GuidedDecisionTableEditorGraphModel) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)

Example 3 with DefaultIndexBuilder

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

the class EnumFileIndexer method fillIndexBuilder.

@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
    final String enumDefinition = ioService.readAllString(path);
    final DataEnumLoader enumLoader = new DataEnumLoader(enumDefinition, mvelEvaluator);
    if (enumLoader.hasErrors()) {
        logger.info("Unable to index '" + path.toUri().toString() + "'. Related errors follow:");
        for (String e : enumLoader.getErrors()) {
            logger.info(e);
        }
    }
    final ModuleDataModelOracle dmo = getModuleDataModelOracle(path);
    final DefaultIndexBuilder builder = getIndexBuilder(path);
    if (builder == null) {
        return null;
    }
    final EnumIndexVisitor visitor = new EnumIndexVisitor(dmo, path, enumLoader);
    visitor.visit();
    addReferencedResourcesToIndexBuilder(builder, visitor);
    return builder;
}
Also used : ModuleDataModelOracle(org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder) DataEnumLoader(org.kie.workbench.common.services.datamodel.backend.server.builder.util.DataEnumLoader)

Example 4 with DefaultIndexBuilder

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

the class GuidedRuleTemplateFileIndexer method fillIndexBuilder.

@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
    final String content = ioService.readAllString(path);
    final TemplateModel model = RuleTemplateModelXMLPersistenceImpl.getInstance().unmarshal(content);
    final DefaultIndexBuilder builder = getIndexBuilder(path);
    if (builder == null) {
        return null;
    }
    final GuidedRuleTemplateIndexVisitor visitor = new GuidedRuleTemplateIndexVisitor(builder, model);
    visitor.visit();
    addReferencedResourcesToIndexBuilder(builder, visitor);
    return builder;
}
Also used : TemplateModel(org.drools.workbench.models.guided.template.shared.TemplateModel) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)

Example 5 with DefaultIndexBuilder

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

the class GuidedScoreCardFileIndexer method fillIndexBuilder.

@Override
public DefaultIndexBuilder fillIndexBuilder(final Path path) throws Exception {
    final String content = ioService.readAllString(path);
    final ScoreCardModel model = GuidedScoreCardXMLPersistence.getInstance().unmarshall(content);
    final ModuleDataModelOracle dmo = getModuleDataModelOracle(path);
    final DefaultIndexBuilder builder = getIndexBuilder(path);
    if (builder == null) {
        return null;
    }
    final GuidedScoreCardIndexVisitor visitor = new GuidedScoreCardIndexVisitor(dmo, model);
    visitor.visit();
    addReferencedResourcesToIndexBuilder(builder, visitor);
    return builder;
}
Also used : ScoreCardModel(org.drools.workbench.models.guided.scorecard.shared.ScoreCardModel) ModuleDataModelOracle(org.kie.soup.project.datamodel.oracle.ModuleDataModelOracle) DefaultIndexBuilder(org.kie.workbench.common.services.refactoring.backend.server.indexing.DefaultIndexBuilder)

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