Java Code Examples for org.flowable.bpmn.model.BpmnModel#getGraphicInfo()

The following examples show how to use org.flowable.bpmn.model.BpmnModel#getGraphicInfo() . 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: ModelImageService.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected GraphicInfo calculateDiagramSize(BpmnModel bpmnModel) {
    GraphicInfo diagramInfo = new GraphicInfo();

    for (Pool pool : bpmnModel.getPools()) {
        GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
        double elementMaxX = graphicInfo.getX() + graphicInfo.getWidth();
        double elementMaxY = graphicInfo.getY() + graphicInfo.getHeight();

        if (elementMaxX > diagramInfo.getWidth()) {
            diagramInfo.setWidth(elementMaxX);
        }
        if (elementMaxY > diagramInfo.getHeight()) {
            diagramInfo.setHeight(elementMaxY);
        }
    }

    for (Process process : bpmnModel.getProcesses()) {
        calculateWidthForFlowElements(process.getFlowElements(), bpmnModel, diagramInfo);
        calculateWidthForArtifacts(process.getArtifacts(), bpmnModel, diagramInfo);
    }
    return diagramInfo;
}
 
Example 2
Source File: ModelImageService.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void calculateWidthForFlowElements(Collection<FlowElement> elementList, BpmnModel bpmnModel, GraphicInfo diagramInfo) {
    for (FlowElement flowElement : elementList) {
        List<GraphicInfo> graphicInfoList = new ArrayList<>();
        if (flowElement instanceof SequenceFlow) {
            List<GraphicInfo> flowGraphics = bpmnModel.getFlowLocationGraphicInfo(flowElement.getId());
            if (flowGraphics != null && flowGraphics.size() > 0) {
                graphicInfoList.addAll(flowGraphics);
            }
        } else {
            GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowElement.getId());
            if (graphicInfo != null) {
                graphicInfoList.add(graphicInfo);
            }
        }

        processGraphicInfoList(graphicInfoList, diagramInfo);
    }
}
 
Example 3
Source File: BoundaryEventGraphicInfoTest.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected void validate(BpmnModel model) {
    BoundaryEvent event = (BoundaryEvent) model.getFlowElement(TIMER_BOUNDERY_ID);
    assertThat(event.getAttachedToRefId()).isEqualTo(USER_TASK_ID);

    //check graphicinfo boundary
    GraphicInfo giBoundary = model.getGraphicInfo(TIMER_BOUNDERY_ID);
    assertThat(giBoundary.getX()).isEqualTo(334.2201675394047);
    assertThat(giBoundary.getY()).isEqualTo(199.79587432571776);
    assertThat(giBoundary.getHeight()).isEqualTo(31.0);
    assertThat(giBoundary.getWidth()).isEqualTo(31.0);

    //check graphicinfo task
    GraphicInfo giTaskOne = model.getGraphicInfo(USER_TASK_ID);
    assertThat(giTaskOne.getX()).isEqualTo(300.0);
    assertThat(giTaskOne.getY()).isEqualTo(135.0);
    assertThat(giTaskOne.getWidth()).isEqualTo(100.0);
    assertThat(giTaskOne.getHeight()).isEqualTo(80.0);
}
 
Example 4
Source File: BPMNDIExport.java    From flowable-engine with Apache License 2.0 6 votes vote down vote up
protected static void createBpmnShape(BpmnModel model, String elementId, XMLStreamWriter xtw) throws Exception {
    xtw.writeStartElement(BPMNDI_PREFIX, ELEMENT_DI_SHAPE, BPMNDI_NAMESPACE);
    xtw.writeAttribute(ATTRIBUTE_DI_BPMNELEMENT, elementId);
    xtw.writeAttribute(ATTRIBUTE_ID, "BPMNShape_" + elementId);

    GraphicInfo graphicInfo = model.getGraphicInfo(elementId);
    FlowElement flowElement = model.getFlowElement(elementId);
    if (flowElement instanceof SubProcess && graphicInfo.getExpanded() != null) {
        xtw.writeAttribute(ATTRIBUTE_DI_IS_EXPANDED, String.valueOf(graphicInfo.getExpanded()));
    }

    xtw.writeStartElement(OMGDC_PREFIX, ELEMENT_DI_BOUNDS, OMGDC_NAMESPACE);
    xtw.writeAttribute(ATTRIBUTE_DI_HEIGHT, String.valueOf(graphicInfo.getHeight()));
    xtw.writeAttribute(ATTRIBUTE_DI_WIDTH, String.valueOf(graphicInfo.getWidth()));
    xtw.writeAttribute(ATTRIBUTE_DI_X, String.valueOf(graphicInfo.getX()));
    xtw.writeAttribute(ATTRIBUTE_DI_Y, String.valueOf(graphicInfo.getY()));
    xtw.writeEndElement();

    xtw.writeEndElement();
}
 
Example 5
Source File: DefaultProcessDiagramGenerator.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected boolean isPartOfCollapsedSubProcess(FlowElement flowElement, BpmnModel model) {
    SubProcess subProcess = flowElement.getSubProcess();
    if (subProcess != null) {
        GraphicInfo graphicInfo = model.getGraphicInfo(subProcess.getId());
        if (graphicInfo != null && graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) {
            return true;
        }
        
        return isPartOfCollapsedSubProcess(subProcess, model);
    }
    
    return false;
}
 
Example 6
Source File: ModelImageService.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
protected void scaleDiagram(BpmnModel bpmnModel, double scaleFactor) {
    for (Pool pool : bpmnModel.getPools()) {
        GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
        scaleGraphicInfo(graphicInfo, scaleFactor);
    }

    for (Process process : bpmnModel.getProcesses()) {
        scaleFlowElements(process.getFlowElements(), bpmnModel, scaleFactor);
        scaleArtifacts(process.getArtifacts(), bpmnModel, scaleFactor);
        for (Lane lane : process.getLanes()) {
            scaleGraphicInfo(bpmnModel.getGraphicInfo(lane.getId()), scaleFactor);
        }
    }
}
 
Example 7
Source File: BaseDynamicSubProcessInjectUtil.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
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 8
Source File: DynamicBpmnInjectionTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Test
@org.flowable.engine.test.Deployment
public void testOneTaskDi() {
    ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("oneTaskProcess");
    Task task = taskService.createTaskQuery().singleResult();

    DynamicUserTaskBuilder taskBuilder = new DynamicUserTaskBuilder();
    taskBuilder.id("custom_task")
        .name("My injected task")
        .assignee("kermit");
    dynamicBpmnService.injectParallelUserTask(task.getId(), taskBuilder);
    
    List<ProcessDefinition> processDefinitions = repositoryService.createProcessDefinitionQuery().processDefinitionKey("oneTaskProcess").list();
    assertEquals(2, processDefinitions.size());
    
    ProcessDefinition rootDefinition = null;
    ProcessDefinition derivedFromDefinition = null;
    for (ProcessDefinition definitionItem : processDefinitions) {
        if (definitionItem.getDerivedFrom() != null && definitionItem.getDerivedFromRoot() != null) {
            derivedFromDefinition = definitionItem;
        } else {
            rootDefinition = definitionItem;
        }
    }
    
    assertNotNull(derivedFromDefinition);
    deploymentIdsForAutoCleanup.add(derivedFromDefinition.getDeploymentId()); // For auto-cleanup
    
    BpmnModel bpmnModel = repositoryService.getBpmnModel(derivedFromDefinition.getId());
    FlowElement taskElement = bpmnModel.getFlowElement("theTask");
    SubProcess subProcessElement = (SubProcess) taskElement.getParentContainer();
    assertNotNull(subProcessElement);
    GraphicInfo subProcessGraphicInfo = bpmnModel.getGraphicInfo(subProcessElement.getId());
    assertNotNull(subProcessGraphicInfo);
    assertFalse(subProcessGraphicInfo.getExpanded());
    
    BpmnModel rootBpmnModel = repositoryService.getBpmnModel(rootDefinition.getId());
    GraphicInfo taskGraphicInfo = rootBpmnModel.getGraphicInfo("theTask");
    
    assertEquals(taskGraphicInfo.getX(), subProcessGraphicInfo.getX());
    assertEquals(taskGraphicInfo.getY(), subProcessGraphicInfo.getY());
    assertEquals(taskGraphicInfo.getWidth(), subProcessGraphicInfo.getWidth());
    assertEquals(taskGraphicInfo.getHeight(), subProcessGraphicInfo.getHeight());
    
    if (HistoryTestHelper.isHistoryLevelAtLeast(HistoryLevel.ACTIVITY, processEngineConfiguration)) {
        HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstance.getId()).singleResult();
        assertEquals(derivedFromDefinition.getId(), historicProcessInstance.getProcessDefinitionId());
        assertEquals(Integer.valueOf(derivedFromDefinition.getVersion()), historicProcessInstance.getProcessDefinitionVersion());
        
        List<HistoricTaskInstance> historicTasks = historyService.createHistoricTaskInstanceQuery().processInstanceId(processInstance.getId()).list();
        assertEquals(2, historicTasks.size());
        for (HistoricTaskInstance historicTaskInstance : historicTasks) {
            assertEquals(derivedFromDefinition.getId(), historicTaskInstance.getProcessDefinitionId());
        }
        
        List<HistoricActivityInstance> historicActivities = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstance.getId()).list();
        assertEquals(5, historicActivities.size());
        for (HistoricActivityInstance historicActivityInstance : historicActivities) {
            assertActivityInstancesAreSame(historicActivityInstance, runtimeService.createActivityInstanceQuery().activityInstanceId(historicActivityInstance.getId()).singleResult());
            assertEquals(derivedFromDefinition.getId(), historicActivityInstance.getProcessDefinitionId());
        }
    }
    
    List<Task> tasks = taskService.createTaskQuery().processInstanceId(processInstance.getId()).list();
    assertEquals(2, tasks.size());
    for (Task t : tasks) {
        taskService.complete(t.getId());
    }
    assertProcessEnded(processInstance.getId());  
}
 
Example 9
Source File: AssociationJsonConverter.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
@Override
public void convertToJson(BpmnJsonConverterContext converterContext, BaseElement baseElement, ActivityProcessor processor, BpmnModel model,
        FlowElementsContainer container, ArrayNode shapesArrayNode, double subProcessX, double subProcessY) {

    Association association = (Association) baseElement;
    ObjectNode flowNode = BpmnJsonConverterUtil.createChildShape(association.getId(), STENCIL_ASSOCIATION, 172, 212, 128, 212);
    ArrayNode dockersArrayNode = objectMapper.createArrayNode();
    ObjectNode dockNode = objectMapper.createObjectNode();
    dockNode.put(EDITOR_BOUNDS_X, model.getGraphicInfo(association.getSourceRef()).getWidth() / 2.0);
    dockNode.put(EDITOR_BOUNDS_Y, model.getGraphicInfo(association.getSourceRef()).getHeight() / 2.0);
    dockersArrayNode.add(dockNode);

    List<GraphicInfo> graphicInfoList = model.getFlowLocationGraphicInfo(association.getId());
    if (graphicInfoList.size() > 2) {
        for (int i = 1; i < graphicInfoList.size() - 1; i++) {
            GraphicInfo graphicInfo = graphicInfoList.get(i);
            dockNode = objectMapper.createObjectNode();
            dockNode.put(EDITOR_BOUNDS_X, graphicInfo.getX());
            dockNode.put(EDITOR_BOUNDS_Y, graphicInfo.getY());
            dockersArrayNode.add(dockNode);
        }
    }

    GraphicInfo targetGraphicInfo = model.getGraphicInfo(association.getTargetRef());
    GraphicInfo flowGraphicInfo = graphicInfoList.get(graphicInfoList.size() - 1);

    double diffTopY = Math.abs(flowGraphicInfo.getY() - targetGraphicInfo.getY());
    double diffRightX = Math.abs(flowGraphicInfo.getX() - (targetGraphicInfo.getX() + targetGraphicInfo.getWidth()));
    double diffBottomY = Math.abs(flowGraphicInfo.getY() - (targetGraphicInfo.getY() + targetGraphicInfo.getHeight()));

    dockNode = objectMapper.createObjectNode();
    if (diffTopY < 5) {
        dockNode.put(EDITOR_BOUNDS_X, targetGraphicInfo.getWidth() / 2.0);
        dockNode.put(EDITOR_BOUNDS_Y, 0.0);

    } else if (diffRightX < 5) {
        dockNode.put(EDITOR_BOUNDS_X, targetGraphicInfo.getWidth());
        dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight() / 2.0);

    } else if (diffBottomY < 5) {
        dockNode.put(EDITOR_BOUNDS_X, targetGraphicInfo.getWidth() / 2.0);
        dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight());

    } else {
        dockNode.put(EDITOR_BOUNDS_X, 0.0);
        dockNode.put(EDITOR_BOUNDS_Y, targetGraphicInfo.getHeight() / 2.0);
    }
    dockersArrayNode.add(dockNode);
    flowNode.set("dockers", dockersArrayNode);
    ArrayNode outgoingArrayNode = objectMapper.createArrayNode();
    outgoingArrayNode.add(BpmnJsonConverterUtil.createResourceNode(association.getTargetRef()));
    flowNode.set("outgoing", outgoingArrayNode);
    flowNode.set("target", BpmnJsonConverterUtil.createResourceNode(association.getTargetRef()));

    ObjectNode propertiesNode = objectMapper.createObjectNode();
    propertiesNode.put(PROPERTY_OVERRIDE_ID, association.getId());

    flowNode.set(EDITOR_SHAPE_PROPERTIES, propertiesNode);

    shapesArrayNode.add(flowNode);
}
 
Example 10
Source File: CollapsebleSubprocessTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
private void validateModel(BpmnModel bpmnModel) {
    //temp vars
    GraphicInfo gi = null;
    GraphicInfo start = null;
    GraphicInfo end = null;
    List<GraphicInfo> flowLocationGraphicInfo = null;

    //validate parent
    gi = bpmnModel.getGraphicInfo(START_EVENT);
    assertThat(gi.getX()).isEqualTo(73.0);
    assertThat(gi.getY()).isEqualTo(96.0);
    assertThat(gi.getWidth()).isEqualTo(30.0);
    assertThat(gi.getHeight()).isEqualTo(30.0);

    flowLocationGraphicInfo = bpmnModel.getFlowLocationGraphicInfo(SEQUENCEFLOW_TO_COLLAPSEDSUBPROCESS);
    assertThat(flowLocationGraphicInfo).hasSize(2);

    gi = bpmnModel.getGraphicInfo(COLLAPSEDSUBPROCESS);
    assertThat(gi.getExpanded()).isFalse();

    //the intersection points are not full values so its a strange double here...
    start = flowLocationGraphicInfo.get(0);
    assertThat(start.getX()).isCloseTo(102.99814034216989, offset(PRECISION));
    assertThat(start.getY()).isCloseTo(111.23619118649086, offset(PRECISION));

    end = flowLocationGraphicInfo.get(1);
    assertThat(end.getX()).isCloseTo(165.0, offset(PRECISION));
    assertThat(end.getY()).isCloseTo(112.21259842519686, offset(PRECISION));

    //validate graphic infos
    FlowElement flowElement = bpmnModel.getFlowElement(IN_CSB_START_EVENT);
    assertThat(flowElement).isInstanceOf(StartEvent.class);

    gi = bpmnModel.getGraphicInfo(IN_CSB_START_EVENT);
    assertThat(gi.getX()).isEqualTo(90.0);
    assertThat(gi.getY()).isEqualTo(135.0);
    assertThat(gi.getWidth()).isEqualTo(30.0);
    assertThat(gi.getHeight()).isEqualTo(30.0);

    flowElement = bpmnModel.getFlowElement(IN_CSB_SEQUENCEFLOW_TO_USERTASK);
    assertThat(flowElement).isInstanceOf(SequenceFlow.class);
    assertThat(flowElement.getName()).isEqualTo("to ut");

    flowLocationGraphicInfo = bpmnModel.getFlowLocationGraphicInfo(IN_CSB_SEQUENCEFLOW_TO_USERTASK);
    assertThat(flowLocationGraphicInfo).hasSize(2);

    start = flowLocationGraphicInfo.get(0);
    assertThat(start.getX()).isCloseTo(120.0, offset(PRECISION));
    assertThat(start.getY()).isCloseTo(150.0, offset(PRECISION));

    end = flowLocationGraphicInfo.get(1);
    assertThat(end.getX()).isCloseTo(232.0, offset(PRECISION));
    assertThat(end.getY()).isEqualTo(150.0);

    flowElement = bpmnModel.getFlowElement(IN_CSB_USERTASK);
    assertThat(flowElement).isInstanceOf(UserTask.class);
    assertThat(flowElement.getName()).isEqualTo("User task 1");

    gi = bpmnModel.getGraphicInfo(IN_CSB_USERTASK);
    assertThat(gi.getX()).isEqualTo(232.0);
    assertThat(gi.getY()).isEqualTo(110.0);
    assertThat(gi.getWidth()).isEqualTo(100.0);
    assertThat(gi.getHeight()).isEqualTo(80.0);

    flowElement = bpmnModel.getFlowElement(IN_CSB_SEQUENCEFLOW_TO_END);
    assertThat(flowElement).isInstanceOf(SequenceFlow.class);
    assertThat(flowElement.getName()).isEqualTo("to end");

    flowLocationGraphicInfo = bpmnModel.getFlowLocationGraphicInfo(IN_CSB_SEQUENCEFLOW_TO_END);
    assertThat(flowLocationGraphicInfo).hasSize(2);

    start = flowLocationGraphicInfo.get(0);
    assertThat(start.getX()).isCloseTo(332.0, offset(PRECISION));
    assertThat(start.getY()).isCloseTo(150.0, offset(PRECISION));

    end = flowLocationGraphicInfo.get(1);
    assertThat(end.getX()).isEqualTo(435.0);
    assertThat(end.getY()).isEqualTo(150.0);
}
 
Example 11
Source File: CollapsedSubProcessConverterTest.java    From flowable-engine with Apache License 2.0 4 votes vote down vote up
private void validateModel(BpmnModel bpmnModel) {
    //temp vars
    GraphicInfo gi;
    List<GraphicInfo> flowLocationGraphicInfo;

    //validate parent
    gi = bpmnModel.getGraphicInfo(START_EVENT);
    assertThat(gi.getX()).isEqualTo(73.0);
    assertThat(gi.getY()).isEqualTo(96.0);
    assertThat(gi.getWidth()).isEqualTo(30.0);
    assertThat(gi.getHeight()).isEqualTo(30.0);
    assertThat(gi.getExpanded()).isNull();

    flowLocationGraphicInfo = bpmnModel.getFlowLocationGraphicInfo(SEQUENCEFLOW_TO_COLLAPSEDSUBPROCESS);

    gi = bpmnModel.getGraphicInfo(COLLAPSEDSUBPROCESS);
    assertThat(gi.getExpanded()).isFalse();

    //intersection points traversed from xml are full points it seems...
    assertThat(flowLocationGraphicInfo)
            .extracting(GraphicInfo::getX, GraphicInfo::getY)
            .containsExactly(
                    tuple(102.0, 111.0),
                    tuple(165.0, 112.0)
            );

    //validate graphic infos
    FlowElement flowElement = bpmnModel.getFlowElement(IN_CSB_START_EVENT);
    assertThat(flowElement).isInstanceOf(StartEvent.class);

    gi = bpmnModel.getGraphicInfo(IN_CSB_START_EVENT);
    assertThat(gi.getX()).isEqualTo(90.0);
    assertThat(gi.getY()).isEqualTo(135.0);
    assertThat(gi.getWidth()).isEqualTo(30.0);
    assertThat(gi.getHeight()).isEqualTo(30.0);

    flowElement = bpmnModel.getFlowElement(IN_CSB_SEQUENCEFLOW_TO_USERTASK);
    assertThat(flowElement).isInstanceOf(SequenceFlow.class);
    assertThat(flowElement.getName()).isEqualTo("to ut");

    flowLocationGraphicInfo = bpmnModel.getFlowLocationGraphicInfo(IN_CSB_SEQUENCEFLOW_TO_USERTASK);
    assertThat(flowLocationGraphicInfo)
            .extracting(GraphicInfo::getX, GraphicInfo::getY)
            .containsExactly(
                    tuple(120.0, 150.0),
                    tuple(232.0, 150.0)
            );

    flowElement = bpmnModel.getFlowElement(IN_CSB_USERTASK);
    assertThat(flowElement).isInstanceOf(UserTask.class);
    assertThat(flowElement.getName()).isEqualTo("User task 1");

    gi = bpmnModel.getGraphicInfo(IN_CSB_USERTASK);
    assertThat(gi.getX()).isEqualTo(232.0);
    assertThat(gi.getY()).isEqualTo(110.0);
    assertThat(gi.getWidth()).isEqualTo(100.0);
    assertThat(gi.getHeight()).isEqualTo(80.0);

    flowElement = bpmnModel.getFlowElement(IN_CSB_SEQUENCEFLOW_TO_END);
    assertThat(flowElement).isInstanceOf(SequenceFlow.class);
    assertThat(flowElement.getName()).isEqualTo("to end");

    flowLocationGraphicInfo = bpmnModel.getFlowLocationGraphicInfo(IN_CSB_SEQUENCEFLOW_TO_END);
    assertThat(flowLocationGraphicInfo)
            .extracting(GraphicInfo::getX, GraphicInfo::getY)
            .containsExactly(
                    tuple(332.0, 150.0),
                    tuple(435.0, 150.0)
            );

}
 
Example 12
Source File: DefaultProcessDiagramGenerator.java    From flowable-engine with Apache License 2.0 3 votes vote down vote up
/**
 * This method makes coordinates of connection flow better.
 * 
 * @param processDiagramCanvas
 * @param bpmnModel
 * @param sourceElement
 * @param targetElement
 * @param graphicInfoList
 * @return
 */
protected static List<GraphicInfo> connectionPerfectionizer(DefaultProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, BaseElement sourceElement, BaseElement targetElement, List<GraphicInfo> graphicInfoList) {
    GraphicInfo sourceGraphicInfo = bpmnModel.getGraphicInfo(sourceElement.getId());
    GraphicInfo targetGraphicInfo = bpmnModel.getGraphicInfo(targetElement.getId());

    DefaultProcessDiagramCanvas.SHAPE_TYPE sourceShapeType = getShapeType(sourceElement);
    DefaultProcessDiagramCanvas.SHAPE_TYPE targetShapeType = getShapeType(targetElement);

    return processDiagramCanvas.connectionPerfectionizer(sourceShapeType, targetShapeType, sourceGraphicInfo, targetGraphicInfo, graphicInfoList);
}