Search in sources :

Example 1 with BPMNAnalyzer

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

the class FormDefinitionGeneratorForBPMNWithComplexVariableTest method getProcessFormModels.

@Override
protected List<JBPMFormModel> getProcessFormModels() {
    BPMNAnalyzer analyzer = new BPMNAnalyzer();
    BPMNProcess process = analyzer.read(this.getClass().getResourceAsStream(BPMN_RESOURCES + INVOICES_BPMN));
    return process.getFormModels();
}
Also used : BPMNProcess(org.kie.workbench.common.forms.migration.tool.bpmn.BPMNProcess) BPMNAnalyzer(org.kie.workbench.common.forms.migration.tool.bpmn.BPMNAnalyzer)

Example 2 with BPMNAnalyzer

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

the class BPMNFormAdapter method readWorkspaceBPMNModels.

protected void readWorkspaceBPMNModels() {
    BPMNAnalyzer analyzer = new BPMNAnalyzer();
    Files.walkFileTree(Paths.convert(migrationContext.getWorkspaceProject().getRootPath()), new SimpleFileVisitor<Path>() {

        @Override
        public FileVisitResult visitFile(org.uberfire.java.nio.file.Path visitedPath, BasicFileAttributes attrs) throws IOException {
            org.uberfire.backend.vfs.Path visitedVFSPath = Paths.convert(visitedPath);
            String fileName = visitedVFSPath.getFileName();
            File file = visitedPath.toFile();
            if (file.isFile()) {
                if (fileName.endsWith("." + FormsMigrationConstants.BPMN_EXTENSION) || fileName.endsWith("." + FormsMigrationConstants.BPMN2_EXTENSION)) {
                    try {
                        BPMNProcess process = analyzer.read(migrationContext.getCDIWrapper().getIOService().newInputStream(visitedPath));
                        if (process != null) {
                            workspaceBPMNFormModels.addAll(process.getFormModels());
                        } else {
                            migrationContext.getSystem().console().format(FormsMigrationConstants.BPMN_PARSING_ERROR, FormsMigrationConstants.WARNING, fileName);
                        }
                    } catch (Exception ex) {
                        migrationContext.getSystem().console().format(FormsMigrationConstants.BPMN_PARSING_ERROR, FormsMigrationConstants.WARNING, fileName);
                    }
                }
            }
            return FileVisitResult.CONTINUE;
        }
    });
}
Also used : Path(org.uberfire.java.nio.file.Path) BPMNProcess(org.kie.workbench.common.forms.migration.tool.bpmn.BPMNProcess) Path(org.uberfire.java.nio.file.Path) FileVisitResult(org.uberfire.java.nio.file.FileVisitResult) IOException(org.uberfire.java.nio.IOException) IOException(org.uberfire.java.nio.IOException) BPMNAnalyzer(org.kie.workbench.common.forms.migration.tool.bpmn.BPMNAnalyzer) File(java.io.File) BasicFileAttributes(org.uberfire.java.nio.file.attribute.BasicFileAttributes)

Example 3 with BPMNAnalyzer

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

the class FormDefinitionGeneratorForBPMNForWrongTaskFormNameTest method getProcessFormModels.

@Override
protected List<JBPMFormModel> getProcessFormModels() {
    BPMNAnalyzer analyzer = new BPMNAnalyzer();
    BPMNProcess process = analyzer.read(this.getClass().getResourceAsStream(BPMN_RESOURCES + INVOICES_BPMN));
    return process.getFormModels();
}
Also used : BPMNProcess(org.kie.workbench.common.forms.migration.tool.bpmn.BPMNProcess) BPMNAnalyzer(org.kie.workbench.common.forms.migration.tool.bpmn.BPMNAnalyzer)

Aggregations

BPMNAnalyzer (org.kie.workbench.common.forms.migration.tool.bpmn.BPMNAnalyzer)3 BPMNProcess (org.kie.workbench.common.forms.migration.tool.bpmn.BPMNProcess)3 File (java.io.File)1 IOException (org.uberfire.java.nio.IOException)1 FileVisitResult (org.uberfire.java.nio.file.FileVisitResult)1 Path (org.uberfire.java.nio.file.Path)1 BasicFileAttributes (org.uberfire.java.nio.file.attribute.BasicFileAttributes)1