Refine search
for (ValuedDataObject thisObject : getDataObjects()) { boolean exists = false; for (ValuedDataObject otherObject : otherElement.getDataObjects()) { if (thisObject.getId().equals(otherObject.getId())) { exists = true; removeFlowElement(thisObject.getId()); if (otherElement.getDataObjects() != null && !otherElement.getDataObjects().isEmpty()) { for (ValuedDataObject dataObject : otherElement.getDataObjects()) { ValuedDataObject clone = dataObject.clone(); dataObjects.add(clone); removeFlowElement(clone.getId()); addFlowElement(clone); for (FlowElement flowElement : otherElement.getFlowElements()) { addFlowElement(flowElement.clone()); for (Artifact artifact : otherElement.getArtifacts()) { addArtifact(artifact.clone());
private void fillSubShapes(Map<String, SubProcess> subShapesMap, SubProcess subProcess) { for (FlowElement flowElement : subProcess.getFlowElements()) { if (flowElement instanceof SubProcess) { SubProcess childSubProcess = (SubProcess) flowElement; subShapesMap.put(childSubProcess.getId(), subProcess); fillSubShapes(subShapesMap, childSubProcess); } else { subShapesMap.put(flowElement.getId(), subProcess); } } }
@Override public SubProcess clone() { SubProcess clone = new SubProcess(); clone.setValues(this); return clone; }
protected Artifact getArtifactInSubProcess(String id, SubProcess subProcess) { Artifact foundArtifact = subProcess.getArtifact(id); if (foundArtifact == null) { for (FlowElement flowElement : subProcess.getFlowElements()) { if (flowElement instanceof SubProcess) { foundArtifact = getArtifactInSubProcess(id, (SubProcess) flowElement); if (foundArtifact != null) { break; } } } } return foundArtifact; }
protected FlowElement getFlowElementInSubProcess(String id, SubProcess subProcess) { FlowElement foundFlowElement = subProcess.getFlowElement(id); if (foundFlowElement == null) { for (FlowElement flowElement : subProcess.getFlowElements()) { if (flowElement instanceof SubProcess) { foundFlowElement = getFlowElementInSubProcess(id, (SubProcess) flowElement); if (foundFlowElement != null) { break; } } } } return foundFlowElement; }
public BpmnModel convertToBpmnModel(JsonNode modelNode, Map<String, String> formKeyMap, Map<String, String> decisionTableKeyMap) { BpmnModel bpmnModel = new BpmnModel(); bpmnModel.setTargetNamespace("http://flowable.org/test"); Map<String, JsonNode> shapeMap = new HashMap<>(); Map<String, JsonNode> sourceRefMap = new HashMap<>(); pool.setProcessRef(JsonConverterUtil.getPropertyValueAsString(PROPERTY_PROCESS_ID, shapeNode)); pool.setExecutable(JsonConverterUtil.getPropertyValueAsBoolean(PROPERTY_IS_EXECUTABLE, shapeNode, true)); bpmnModel.getPools().add(pool); if (subShapesMap.containsKey(sequenceFlow.getSourceRef())) { SubProcess subProcess = subShapesMap.get(sequenceFlow.getSourceRef()); if (subProcess.getFlowElement(sequenceFlow.getId()) == null) { subProcess.addFlowElement(sequenceFlow); removeSubFlowsList.add(sequenceFlow.getId()); for (SubProcess subProcess : subShapesMap.values()) { GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(subProcess.getId()); if (graphicInfo != null && Boolean.FALSE.equals(graphicInfo.getExpanded())){ collapsedSubProcess.add(subProcess); subProcess.removeFlowElement(flowId);
if (!model.getPools().isEmpty()) { processId = "Collaboration"; } else { processId = model.getMainProcess().getId(); Map<String, String> collapsedSubProcessChildren = new HashMap<>(); for (String elementId : model.getLocationMap().keySet()) { FlowElement flowElement = model.getFlowElement(elementId); String flowId = flowElement.getId(); GraphicInfo gi = model.getGraphicInfo(flowId); Boolean isExpanded = gi.getExpanded(); if (isExpanded != null && isExpanded == false) { SubProcess subProcess = (SubProcess) flowElement; for (FlowElement element : subProcess.getFlowElements()) { collapsedSubProcessChildren.put(element.getId(), elementId); for (Artifact element : subProcess.getArtifacts()) { for (FlowElement child : collapsedSubProcess.getFlowElements()){ createBpmnEdge(model,child.getId(),xtw); } else { GraphicInfo graphicInfo = model.getGraphicInfo(child.getId()); for (Artifact child : collapsedSubProcess.getArtifacts()){
public static void injectParallelSubProcess(Process process, BpmnModel bpmnModel, DynamicEmbeddedSubProcessBuilder dynamicEmbeddedSubProcessBuilder, ProcessDefinitionEntity originalProcessDefinitionEntity, DeploymentEntity newDeploymentEntity, CommandContext commandContext) { GraphicInfo elementGraphicInfo = bpmnModel.getGraphicInfo(initialStartEvent.getId()); parallelGateway.setId(dynamicEmbeddedSubProcessBuilder.nextForkGatewayId(process.getFlowElementMap())); process.addFlowElement(parallelGateway); SubProcess subProcess = new SubProcess(); if (dynamicEmbeddedSubProcessBuilder.getId() != null) { subProcess.setId(dynamicEmbeddedSubProcessBuilder.getId()); } else { subProcess.setId(dynamicEmbeddedSubProcessBuilder.nextSubProcessId(process.getFlowElementMap())); dynamicEmbeddedSubProcessBuilder.setDynamicSubProcessId(subProcess.getId()); .findResourceByDeploymentIdAndResourceName(subProcessDefinition.getDeploymentId(), subProcessDefinition.getResourceName()); BpmnModel bpmnModelSubProcess = new BpmnXMLConverter().convertToBpmnModel(new BytesStreamSource(subProcessBpmnResource.getBytes()), false, false); for (FlowElement flowElement : bpmnModelSubProcess.getMainProcess().getFlowElements()) { subProcess.addFlowElement(flowElement); processSubProcessFlowElements(commandContext, subProcess.getId(), process, bpmnModel, subProcess, bpmnModelSubProcess, subProcessDefinition, newDeploymentEntity, generatedIds, (elementGraphicInfo != null)); SequenceFlow flowToSubProcess = new SequenceFlow(parallelGateway.getId(), subProcess.getId()); SequenceFlow flowFromSubProcess = new SequenceFlow(subProcess.getId(), endEvent.getId()); bpmnModel.addGraphicInfo(subProcess.getId(), newSubProcessGraphicInfo);
elementNode.put("completed", completedElements.contains(element.getId())); elementNode.put("breakpoint", breakpoints.contains(element.getId())); Collection<String> brokenExecutions = this.debuggerService.getBrokenExecutions(element.getId(), processInstanceId); if (!brokenExecutions.isEmpty()) { ArrayNode brokenExecutionsNode = elementNode.putArray("brokenExecutions"); elementNode.put("name", element.getName()); GraphicInfo graphicInfo = model.getGraphicInfo(element.getId()); if (graphicInfo != null) { fillGraphicInfo(elementNode, graphicInfo, true); elementNode.put("collapsed", "true"); newCollapsedNode = objectMapper.createObjectNode(); newCollapsedNode.put("id", subProcess.getId()); newCollapsedNode.putArray("elements"); newCollapsedNode.putArray("flows"); processElements(subProcess.getFlowElements(), model, elementArray, flowArray, collapsedArray, diagramInfo, completedElements, currentElements, breakpoints, newCollapsedNode, processInstanceId); processArtifacts(subProcess.getArtifacts(), model, elementArray, flowArray, diagramInfo);
SubProcess subProcess = new SubProcess(); String subProcessId = dynamicUserTaskBuilder.nextSubProcessId(process.getFlowElementMap()); subProcess.setId(subProcessId); subProcess.setName(flowElement.getName()); incomingFlow.setTargetRef(subProcess.getId()); subProcess.setIncomingFlows(userTask.getIncomingFlows()); outgoingFlow.setSourceRef(subProcess.getId()); subProcess.setOutgoingFlows(userTask.getOutgoingFlows()); GraphicInfo elementGraphicInfo = bpmnModel.getGraphicInfo(flowElement.getId()); if (elementGraphicInfo != null) { elementGraphicInfo.setExpanded(false); bpmnModel.addGraphicInfo(subProcess.getId(), elementGraphicInfo); bpmnModel.removeGraphicInfo(userTask.getId()); subProcess.addFlowElement(userTask); startEvent.setId(dynamicUserTaskBuilder.nextStartEventId(process.getFlowElementMap())); subProcess.addFlowElement(startEvent); subProcess.addFlowElement(fork); subProcess.addFlowElement(startFlow1); subProcess.addFlowElement(newUserTask);
SubProcess parentSubProcess = new SubProcess(); String subProcessId = dynamicEmbeddedSubProcessBuilder.nextSubProcessId(process.getFlowElementMap()); parentSubProcess.setId(subProcessId); parentSubProcess.setName(userTask.getName()); incomingFlow.setTargetRef(parentSubProcess.getId()); parentSubProcess.setIncomingFlows(userTask.getIncomingFlows()); outgoingFlow.setSourceRef(parentSubProcess.getId()); parentSubProcess.setOutgoingFlows(userTask.getOutgoingFlows()); bpmnModel.addGraphicInfo(parentSubProcess.getId(), elementGraphicInfo); bpmnModel.removeGraphicInfo(userTask.getId()); parentSubProcess.addFlowElement(userTask); SubProcess subProcess = new SubProcess(); if (dynamicEmbeddedSubProcessBuilder.getId() != null) { subProcess.setId(dynamicEmbeddedSubProcessBuilder.getId()); } else { subProcess.setId(dynamicEmbeddedSubProcessBuilder.nextSubProcessId(process.getFlowElementMap())); dynamicEmbeddedSubProcessBuilder.setDynamicSubProcessId(subProcess.getId()); subProcess.addFlowElement(flowElement); processSubProcessFlowElements(commandContext, subProcess.getId(), process, bpmnModel, subProcess, bpmnModelSubProcess,
ValuedDataObject foundDataObject = null; if (executionEntity.getParentId() == null) { for (ValuedDataObject dataObject : bpmnModel.getMainProcess().getDataObjects()) { if (dataObject.getName().equals(variableEntity.getName())) { foundDataObject = dataObject; SubProcess subProcess = (SubProcess) bpmnModel.getFlowElement(executionEntity.getActivityId()); for (ValuedDataObject dataObject : subProcess.getDataObjects()) { if (dataObject.getName().equals(variableEntity.getName())) { foundDataObject = dataObject;
protected void translateNestedSubprocessElements(SubProcess subProcess) { GraphicInfo subProcessGraphicInfo = bpmnModel.getLocationMap().get(subProcess.getId()); double subProcessX = subProcessGraphicInfo.getX(); double subProcessY = subProcessGraphicInfo.getY(); List<SubProcess> nestedSubProcesses = new ArrayList<>(); for (FlowElement flowElement : subProcess.getFlowElements()) { if (flowElement instanceof SequenceFlow) { List<GraphicInfo> graphicInfos = bpmnModel.getFlowLocationMap().get(flowElement.getId()); for (GraphicInfo graphicInfo : graphicInfos) { graphicInfo.setX(graphicInfo.getX() + subProcessX + subProcessMargin); graphicInfo.setY(graphicInfo.getY() + subProcessY + subProcessMargin); } } else if (!(flowElement instanceof DataObject)) { // Regular element GraphicInfo graphicInfo = bpmnModel.getLocationMap().get(flowElement.getId()); graphicInfo.setX(graphicInfo.getX() + subProcessX + subProcessMargin); graphicInfo.setY(graphicInfo.getY() + subProcessY + subProcessMargin); } if (flowElement instanceof SubProcess) { nestedSubProcesses.add((SubProcess) flowElement); } } // Continue for next level of nested subprocesses for (SubProcess nestedSubProcess : nestedSubProcesses) { translateNestedSubprocessElements(nestedSubProcess); } }
List<ExtensionElement> localizationElements = flowElement.getExtensionElements().get("localization"); if (localizationElements != null) { for (ExtensionElement localizationElement : localizationElements) { String flowElementId = flowElement.getId(); if (!isEqualToCurrentLocalizationValue(locale, flowElementId, "name", name, infoNode)) { dynamicBpmnService.changeLocalizationName(locale, flowElementId, name, infoNode); boolean isFlowElementLocalizationChanged = localizeFlowElements(subprocess.getFlowElements(), infoNode); boolean isDataObjectLocalizationChanged = localizeDataObjectElements(subprocess.getDataObjects(), infoNode); if (isFlowElementLocalizationChanged || isDataObjectLocalizationChanged) { localizationValuesChanged = true;
activeSubProcessList.get(activeSubProcessList.size() - 1).addArtifact(currentArtifact); activeProcess.addArtifact(currentArtifact); currentFlowElement.setId(elementId); currentFlowElement.setName(elementName); if (!activeSubProcessList.isEmpty()) { SubProcess subProcess = activeSubProcessList.get(activeSubProcessList.size() - 1); subProcess.getDataObjects().add((ValuedDataObject) parsedElement); } else { activeProcess.getDataObjects().add((ValuedDataObject) parsedElement); subProcess.addFlowElement(currentFlowElement); activeProcess.addFlowElement(currentFlowElement);
flowElement.setName(getPropertyValueAsString(PROPERTY_NAME, elementNode)); flowElement.setDocumentation(getPropertyValueAsString(PROPERTY_DOCUMENTATION, elementNode)); orderElement.setName("EDITOR_FLOW_ORDER"); orderElement.setElementText(orderNode.asText()); flowElement.addExtensionElement(orderElement); ((Process) parentElement).addFlowElement(flowElement); ((SubProcess) parentElement).addFlowElement(flowElement); lane.getFlowReferences().add(flowElement.getId()); lane.getParentProcess().addFlowElement(flowElement); Artifact artifact = (Artifact) baseElement; if (parentElement instanceof Process) { ((Process) parentElement).addArtifact(artifact); ((SubProcess) parentElement).addArtifact(artifact);
xtw.writeAttribute(ATTRIBUTE_ID, subProcess.getId()); if (StringUtils.isNotEmpty(subProcess.getName())) { xtw.writeAttribute(ATTRIBUTE_NAME, subProcess.getName()); } else { xtw.writeAttribute(ATTRIBUTE_NAME, "subProcess"); if (subProcess.isAsynchronous()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_ASYNCHRONOUS, ATTRIBUTE_VALUE_TRUE, xtw); if (subProcess.isNotExclusive()) { BpmnXMLUtil.writeQualifiedAttribute(ATTRIBUTE_ACTIVITY_EXCLUSIVE, ATTRIBUTE_VALUE_FALSE, xtw); if (StringUtils.isNotEmpty(subProcess.getDocumentation())) { xtw.writeCharacters(subProcess.getDocumentation()); xtw.writeEndElement(); didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(subProcess, didWriteExtensionStartElement, model.getNamespaces(), xtw); if (didWriteExtensionStartElement) { for (FlowElement subElement : subProcess.getFlowElements()) { createXML(subElement, model, xtw); for (Artifact artifact : subProcess.getArtifacts()) { createXML(artifact, model, xtw);
for (FlowElementMoveEntry flowElementMoveEntry : moveToFlowElements) { FlowElement newFlowElement = flowElementMoveEntry.getNewFlowElement(); SubProcess subProcess = newFlowElement.getSubProcess(); subProcess = subProcess.getSubProcess(); if (!processInstanceChangeState.getProcessInstanceActiveEmbeddedExecutions().containsKey(subProcess.getId()) && !isSubProcessAncestorOfAnyExecution(subProcess.getId(), movingExecutions)) { subProcessesToCreate.put(subProcess.getId(), subProcess); subProcess = subProcess.getSubProcess(); if (!processInstanceChangeState.getCreatedEmbeddedSubProcesses().containsKey(subProcess.getId())) { ExecutionEntity embeddedSubProcess = createEmbeddedSubProcessHierarchy(subProcess, defaultContinueParentExecution, subProcessesToCreate, movingExecutionIds, processInstanceChangeState, commandContext); processInstanceChangeState.addCreatedEmbeddedSubProcess(subProcess.getId(), embeddedSubProcess); FlowElement newFlowElement = flowElementMoveEntry.getNewFlowElement(); ExecutionEntity parentExecution; if (newFlowElement.getSubProcess() != null && processInstanceChangeState.getCreatedEmbeddedSubProcesses().containsKey(newFlowElement.getSubProcess().getId())) { parentExecution = processInstanceChangeState.getCreatedEmbeddedSubProcesses().get(newFlowElement.getSubProcess().getId()); } else { parentExecution = defaultContinueParentExecution;
@Override protected void executeParse(BpmnParse bpmnParse, SubProcess subProcess) { ActivityImpl activity = createActivityOnScope(bpmnParse, subProcess, BpmnXMLConstants.ELEMENT_SUBPROCESS, bpmnParse.getCurrentScope()); activity.setAsync(subProcess.isAsynchronous()); activity.setExclusive(!subProcess.isNotExclusive()); boolean triggeredByEvent = false; if (subProcess instanceof EventSubProcess) { triggeredByEvent = true; } activity.setProperty("triggeredByEvent", triggeredByEvent); // event subprocesses are not scopes activity.setScope(!triggeredByEvent); activity.setActivityBehavior(bpmnParse.getActivityBehaviorFactory().createSubprocActivityBehavior(subProcess)); bpmnParse.setCurrentScope(activity); bpmnParse.setCurrentSubProcess(subProcess); bpmnParse.processFlowElements(subProcess.getFlowElements()); processArtifacts(bpmnParse, subProcess.getArtifacts(), activity); // no data objects for event subprocesses if (!(subProcess instanceof EventSubProcess)) { // parse out any data objects from the template in order to set up the necessary process variables Map<String, Object> variables = processDataObjects(bpmnParse, subProcess.getDataObjects(), activity); activity.setVariables(variables); } bpmnParse.removeCurrentScope(); bpmnParse.removeCurrentSubProcess(); if (subProcess.getIoSpecification() != null) { IOSpecification ioSpecification = createIOSpecification(bpmnParse, subProcess.getIoSpecification()); activity.setIoSpecification(ioSpecification); } }
SignalEventDefinition signalEventDef = (SignalEventDefinition) eventDef; if (StringUtils.isNotEmpty(signalEventDef.getSignalRef())) { if (bpmnModel.getSignal(signalEventDef.getSignalRef()) == null) { bpmnModel.addSignal(new Signal(signalEventDef.getSignalRef(), signalEventDef.getSignalRef())); MessageEventDefinition messageEventDef = (MessageEventDefinition) eventDef; if (StringUtils.isNotEmpty(messageEventDef.getMessageRef())) { if (bpmnModel.getMessage(messageEventDef.getMessageRef()) == null) { bpmnModel.addMessage(new Message(messageEventDef.getMessageRef(), messageEventDef.getMessageRef(), null)); if (flowElement.getExtensionElements().containsKey("EDITOR_FLOW_ORDER")) { gatewayWithOrderList.add((Gateway) flowElement); postProcessElements(subProcess, subProcess.getFlowElements(), edgeMap, bpmnModel, allFlowMap, gatewayWithOrderList);