How would you use UML to model the following relationship?
Created May 4, 2012
Paul Reed Although you can create an Association class for 1:M and even 1:1 relationships (thanks Mr. Moore), they are quite rare in practice. Association classes are typically used in a m:m context.
I assume a domain can have more than one privilege? and you have already
stated that a privilege can only be related to one domain. I also assume
more than one user can have the same privilege?
Then your class diagram should look like:
0..* 0..* 0..* 1
User------------Privilege-------Domain
|
|
Responsibility
I am having problems with how this appears in the message but I have added a Responsibility class because it captures the information about the association between you the user and a given privilege (like the date you added it etc). So, it is the association class that should extend from the association between User and Privilege. With your previous solution, a privilege could only be related to one user and one domain...not what you want. With all of this I am assuming a privilege is some type of application functionality? I have had to implement a similar design and this solution worked quite well.
0..* 0..* 0..* 1
User------------Privilege-------Domain
|
|
Responsibility
I am having problems with how this appears in the message but I have added a Responsibility class because it captures the information about the association between you the user and a given privilege (like the date you added it etc). So, it is the association class that should extend from the association between User and Privilege. With your previous solution, a privilege could only be related to one user and one domain...not what you want. With all of this I am assuming a privilege is some type of application functionality? I have had to implement a similar design and this solution worked quite well.