Пример #1
0
    def getModel(self, doc):
        content = self.getContent(doc)
        try:
            model = getElementByTagName(content, XMI.MODEL, recursive=0)
        except TypeError:
            #handle a bug in ArgoUML that causes 2 model entries in the xmi
            #from which one is empty
            models = getElementsByTagName(content, XMI.MODEL, recursive=0)
            model = models[1]

        return model
Пример #2
0
 def getModel(self, doc):
     content = self.getContent(doc)
     try:
         model = getElementByTagName(content, XMI.MODEL, recursive=0)
     except TypeError:
         #handle a bug in ArgoUML that causes 2 model entries in the xmi
         #from which one is empty
         models = getElementsByTagName(content, XMI.MODEL, recursive=0)
         model=models[1]
         
     return model
Пример #3
0
 def getPackageElements(self, el):
     """Gets all package nodes below the current node (only one level)."""
     res = []
     #in case the el is a document we have to crawl down until we have ownedElements
     ownedElements = getElementByTagName(el, self.OWNED_ELEMENT, default=None)
     if not ownedElements:
         if el.tagName == self.PACKAGE:
             return []
         el = getElementByTagName(el, self.MODEL, recursive=1)
     ownedElements = getElementByTagName(el, self.OWNED_ELEMENT)
     res = getElementsByTagName(ownedElements, self.PACKAGE)
     return res
Пример #4
0
 def getPackageElements(self, el):
     """Gets all package nodes below the current node (only one level)."""
     res = []
     #in case the el is a document we have to crawl down until we have ownedElements
     ownedElements = getElementByTagName(el,
                                         self.OWNED_ELEMENT,
                                         default=None)
     if not ownedElements:
         if el.tagName == self.PACKAGE:
             return []
         el = getElementByTagName(el, self.MODEL, recursive=1)
     ownedElements = getElementByTagName(el, self.OWNED_ELEMENT)
     res = getElementsByTagName(ownedElements, self.PACKAGE)
     return res
Пример #5
0
    def calculateStereoType(self, o):
        # In xmi its weird, because all objects to which a stereotype
        # applies are stored in the stereotype while in xmi 1.2 its opposite

        sts = getElementsByTagName(o.domElement, self.STEREOTYPE_MODELELEMENT,
                                   recursive=0)
        for st in sts:
            strefs = getSubElements(st)
            for stref in strefs:
                id = self.getIdRefOrHrefId(stref)
                if id:
                    st = stereotypes[id]
                    o.addStereoType(self.getName(st).strip())
                    log.debug("Stereotype found: id='%s', name='%s'.",
                              id, self.getName(st))
                else:
                    log.warn("Empty stereotype id='%s' for class '%s'",
                             o.getId(), o.getName())