use of io.automatiko.engine.workflow.compiler.xml.XmlProcessReader in project automatiko-engine by automatiko-io.
the class BpmnProcessCompiler method parse.
public List<Process> parse(ProcessConfig config, Resource... resources) {
try {
List<Process> processes = new ArrayList<>();
XmlProcessReader xmlReader = new XmlProcessReader(getSemanticModules(), Thread.currentThread().getContextClassLoader());
configureProcessReader(xmlReader, config);
for (Resource resource : resources) {
processes.addAll(xmlReader.read(resource.getReader()));
}
return processes;
} catch (Exception e) {
throw new BpmnProcessReaderException(e);
}
}
use of io.automatiko.engine.workflow.compiler.xml.XmlProcessReader in project automatiko-engine by automatiko-io.
the class BpmnProcessCompiler method from.
public List<BpmnProcess> from(ProcessConfig config, Resource... resources) {
try {
List<Process> processes = new ArrayList<>();
for (Resource resource : resources) {
XmlProcessReader xmlReader = new XmlProcessReader(getSemanticModules(), Thread.currentThread().getContextClassLoader());
configureProcessReader(xmlReader, config);
processes.addAll(xmlReader.read(resource.getReader()));
}
List<BpmnProcess> bpmnProcesses = processes.stream().map(p -> create(p, config)).filter(p -> p != null).collect(Collectors.toList());
bpmnProcesses.forEach(p -> {
for (Node node : ((WorkflowProcess) p.process()).getNodesRecursively()) {
processNode(node, bpmnProcesses);
}
});
return (List<BpmnProcess>) bpmnProcesses;
} catch (Exception e) {
throw new BpmnProcessReaderException(e);
}
}
use of io.automatiko.engine.workflow.compiler.xml.XmlProcessReader in project automatiko-engine by automatiko-io.
the class ProcessCodegen method parseProcessFile.
private static Collection<? extends Process> parseProcessFile(Resource r) {
try {
XmlProcessReader xmlReader = new XmlProcessReader(BPMN_SEMANTIC_MODULES, Thread.currentThread().getContextClassLoader());
Collection<? extends Process> parsed = xmlReader.read(r.getReader());
parsed.forEach(p -> p.setResource(r));
return parsed;
} catch (SAXException | IOException e) {
throw new ProcessParsingException("Could not parse file " + r.getSourcePath(), e);
}
}
use of io.automatiko.engine.workflow.compiler.xml.XmlProcessReader in project automatiko-engine by automatiko-io.
the class XmlBPMNProcessDumper method readProcess.
@Override
public Process readProcess(String processXml) {
SemanticModules semanticModules = new SemanticModules();
semanticModules.addSemanticModule(new BPMNSemanticModule());
semanticModules.addSemanticModule(new BPMNExtensionsSemanticModule());
semanticModules.addSemanticModule(new BPMNDISemanticModule());
XmlProcessReader xmlReader = new XmlProcessReader(semanticModules, Thread.currentThread().getContextClassLoader());
try {
List<Process> processes = xmlReader.read(new StringReader(processXml));
return processes.get(0);
} catch (Throwable t) {
t.printStackTrace();
return null;
}
}
Aggregations