Author Topic: MDG Technologies  (Read 6901 times)

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
MDG Technologies
« on: April 04, 2012, 01:03:11 am »
Hi
I have an MDG technology that defines a profile and toolboxes that enable me to create various classes on my diagrams.
What I would like to to is when an operation is added to one these classes, the operation should automatically have a set of tagged values.
Can this be achieved through the use of profiles/MDG

Thanks
Using V12

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: MDG Technologies
« Reply #1 on: April 04, 2012, 01:36:44 am »
I had a similar case with attributes.
The only way I know is to define a separate stereotype for your operation,
users of your technology need to drop the operations from the toolbox to the class then.
Another option is to do this using an AddIn.

HTH
Günther

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: MDG Technologies
« Reply #2 on: April 04, 2012, 02:03:55 am »
Thanks
I'll give it a  try
Using V12

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Technologies
« Reply #3 on: April 04, 2012, 03:08:52 am »
The only other way is to catch one of the OnPost events triggered by EA and react accordingly.

q.

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +54/-3
    • View Profile
Re: MDG Technologies
« Reply #4 on: April 04, 2012, 09:16:07 am »
Quote
The only other way is to catch one of the OnPost events triggered by EA and react accordingly.

q.
EA_OnPostNewMethod
The Sparx Team
[email protected]

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: MDG Technologies
« Reply #5 on: April 04, 2012, 06:50:31 pm »
Hi
Thanks for the replies
How do I extract the MethodID from the EA.EventProperties passed to EA_OnPostNewMethod?
Using V12

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Technologies
« Reply #6 on: April 04, 2012, 07:59:53 pm »
OnPost passes the object. So you find it at parm2.MethodID. (N.B. I have used connector and element where it is that way so I guess method is alike.)

The OnPre instead gives you a collection with key/value pairs where you can find it.

q.
« Last Edit: April 04, 2012, 08:01:15 pm by qwerty »

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: MDG Technologies
« Reply #7 on: April 04, 2012, 08:06:34 pm »
Hi
I have tried this
Code: [Select]
public bool EA_OnPostNewMethod(EA.Repository Repository, EA.EventProperties Info)
        {
            int id;
            id = Info.MethodID;
            return false;
        }
but it doesn't compile!
Sorry if I'm missing the obvious
Using V12

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: MDG Technologies
« Reply #8 on: April 04, 2012, 09:07:09 pm »
Sorry, I'm no Cxx guru. But try EA.Method  (or what it is called) since that is what you get - the EA object for a method.

q.
« Last Edit: April 04, 2012, 09:08:29 pm by qwerty »

Makulik

  • EA User
  • **
  • Posts: 400
  • Karma: +0/-0
    • View Profile
Re: MDG Technologies
« Reply #9 on: April 04, 2012, 09:29:09 pm »
I guess it's C#, right?
Effectively the EventProperties is a collection which can be accessed with String type keys. The key to use should be "MethodID", it's s.th. like
Info.Get("MethodID"), which returns you a Variant containing the ID. With this you can call int.Parse(Info.Get("MethodID").ToString()).

HTH
Günther

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: MDG Technologies
« Reply #10 on: April 04, 2012, 11:05:40 pm »
Thanks
Using V12

philchudley

  • EA User
  • **
  • Posts: 744
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: MDG Technologies
« Reply #11 on: April 06, 2012, 09:57:20 am »
Hi

What I would try is to create a UML profile where a stereotype that extends the metaclass operation is created.

As usual attributes added to the stereotype will become tagged values for the operation.
 
You should be able to add the operation, change its stereotype and then the tagged values will be there.

It worked for me for attributes, so I see no reason why it should not work for operations although I haven;t tried it.

Add the profile to the MDG in the usual manner.

Hope this helps

Cheers

Phil
Models are great!
Correct models are even greater!

philchudley

  • EA User
  • **
  • Posts: 744
  • Karma: +21/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: MDG Technologies
« Reply #12 on: April 06, 2012, 10:10:56 am »
Follow up, I have just conducted a simple test and what I described in the previous post does indeed work as described.

Cheers

Phil
Models are great!
Correct models are even greater!

SomersetGraham

  • EA User
  • **
  • Posts: 376
  • Karma: +1/-0
    • View Profile
Re: MDG Technologies
« Reply #13 on: April 10, 2012, 05:36:25 pm »
Thanks for your help
got it working now
Using V12