private void drawAssociation(Association association, BpmnMemoryModel model) {

    Anchor sourceAnchor = null;
    Anchor targetAnchor = null;
    BaseElement sourceElement = model.getFlowElement(association.getSourceRef());
    if (sourceElement == null) {
      sourceElement = model.getArtifact(association.getSourceRef());
    }
    if (sourceElement == null) {
      return;
    }
    ContainerShape sourceShape =
        (ContainerShape)
            getDiagramTypeProvider()
                .getFeatureProvider()
                .getPictogramElementForBusinessObject(sourceElement);

    if (sourceShape == null) {
      return;
    }

    EList<Anchor> anchorList = sourceShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        sourceAnchor = anchor;
        break;
      }
    }

    BaseElement targetElement = model.getFlowElement(association.getTargetRef());
    if (targetElement == null) {
      targetElement = model.getArtifact(association.getTargetRef());
    }
    if (targetElement == null) {
      return;
    }
    ContainerShape targetShape =
        (ContainerShape)
            getDiagramTypeProvider()
                .getFeatureProvider()
                .getPictogramElementForBusinessObject(targetElement);

    if (targetShape == null) {
      return;
    }

    anchorList = targetShape.getAnchors();
    for (Anchor anchor : anchorList) {
      if (anchor instanceof ChopboxAnchor) {
        targetAnchor = anchor;
        break;
      }
    }

    AddConnectionContext addContext = new AddConnectionContext(sourceAnchor, targetAnchor);

    List<GraphicInfo> bendpointList = new ArrayList<GraphicInfo>();
    if (model.getBpmnModel().getFlowLocationMap().containsKey(association.getId())) {
      List<GraphicInfo> pointList =
          model.getBpmnModel().getFlowLocationGraphicInfo(association.getId());
      if (pointList.size() > 2) {
        for (int i = 1; i < pointList.size() - 1; i++) {
          bendpointList.add(pointList.get(i));
        }
      }
    }

    addContext.putProperty("org.activiti.designer.bendpoints", bendpointList);

    addContext.setNewObject(association);
    getDiagramTypeProvider().getFeatureProvider().addIfPossible(addContext);
  }
  protected void drawMessageFlows(
      final Collection<MessageFlow> messageFlows, final BpmnMemoryModel model) {

    for (final MessageFlow messageFlow : messageFlows) {

      Anchor sourceAnchor = null;
      Anchor targetAnchor = null;
      ContainerShape sourceShape =
          (ContainerShape)
              getDiagramTypeProvider()
                  .getFeatureProvider()
                  .getPictogramElementForBusinessObject(
                      model.getFlowElement(messageFlow.getSourceRef()));

      if (sourceShape == null) {
        continue;
      }

      EList<Anchor> anchorList = sourceShape.getAnchors();
      for (Anchor anchor : anchorList) {
        if (anchor instanceof ChopboxAnchor) {
          sourceAnchor = anchor;
          break;
        }
      }

      ContainerShape targetShape =
          (ContainerShape)
              getDiagramTypeProvider()
                  .getFeatureProvider()
                  .getPictogramElementForBusinessObject(
                      model.getFlowElement(messageFlow.getTargetRef()));

      if (targetShape == null) {
        continue;
      }

      anchorList = targetShape.getAnchors();
      for (Anchor anchor : anchorList) {
        if (anchor instanceof ChopboxAnchor) {
          targetAnchor = anchor;
          break;
        }
      }

      AddConnectionContext addContext = new AddConnectionContext(sourceAnchor, targetAnchor);

      List<GraphicInfo> bendpointList = new ArrayList<GraphicInfo>();
      if (model.getBpmnModel().getFlowLocationMap().containsKey(messageFlow.getId())) {
        List<GraphicInfo> pointList =
            model.getBpmnModel().getFlowLocationGraphicInfo(messageFlow.getId());
        if (pointList.size() > 2) {
          for (int i = 1; i < pointList.size() - 1; i++) {
            bendpointList.add(pointList.get(i));
          }
        }
      }
      addContext.putProperty("org.activiti.designer.bendpoints", bendpointList);
      addContext.putProperty(
          "org.activiti.designer.connectionlabel",
          model.getBpmnModel().getLabelGraphicInfo(messageFlow.getId()));

      addContext.setNewObject(messageFlow);
      getDiagramTypeProvider().getFeatureProvider().addIfPossible(addContext);
    }
  }