Book a Demo

Author Topic: Restrict connectors between stereotypes  (Read 5784 times)

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1405
  • Karma: +42/-2
    • View Profile
    • www.umlchannel.com
Restrict connectors between stereotypes
« on: April 11, 2014, 03:08:59 am »
Hi,

I created a number of stereotypes in a UML profile on the metaclass Class :
Type_A, Type_B, Type_1, Type_2

Is there a way with UML profiles to define that only Type_A can be linked via an Association relationship with Type_B & vice-versa, and the same with Type_1 & Type_2. In other words can we enable rules e.g. to forbid a Type_1 class to be associated with a Type_A class?

I looked at the Quick Linker rules but can't get it to work (if you have any sample better than Sparx help) -> http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/quick_linker_example.html.
Would this sort my issue?

Any other advice?

Thanks
Guillaume

Blog: www.umlchannel.com | Free utilities addin: www.eautils.com


qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Restrict connectors between stereotypes
« Reply #1 on: April 11, 2014, 04:45:47 am »
You need to write an add-in that catches OnPreNewConnector. The Quick Linker only limits the number of offered connectors but you can create them "the normal way" from any toolbox (if they are UML compliant). It's also possible to use model validation to check if wrong connectors have been applied (I guess, since I only use scripts for that purpose).

q.

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Restrict connectors between stereotypes
« Reply #2 on: April 11, 2014, 06:00:42 pm »
The best quicklinker examples i have found are in the bpmn mdgs...have a look in the MDGTechnologies folder under your sparx install dir.
« Last Edit: April 11, 2014, 06:01:27 pm by openit »

RoyC

  • EA Administrator
  • EA Practitioner
  • *****
  • Posts: 1297
  • Karma: +21/-4
  • Read The Help!
    • View Profile
Re: Restrict connectors between stereotypes
« Reply #3 on: April 14, 2014, 09:21:44 am »
The Quicklinker really has nothing to do with your issue. As qwerty says, it offers suggestions for the type of connector and the type of target element you can use for a given source element type, but this is not restrictive and - as far as the Quicklinker is concerned -  you can create any connector to any type of element by any other means you like.

What you need to do is either create a script to check that your source-connector-target combinations are within the constraints you set (as qwerty also suggests), or create your own Model Validation module within an MDG Technology (which also contains your Profile). For the second option, see:

http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/creatingmdgtechnologies.html

(Note step 10 of that second link)   and

http://www.sparxsystems.com/enterprise_architect_user_guide/10/extending_uml_models/model_validation_2.html


Best Regards, Roy