/** Reattach all links to their source and target node. */
 private void reattachLinks() {
   for (OPPLink link : links) {
     link.setSource(linkSources.get(link));
     link.setTarget(linkTargets.get(link));
     if (container instanceof OPPObjectProcessDiagram) {
       link.setOpd((OPPObjectProcessDiagram) container);
     } else {
       OPPNode containerNode = (OPPNode) container;
       link.setOpd(OPPNodeExtensions.findOPD(containerNode));
     }
   }
 }
 /**
  * Detach all links from the node and from the other connecting node, storing the connection
  * information in local data structures.
  */
 private void detachLinks() {
   links = new ArrayList<OPPLink>();
   linkSources = new HashMap<OPPLink, OPPNode>();
   linkTargets = new HashMap<OPPLink, OPPNode>();
   links.addAll(node.getIncomingLinks());
   links.addAll(node.getOutgoingLinks());
   for (OPPLink link : links) {
     linkSources.put(link, link.getSource());
     linkTargets.put(link, link.getTarget());
     link.setSource(null);
     link.setTarget(null);
     link.setOpd(null);
   }
 }