Ejemplo n.º 1
0
def connectTheDots():
    """
    Called by the Anatomy module (if you are using it) after all of
    the anatomy has been read into memory.  This connects the different
    object types together in many different ways.
    """
    global _partOfParentsForChild, _partOfChildrenForParent

    _partOfParentsForChild = {}
    _partOfChildrenForParent = {}

    for timedNode in Iterator():
        node = Nodes.getByOid(timedNode.getNodeOid())
        for childNode in Nodes.getPartOfChildrenForNode(node):
            childTimedNode = getByNodeStageOids(childNode.getOid(),
                                                timedNode.getStageOid())
            if childTimedNode:
                if childTimedNode in _partOfParentsForChild:
                    _partOfParentsForChild[childTimedNode].add(timedNode)
                else:
                    _partOfParentsForChild[childTimedNode] = sets.Set([timedNode])

        for parentNode in Nodes.getPartOfParentsForNode(node):
            parentTimedNode = getByNodeStageOids(parentNode.getOid(),
                                                 timedNode.getStageOid())
            if parentTimedNode:
                if parentTimedNode in _partOfChildrenForParent:
                    _partOfChildrenForParent[parentTimedNode].add(timedNode)
                else:
                    _partOfChildrenForParent[parentTimedNode] = sets.Set([timedNode])

    return