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; }
@Override public BusinessProcessFormModel generateProcessFormModel(Definitions source, Path path) { Process process = getProcess(source); if (process != null) { final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path)); List<ModelProperty> properties = process.getProperties().stream().map(property -> { String varName = property.getId(); String varType = BPMNVariableUtils.getRealTypeForInput(property.getItemSubjectRef().getStructureRef()); Variable variable = new Variable(varName, varType); variable.setInput(true); variable.setOutput(true); return createModelProperty(variable, projectClassLoader); }).filter(modelProperty -> modelProperty != null) .sorted((property1, property2) -> property1.getName().compareToIgnoreCase(property2.getName())).collect(Collectors.toList()); return new BusinessProcessFormModel(process.getId(), process.getName(), properties); } return null; }
metadata.setTitle(definitionResolver.getProcess().getName());
process.getId()); assertEquals("BPSimple", process.getName()); assertTrue(process.isIsExecutable()); assertEquals("true",
process.getId()); assertEquals("BPSimple", process.getName()); assertTrue(process.isIsExecutable()); assertEquals("true",
private BpmnNode convertProcessNode(String id, Process process) { Node<View<D>, Edge> diagramNode = delegate.factoryManager.newNode(id, getDiagramClass()); D definition = diagramNode.getContent().getDefinition(); ProcessPropertyReader e = delegate.propertyReaderFactory.of(process); definition.setDiagramSet(new DiagramSet(new Name(process.getName()), new Documentation(e.getDocumentation()), new Id(process.getId()), new Package(e.getPackage()), new Version(e.getVersion()), new AdHoc(e.isAdHoc()), new ProcessInstanceDescription(e.getDescription()), new Executable(process.isIsExecutable())) ); definition.setCaseManagementSet(new CaseManagementSet(new CaseIdPrefix(e.getCaseIdPrefix()), new CaseRoles(e.getCaseRoles()), new CaseFileVariables(e.getCaseFileVariables()) )); definition.setProcessData(new ProcessData(new ProcessVariables(e.getProcessVariables()))); diagramNode.getContent().setBounds(e.getBounds()); definition.setFontSet(e.getFontSet()); definition.setBackgroundSet(e.getBackgroundSet()); return BpmnNode.of(diagramNode); }