Search in sources :

Example 1 with MigrationPipeline

use of org.kie.workbench.common.forms.migration.tool.pipelines.MigrationPipeline in project kie-wb-common by kiegroup.

the class FormsMigrationTool method run.

@Override
public void run(ToolConfig config, SystemAccess system) {
    this.config = config;
    this.system = system;
    this.niogitDir = config.getTarget();
    system.out().println("\nStarting Forms migration");
    if (projectMigrationWasExecuted()) {
        try {
            MigrationSetup.configureProperties(system, niogitDir);
            weldContainer = new Weld().initialize();
            cdiWrapper = weldContainer.instance().select(MigrationServicesCDIWrapper.class).get();
            if (systemMigrationWasExecuted()) {
                pipeline = new MigrationPipeline();
                if (!config.isBatch()) {
                    system.out().println(pipeline.getAllInfo());
                    Collection<String> validResponses = Arrays.asList("yes", "no");
                    String response;
                    do {
                        response = system.console().readLine("\nDo you want to continue? [yes/no]: ").toLowerCase();
                    } while (!validResponses.contains(response));
                    if ("no".equals(response)) {
                        return;
                    }
                }
                WorkspaceProjectService service = weldContainer.instance().select(WorkspaceProjectService.class).get();
                service.getAllWorkspaceProjects().forEach(this::processWorkspaceProject);
            }
        } finally {
            if (weldContainer != null) {
                try {
                    cdiWrapper = null;
                    weldContainer.close();
                } catch (Exception ex) {
                }
            }
        }
    }
}
Also used : WorkspaceProjectService(org.guvnor.common.services.project.service.WorkspaceProjectService) MigrationPipeline(org.kie.workbench.common.forms.migration.tool.pipelines.MigrationPipeline) IOException(org.uberfire.java.nio.IOException) Weld(org.jboss.weld.environment.se.Weld)

Aggregations

WorkspaceProjectService (org.guvnor.common.services.project.service.WorkspaceProjectService)1 Weld (org.jboss.weld.environment.se.Weld)1 MigrationPipeline (org.kie.workbench.common.forms.migration.tool.pipelines.MigrationPipeline)1 IOException (org.uberfire.java.nio.IOException)1