I'm trying to design UML Analysis Class Diagram for a college project. My UML Diagram looks like this:
I have encountered two different problems:
You have a really good start to an analysis model. Some things I would do:
User
and Role
(or make it an association class) called Role Assignment
. Manager
authorizes Role Assignment
and Role Assignment
authorized by Manager
. Here's an example first cut, off the top of my head:
I left off a bunch of stuff, including operations, which I would suppress for validation with SMEs. I can't do all the work for you! 😉
Re 1:
these are the methods to manipulate roles and
shows how the manager uses them. The constraint tells that only the manager may use this method.
Short Quick Answer
Make the Role
class, not the Manager
class.
Long Boring Answer
I had a similar case, but, eventually, had a similar Manager
class, and later add a MiddleManager
class that could also manage other classes.
..........................
..+-----------------+.....
..| User |--+..
..+-----------------+..|..
...........^...........|..
........../ \..........|..
..........\ /..........|..
...........v...........|..Can Manage Other Users
...........|...........|..
...........|...........|..
...........|...........|..
..+-----------------+..|..
..| Role |--+..
..+-----------------+.....
..| [+] CanManage() |.....
..+-----------------+.....
..........................
So, I move a function or properties canManage()
to the Role
class.
As @Thomas Kilian mention, your question is more a behaviour feature, than a structural feature. Behaviors are represented as methods or properties, in a class diagram.
UPDATE:
..........................
..+-----------------+.....
..| User |--+..
..+-----------------+..|..«Can Manage Other Users»
..| [+] CanManage() |--+..
..+-----------------+.....
...........^..............
........../ \.............
..........\ /.............
...........v..............
...........|..............
...........|..............
...........|..............
..+-----------------+.....
..| Role |.....
..+-----------------+.....
..........................
Another version may include a self referenced association.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.