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);
}
use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.
the class BPMNFormModelGeneratorImpl method generateTaskFormModels.
@Override
public List<TaskFormModel> generateTaskFormModels(Definitions source, Path path) {
Process process = getProcess(source);
final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path));
if (process != null) {
ProcessTaskFormsGenerationResult result = readUserTaskFormVariables(process);
return result.getAllTaskFormVariables().stream().filter(taskFormVariables -> {
if (!taskFormVariables.isValid()) {
logger.warn(generateErrorMessage(taskFormVariables));
return false;
}
return true;
}).map(taskFormVariables -> taskFormVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader))).collect(Collectors.toList());
}
return Collections.emptyList();
}
use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.
the class SubProcessConverter method convertEmbeddedSubprocessNode.
private SubProcessPropertyWriter convertEmbeddedSubprocessNode(Node<View<EmbeddedSubprocess>, ?> n) {
SubProcess process = bpmn2.createSubProcess();
process.setId(n.getUUID());
SubProcessPropertyWriter p = propertyWriterFactory.of(process);
EmbeddedSubprocess definition = n.getContent().getDefinition();
BPMNGeneralSet general = definition.getGeneral();
p.setName(general.getName().getValue());
p.setDocumentation(general.getDocumentation().getValue());
p.setOnEntryAction(definition.getOnEntryAction());
p.setOnExitAction(definition.getOnExitAction());
p.setAsync(definition.getIsAsync().getValue());
ProcessData processData = definition.getProcessData();
p.setProcessVariables(processData.getProcessVariables());
p.setSimulationSet(definition.getSimulationSet());
p.setBounds(n.getContent().getBounds());
return p;
}
use of org.eclipse.bpmn2.Process in project kie-wb-common by kiegroup.
the class BPMNAnalyzer method read.
public BPMNProcess read(InputStream inputStream) {
Definitions definitions = BPMN2Utils.getDefinitions(inputStream);
Optional<Process> processOptional = findProcess(definitions);
if (!processOptional.isPresent()) {
throw new RuntimeException("Cannot find Process on definitions");
}
Process process = processOptional.get();
BusinessProcessFormModel formModel = new BusinessProcessFormModel(process.getId(), process.getName(), new ArrayList<>());
BPMNProcess bpmmProcess = new BPMNProcess(formModel);
readContainerUserTasks(process, bpmmProcess::addTaskFormModel);
return bpmmProcess;
}
Aggregations