use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.
the class BPMFinderServiceImpl method getModelForProcess.
@Override
public JBPMProcessModel getModelForProcess(final String processId, final Path path) {
GenerationConfig<Optional<JBPMProcessModel>> operations = new GenerationConfig<>(Optional.empty());
operations.setPredicate(definitions -> {
if (definitions.isPresent()) {
if (!operations.getValue().isPresent()) {
Optional<Process> optional = Optional.of(bpmnFormModelGenerator.getProcess(definitions.get()));
return optional.isPresent() && optional.get().getId().equals(processId);
}
}
return false;
});
operations.setConsumer(processModel -> operations.setValue(Optional.ofNullable(processModel)));
Path rootPath = moduleService.resolveModule(path).getRootPath();
scannProcessesForType(rootPath, "bpmn2", operations);
if (!operations.getValue().isPresent()) {
scannProcessesForType(rootPath, "bpmn", operations);
}
return operations.getValue().orElse(null);
}
Aggregations