Java Code Examples for org.flowable.bpmn.model.BpmnModel#addFlowGraphicInfoList()
The following examples show how to use
org.flowable.bpmn.model.BpmnModel#addFlowGraphicInfoList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseDynamicSubProcessInjectUtil.java From flowable-engine with Apache License 2.0 | 5 votes |
protected static void processSubProcessFlowElements(CommandContext commandContext, String prefix, Process process, BpmnModel bpmnModel, SubProcess subProcess, BpmnModel subProcessBpmnModel, ProcessDefinition originalProcessDefinition, DeploymentEntity newDeploymentEntity, Map<String, FlowElement> generatedIds, boolean includeDiInfo) { Collection<FlowElement> flowElementsOfSubProcess = subProcess.getFlowElementMap().values(); for (FlowElement flowElement : flowElementsOfSubProcess) { if (process.getFlowElement(flowElement.getId(), true) != null) { generateIdForDuplicateFlowElement(prefix, process, bpmnModel, subProcessBpmnModel, flowElement, generatedIds, includeDiInfo); } else { if (includeDiInfo) { if (flowElement instanceof SequenceFlow) { List<GraphicInfo> wayPoints = subProcessBpmnModel.getFlowLocationGraphicInfo(flowElement.getId()); if (wayPoints != null) { bpmnModel.addFlowGraphicInfoList(flowElement.getId(), wayPoints); } } else { GraphicInfo graphicInfo = subProcessBpmnModel.getGraphicInfo(flowElement.getId()); if (graphicInfo != null) { bpmnModel.addGraphicInfo(flowElement.getId(), subProcessBpmnModel.getGraphicInfo(flowElement.getId())); } } } } processUserTask(flowElement, originalProcessDefinition, newDeploymentEntity, commandContext); processDecisionTask(flowElement, originalProcessDefinition, newDeploymentEntity, commandContext); if (flowElement instanceof SubProcess) { processSubProcessFlowElements(commandContext, prefix, process, bpmnModel, (SubProcess) flowElement, subProcessBpmnModel, originalProcessDefinition, newDeploymentEntity, generatedIds, includeDiInfo); } } }
Example 2
Source File: BaseDynamicSubProcessInjectUtil.java From flowable-engine with Apache License 2.0 | 4 votes |
protected static void generateIdForDuplicateFlowElement(String prefix, org.flowable.bpmn.model.Process process, BpmnModel bpmnModel, BpmnModel subProcessBpmnModel, FlowElement duplicateFlowElement, Map<String, FlowElement> generatedIds, boolean includeDiInfo) { String originalFlowElementId = duplicateFlowElement.getId(); if (process.getFlowElement(originalFlowElementId, true) != null) { String newFlowElementId = prefix + "-" + originalFlowElementId; int counter = 0; boolean maxLengthReached = false; while (!maxLengthReached && process.getFlowElement(newFlowElementId, true) != null) { newFlowElementId = prefix + counter++ + "-" + originalFlowElementId; if (newFlowElementId.length() > 255) { maxLengthReached = true; } } if (maxLengthReached) { newFlowElementId = prefix + "-" + UUID.randomUUID().toString(); } duplicateFlowElement.setId(newFlowElementId); generatedIds.put(originalFlowElementId, duplicateFlowElement); if (includeDiInfo) { if (duplicateFlowElement instanceof SequenceFlow) { bpmnModel.addFlowGraphicInfoList(newFlowElementId, subProcessBpmnModel.getFlowLocationGraphicInfo(originalFlowElementId)); } else { bpmnModel.addGraphicInfo(newFlowElementId, subProcessBpmnModel.getGraphicInfo(originalFlowElementId)); } } for (FlowElement flowElement : duplicateFlowElement.getParentContainer().getFlowElements()) { if (flowElement instanceof SequenceFlow) { SequenceFlow sequenceFlow = (SequenceFlow) flowElement; if (sequenceFlow.getSourceRef().equals(originalFlowElementId)) { sequenceFlow.setSourceRef(newFlowElementId); } if (sequenceFlow.getTargetRef().equals(originalFlowElementId)) { sequenceFlow.setTargetRef(newFlowElementId); } } else if (flowElement instanceof BoundaryEvent) { BoundaryEvent boundaryEvent = (BoundaryEvent) flowElement; if (boundaryEvent.getAttachedToRefId().equals(originalFlowElementId)) { boundaryEvent.setAttachedToRefId(newFlowElementId); } if (boundaryEvent.getEventDefinitions() != null && boundaryEvent.getEventDefinitions().size() > 0 && (boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition)) { CompensateEventDefinition compensateEventDefinition = (CompensateEventDefinition) boundaryEvent.getEventDefinitions().get(0); if (compensateEventDefinition.getActivityRef().equals(originalFlowElementId)) { compensateEventDefinition.setActivityRef(newFlowElementId); } } } } } if (duplicateFlowElement instanceof FlowElementsContainer) { FlowElementsContainer flowElementsContainer = (FlowElementsContainer) duplicateFlowElement; for (FlowElement childFlowElement : flowElementsContainer.getFlowElements()) { generateIdForDuplicateFlowElement(prefix, process, bpmnModel, subProcessBpmnModel, childFlowElement, generatedIds, includeDiInfo); } } }