if (parentNode != null && childNode != null) { if (childNode.getParent() != null && childNode.getParent() != parentNode) { FrameNode tmp = childNode; childNode = new FrameNodeProxy(childNode); tmp.addProxy((FrameNodeProxy)childNode); if (log.isDebugEnabled()) log.debug("creating *FrameNodeProxy for frame '"+f.getChildValue()+"'  relation="+relationship); } FrameNode relationNode = parentNode.getRelationshipNode(relationship); if (relationNode == null) { if (log.isDebugEnabled()) log.debug("creating RelationFrameNode:  "+f.getParentValue()+"=>"+relationship+"==>"+f.getChildValue()); relationNode = new FrameNode(relationship); parentNode.addRelationshipNode(treeModel, relationNode); }
FrameNode relationNode = parentNode.getRelationshipNode(relationship);   if (relationNode == null) { if (log.isDebugEnabled()) log.debug("creating RelationFrameNode:  "+f.getParentValue()+"=>"+relationship+"==>"+f.getChildValue()); relationNode = new FrameNode(relationship); parentNode.addRelationshipNode(treeModel, relationNode); }    TreeNode tmpParent = childNode.getParent(); if (tmpParent != null && tmpParent != relationNode && !relationNode.hasChild(childNode)) {  FrameNode tmp = childNode; childNode = new FrameNodeProxy(childNode); tmp.addProxy((FrameNodeProxy)childNode); if (log.isDebugEnabled()) log.debug("creating *FrameNodeProxy for frame "+f.getParentValue()+"=>"+relationship+"==>"+f.getChildValue()+" parentF="+pf+" childF="+cf+"\n\t\t\tchild already has a parent="+tmp.getParent());
    protected void processRelationships(Collection relationshipFrames) {        org.cougaar.core.qos.frame.RelationFrame f;        org.cougaar.core.qos.frame.Frame pf, cf;        FrameNode parentNode, childNode;        String relationship, parentName, childName, parentProto, childProto;        for (Iterator ii=relationshipFrames.iterator(); ii.hasNext();) {            f = (org.cougaar.core.qos.frame.RelationFrame) ii.next();            //parentName = (String) f.getParentValue();            //childName  = (String) f.getChildValue();            //parentProto = (String) f.getParentPrototype();            //childProto  = (String) f.getChildPrototype();            pf = f.relationshipParent();            cf = f.relationshipChild();            relationship = (String) f.getKind();            if (pf == null || cf  == null) { // we got ourselves an invalid relation frame (if parent || child has not arrived yet)                if (log.isDebugEnabled())                        log.debug("processRelationships:  invalid relation frame, ignoring"+f.getParentValue()+"=>"+relationship+"==>"+f.getChildValue());                return;            }            parentNode = createNode(pf);            childNode  = createNode(cf);            if (parentNode != null && childNode != null) {                if (childNode.getParent() != null && childNode.getParent() != parentNode) {                    FrameNode tmp = childNode;                    childNode = new FrameNodeProxy(childNode);                    tmp.addProxy((FrameNodeProxy)childNode);                    if (log.isDebugEnabled())                        log.debug("creating *FrameNodeProxy for frame '"+f.getChildValue()+"'  relation="+relationship);                }                FrameNode relationNode = parentNode.getRelationshipNode(relationship);                if (relationNode == null) {                    if (log.isDebugEnabled())                        log.debug("creating RelationFrameNode:  "+f.getParentValue()+"=>"+relationship+"==>"+f.getChildValue());                    relationNode = new FrameNode(relationship);                    parentNode.addRelationshipNode(treeModel, relationNode);                }                //relationNode.add(child);                //treeModel.insertNodeInto(childNode, relationNode, 0);                insertNode(childNode, relationNode);            } else {                if (log.isDebugEnabled())                    log.debug("++error: can't create node,  parent='"+f.getParentValue()+"'("+(parentNode!=null?"found":"not found")+") childName='"+f.getChildValue()+"'("+(childNode!=null?"found":"not found")+") relationship='"+relationship+"'");                ;// print something here            }        }        Collection rootNodes = findRootLevelNodes();        TreeNode tnode;        for (Iterator ii=rootNodes.iterator(); ii.hasNext();)            insertNode((FrameNode)ii.next(), (FrameNode)root);            //treeModel.insertNodeInto((DefaultMutableTreeNode) ii.next(), root, 0);    }