Would be a bit length to post the code. Since it's in some parts written for a customer I can not easily publish it. Maybe I find the time to share common parts on GitHub later. Anyhow, here's my wrapper (you need to create that from within a repository wrapper class whereever you return connectors. It makes use of other wrapper classes in a similar way.
class EAConnector(EAComObject):
""" Wrapper to ease access to "opposite" elements of a connector """
def __new__(cls, connector):
if connector == None: return None
instance = super(EAConnector, cls).__new__(cls)
instance._comobj = connector
instance._rep = Repository.Instance()
instance._taggedValues = None
return instance
@property
def taggedValues(self):
if self._taggedValues == None:
self._taggedValues = EATaggedValues(dummy, self._comobj.taggedValues)
return self._taggedValues
def other(self, objId):
if isinstance(objId, EAElement):
objId = objId.elementID
elif isinstance(objId, EAPackage):
objId = objId.element.elementID
else:
assert False, "Invalid use of other for %s" %objId
otherId = self._comobj.supplierId if self._comobj.clientId == objId else self._comobj.clientId
other = EAElement(self._rep.getElementByID (otherId))
if other.type == "Package":
package = self._rep.getPackageByGUID(other.elementGUID)
return package
else:
return other
def thisEnd(self, objId):
if isinstance(objId, EAElement):
objId = objId.elementID
elif isinstance(objId, EAPackage):
objId = objId.element.elementID
else:
assert False, "Invalid use of thisEnd for %s" %objId
return self._comobj.clientEnd if self._comobj.clientId == objId else self._comobj.supplierEnd
def otherEnd(self, objId):
if isinstance(objId, EAElement):
objId = objId.elementID
elif isinstance(objId, EAPackage):
objId = objId.element.elementID
else:
assert False, "Invalid use of otherEnd for %s" %objId
return self._comobj.clientEnd if self._comobj.supplierId == objId else self._comobj.supplierEnd
q.