public void setProcessVariables(ProcessVariables processVariables) { String value = processVariables.getValue(); DeclarationList declarationList = DeclarationList.fromString(value); List<Property> properties = process.getProperties(); declarationList.getDeclarations().forEach(decl -> { VariableScope.Variable variable = variableScope.declare(this.process.getId(), decl.getIdentifier(), decl.getType()); properties.add(variable.getTypedIdentifier()); this.itemDefinitions.add(variable.getTypeDeclaration()); }); }
protected void applyProcessProperties(Process process, Map<String, String> properties) { if (properties.get("processn") != null) { process.setName(StringEscapeUtils.escapeXml(properties.get("processn"))); } else { process.setName(""); process.setAuditing(audit); process.setProcessType(ProcessType.getByName(properties.get("processtype"))); process.setIsClosed(Boolean.parseBoolean(properties.get("isclosed"))); process.setIsExecutable(Boolean.parseBoolean(properties.get("executable"))); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("package")); process.getAnyAttribute().add(extensionEntry); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("version")); process.getAnyAttribute().add(extensionEntry); process.setMonitoring(monitoring); ImportType importType = DroolsFactory.eINSTANCE.createImportType(); importType.setName(importParts[0]); if (process.getExtensionValues() == null || process.getExtensionValues().size() < 1) { ExtensionAttributeValue extensionElement = Bpmn2Factory.eINSTANCE.createExtensionAttributeValue(); process.getExtensionValues().add(extensionElement); process.getExtensionValues().get(0).getValue().add(extensionElementEntry);
public ProcessPropertyReader(Process element, BPMNDiagram diagram, BPMNShape shape, double resolutionFactor) { super(element, diagram, shape, resolutionFactor); this.process = element; this.flowElements = process.getFlowElements().stream() .collect(Collectors.toMap(FlowElement::getId, Function.identity())); }
public BpmnNode convertProcess() { Process process = delegate.definitionResolver.getProcess(); String definitionsId = delegate.definitionResolver.getDefinitions().getId(); BpmnNode processRoot = convertProcessNode(definitionsId, process); Map<String, BpmnNode> nodes = delegate.convertChildNodes(processRoot, process.getFlowElements(), process.getLaneSets()); delegate.convertEdges(processRoot, Stream.concat(process.getFlowElements().stream(), process.getArtifacts().stream()).collect(Collectors.toList()), nodes); return processRoot; }
public void revisitLanes(Definitions def) { List<RootElement> rootElements = def.getRootElements(); for (RootElement root : rootElements) { if (root instanceof Process) { Process process = (Process) root; if ((process.getLaneSets() == null || process.getLaneSets().size() < 1) && _lanes.size() > 0) { LaneSet ls = Bpmn2Factory.eINSTANCE.createLaneSet(); for (Lane lane : _lanes) { ls.getLanes().add(lane); List<FlowNode> laneFlowNodes = lane.getFlowNodeRefs(); for (FlowNode fl : laneFlowNodes) { process.getFlowElements().add(fl); } } process.getLaneSets().add(ls); } } } }
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; }
((Process) rootElement).isIsExecutable() + ""); props.put(ID, rootElement.getId()); if (pr.getName() != null && pr.getName().length() > 0) { props.put(PROCESSN, StringEscapeUtils.unescapeXml(((Process) rootElement).getName())); List<Property> processProperties = ((Process) rootElement).getProperties(); if (processProperties != null && processProperties.size() > 0) { String propVal = ""; Iterator<FeatureMap.Entry> iter = ((Process) rootElement).getAnyAttribute().iterator(); while (iter.hasNext()) { FeatureMap.Entry entry = iter.next(); marshallStencil("BPMNDiagram", generator); linkSequenceFlows(((Process) rootElement).getFlowElements()); marshallProcess((Process) rootElement, def,
rootLevelProcess.getProperties().add(prop); ((Definitions) baseElt).getRootElements().add(itemdef); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("adhocprocess")); rootLevelProcess.getAnyAttribute().add(extensionEntry); rootLevelProcess.setId(properties.get("id")); applyProcessProperties(rootLevelProcess, properties); rootLevelProcess.getProperties().add(prop); ((Definitions) baseElt).getRootElements().add(itemdef); SimpleFeatureMapEntry extensionEntry = new SimpleFeatureMapEntry(extensionAttribute, properties.get("adhocprocess")); rootLevelProcess.getAnyAttribute().add(extensionEntry); rootLevelProcess.setId(properties.get("id")); applyProcessProperties(rootLevelProcess, properties); rootLevelProcess.getFlowElements().add((Task) child); } else if (child instanceof CallActivity) { rootLevelProcess.getFlowElements().add((CallActivity) child); } else if (child instanceof RootElement) { ((Definitions) baseElt).getRootElements().add((RootElement) child); } else if (child instanceof SequenceFlow) { rootLevelProcess.getFlowElements().add((SequenceFlow) child);
process.getId()); assertEquals("BPSimple", process.getName()); assertTrue(process.isIsExecutable()); assertEquals("true", getProcessPropertyValue(process, getProcessPropertyValue(process, "version")); assertNotNull(process.getDocumentation()); assertFalse(process.getDocumentation().isEmpty()); assertEquals("<![CDATA[This is a\nsimple\nprocess]]>", process.getDocumentation().get(0).getText()); assertEquals("<![CDATA[This is the\nProcess\nInstance\nDescription]]>", getProcessExtensionValue(process,
public void updateIDs(Definitions def) { // data object id update List<RootElement> rootElements = def.getRootElements(); for (RootElement root : rootElements) { if (root instanceof Process) { Process process = (Process) root; if (process.getId() != null) { String processId = process.getId().trim(); processId = processId.replaceAll("\\s", ""); process.setId(processId); } List<FlowElement> flowElements = process.getFlowElements(); for (FlowElement fe : flowElements) { if (fe instanceof DataObject) { DataObject da = (DataObject) fe; if (da.getName() != null) { String daId = da.getName().trim(); daId = daId.replaceAll("\\W", ""); da.setId(daId); } } } } } }
@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; }
public static boolean isContainerAdHoc(FlowElementsContainer container) { if (container instanceof Process) { Process process = (Process) container; Iterator<FeatureMap.Entry> iter = process.getAnyAttribute().iterator(); while(iter.hasNext()) { FeatureMap.Entry entry = iter.next(); if(entry.getEStructuralFeature().getName().equals("adHoc")) { return Boolean.parseBoolean(((String)entry.getValue()).trim()); } } } else if (container instanceof AdHocSubProcess) { return true; } return false; } }
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); }
public ProcessPropertyReader of(Process el) { return new ProcessPropertyReader(el, diagram, definitionResolver.getShape(el.getId()), definitionResolver.getResolutionFactor()); } }
@Before public void setUp() { when(propertyWriter.getRootElements()).thenReturn(propertyWriterRootElements); when(propertyWriter.getSimulationParameters()).thenReturn(propertyWriterElementParameters); when(propertyWriter.getItemDefinitions()).thenReturn(propertyWriterItemDefinitions); when(boundaryEventPropertyWriter.getRootElements()).thenReturn(propertyWriterRootElements); when(boundaryEventPropertyWriter.getSimulationParameters()).thenReturn(propertyWriterElementParameters); when(boundaryEventPropertyWriter.getItemDefinitions()).thenReturn(propertyWriterItemDefinitions); flowElement = new FlowElementImpl() {}; flowElement.setId(ELEMENT_ID); artifact = new ArtifactImpl() {}; artifact.setId(ELEMENT_ID); when(process.getFlowElements()).thenReturn(flowElements); when(process.getArtifacts()).thenReturn(artifacts); when(subProcess.getFlowElements()).thenReturn(flowElements); when(subProcess.getArtifacts()).thenReturn(artifacts); }
if (root instanceof Process) { Process process = (Process) root; List<FlowElement> flowElements = process.getFlowElements(); for (FlowElement fe : flowElements) { if (fe instanceof Task) { MultiInstanceLoopCharacteristics loopCharacteristics = Bpmn2Factory.eINSTANCE.createMultiInstanceLoopCharacteristics(); if (miCollectionInput != null && miCollectionInput.length() > 0) { List<Property> properties = process.getProperties(); for (Property prop : properties) { if (prop.getId() != null && prop.getId().equals(miCollectionInput)) { List<Property> properties = process.getProperties(); for (Property prop : properties) { if (prop.getId() != null && prop.getId().equals(miCollectionOutput)) {
public String getProcessVariables() { return ProcessVariableReader.getProcessVariables(process.getProperties()); }
public void revisitArtifacts(Definitions def) { List<RootElement> rootElements = def.getRootElements(); for (RootElement root : rootElements) { if (root instanceof Process) { Process process = (Process) root; for (Artifact a : _artifacts) { process.getArtifacts().add(a); } } } }
metadata.setTitle(definitionResolver.getProcess().getName());
public void revisitProcessDoc(Definitions def) { List<RootElement> rootElements = def.getRootElements(); for (RootElement root : rootElements) { if (root instanceof Process) { Process process = (Process) root; if (this.processDocs != null && this.processDocs.length() > 0) { process.getDocumentation().add(createDocumentation(wrapInCDATABlock(this.processDocs))); } } } }