Migrating Association Roles in a Class Diagram

You can migrate association roles and create attributes before generation. This is very convenient for many reasons including data type customization and the ability to change the attribute order in the list of attributes. The last feature is especially important in XML.

Regardless of the navigability, the migration creates an attribute and sets its properties as follows:

Migration Rules

The following rules apply when migrating association roles:

  • If the migrated attribute name is the same as the role name, then modifying the role name synchronizes the migrated attribute name

  • If the migrated attribute data type is the same as the role classifier, then modifying the role multiplicity synchronizes the migrated attribute multiplicity

  • If the code of the classifier, linked by the association, changes, then the migrated attribute data type is automatically synchronized

  • If you manually change the migrated attribute, the synchronization does not work, the association role is not synchronized

  • The migrated attribute is automatically deleted if the association is deleted

After migration, the property sheet of the new attribute displays the name of the association in the Migrated from box in the Detail tab.