def property(self, source, target):
    """Create property.
    """
    if isprofilemember(source):
        return
    if source.attributes.get('association', None) is not None:
        return
    if 'type' in source.attributes.keys():
        typedef = source.refindex[source.attributes['type']]
        tok = token('sourcetotargetuuidmapping', False)
        type = target.anchor.node(tok.uuids[typedef.uuid])
    else:
        try:
            name = source['type'].attributes['href']
        except KeyError:
            raise ValueError,'Property "%s" in class "%s" has no datatype!' % \
                (source.element.get('name'),source.parent.element.get('name'))
        name = name[name.rfind('#') + 1:]
        tok = token('primitivetypemapping', False)
        type = target.anchor.node(tok.types[name])
    property = Property()
    assignxmiprops(property,source)

    property.type = type
    target.anchor[source.attributes['name']] = property
    target.finalize(source, property)
def operation(self, source, target):
    """Create operation.
    """
    operation = Operation()
    assignxmiprops(operation,source)
    target.anchor[source.attributes['name']] = operation
    target.finalize(source, operation)
def ownedend(self, source, target):
    """Create owned end.
    """
    if isprofilemember(source):
        return
    oe_source = source.refindex[source.attributes['association']]
    tok = token('sourcetotargetuuidmapping', False)
    associationuuid = tok.uuids[oe_source.uuid]
    association = target.anchor.node(associationuuid)
    associationend = AssociationEnd()
    assignxmiprops(associationend,source)
    associationend.association = association
    # XXX: we the private uuid listing pointing to member ends. could
    #      be simlified, read node.ext.uml.classes for details
    association._memberEnds.append(associationend.uuid)
    cla_source = source.refindex[source.attributes['type']]
    classuuid = tok.uuids[cla_source.uuid]
    associationend.type = target.anchor.node(classuuid)
    uppervalue = source['upperValue'].attributes['value'] if source.has_key('uppervalue') else '*'
    if uppervalue == '*':
        uppervalue = INFINITE
    else:
        uppervalue = int(uppervalue)
    associationend.uppervalue = uppervalue
    lowervalue = source['lowerValue'].attributes.get('value', '*')  if source.has_key('lowervalue') else 1
    if lowervalue == '*':
        lowervalue = INFINITE
    else:
        lowervalue = int(lowervalue)
    associationend.lowervalue = lowervalue
    association[source.attributes['name']] = associationend
    target.finalize(source, associationend)
예제 #4
0
def interface(self, source, target):
    """Create interfaces.
    """
    interface = Interface()
    assignxmiprops(interface,source)
    target.anchor[source.attributes['name']] = interface
    target.finalize(source, interface)
예제 #5
0
def class_(self, source, target):
    """Create classes.
    """
    class_ = Class()
    assignxmiprops(class_,source)
    target.anchor[source.attributes['name']] = class_
    target.finalize(source, class_)
예제 #6
0
def package(self, source, target):
    """Create packages.
    """
    package = Package()
    assignxmiprops(package,source)
    target.anchor[source.attributes['name']] = package
    target.finalize(source, package)
예제 #7
0
def associationclass(self, source, target):
    """Create association classes.
    """
    if isprofilemember(source):
        return
    association_class = AssociationClass()
    assignxmiprops(association_class, source)
    target.anchor[source.attributes['name']] = association_class
    target.finalize(source, association_class)
예제 #8
0
def association(self, source, target):
    """Create associations.
    """
    if isprofilemember(source):
        return
    association = Association()
    assignxmiprops(association, source)
    target.anchor[str(association.uuid)] = association
    target.finalize(source, association)
def dependency(self, source, target):
    if isprofilemember(source):
        return
    tok = token('sourcetotargetuuidmapping', False)
    supplier_source = source.refindex[source.attributes['supplier']]
    supplieruuid = tok.uuids[supplier_source.uuid]
    supplier = target.anchor.node(supplieruuid)
    client_source = source.refindex[source.attributes['client']]
    clientuuid = tok.uuids[client_source.uuid]
    client = target.anchor.node(clientuuid)
    dependency = Dependency()
    assignxmiprops(dependency,source)
    dependency.client = client
    dependency.supplier = supplier
    target.anchor[str(dependency.uuid)] = dependency
    target.finalize(source, dependency)