javaumldms

UML modelling roles, users, and documents


I'm new student in UML modeling and a want to model a situation.

I have a system where the admin create roles and users and documents, they all exist in the database and the admin will chose for each document the users that could manipulate this doc with a role

Question is I'm trying to model it only with binary associations, if it's not possible what's the solution? here the screen you will see more the situation enter image description here

as you can see the user_a have a role role_1 in the doc_1 and another role in the doc_2 and the user_c doesn't have a role in the doc_2 ;)


Solution

  • lipido's idea is good, but unfortunatelly the proposed solution has an apparently minor but significant flaw and does not cover your third requirement: role could exist and not affected to any user-doc relation. Modelled as an association class, Role can only exist as a link instance between a User and a Document objects. In this solution a Role can not be defined as an independent instance! In addition, it does not permit reuse of roles.

    Here you have two solutions that fix this problem. You should chose among them according to additional conditions (see the notes):

    enter image description here

    UPDATE (after the comments)

    Here is an object diagram that explains the run-time structure of object (it is based in the second class diagram, the one with association class rather than n-ry association):

    enter image description here

    Please see the notes in the comments. Not that Access instance is both a class and an association instance (link). That's why it always has a single instance of both associated classes and in this case only one Role. Each User can have on the other hand Access to many Documents (0..) and each Document can be Accessed by 0 or more Users (0..).