def _getPyutLink(self, obj): """ To extract a PyutLink from an OglLink object. @param String obj : Name of the object. """ link = obj.getElementsByTagName("Link")[0] aLink = PyutLink() aLink.setBidir(bool(link.getAttribute('bidir'))) # aLink.setDestinationCardinality(link.getAttribute('cardDestination')) # aLink.setSourceCardinality(link.getAttribute('cardSrc')) aLink.destinationCardinality = link.getAttribute('cardDestination') aLink.sourceCardinality = link.getAttribute('cardSrc') aLink.setName(link.getAttribute('name')) strLinkType: str = link.getAttribute('type') linkType: LinkType = LinkType(int(strLinkType)) aLink.setType(linkType) # source and destination will be reconstructed by _getOglLinks sourceId = int(link.getAttribute('sourceId')) destId = int(link.getAttribute('destId')) return sourceId, destId, aLink
def _getLinks(self, obj): """ To extract links form an OGL object. @param String obj : Name of the object. @since 1.0 @author Deve Roux <*****@*****.**> @changed Philippe Waelti <*****@*****.**> : Refactoring campaign """ allLinks = [] for link in obj.getElementsByTagName("Link"): aLink = PyutLink() aLink.setBidir(bool(link.getAttribute('bidir'))) # aLink.setDestinationCardinality(link.getAttribute('cardDestination')) # aLink.setSourceCardinality(link.getAttribute('cardSrc')) aLink.destinationCardinality = link.getAttribute('cardDestination') aLink.sourceCardinality = link.getAttribute('cardSrc') aLink.setName(link.getAttribute('name')) aLink.setType(link.getAttribute('type')) aLink.setDestination(link.getAttribute('destination')) # Backward compatibility if link.hasAttribute('destId'): destId = int(link.getAttribute('destId')) else: destId = 0 allLinks.append([destId, aLink]) return allLinks