Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: bilon on July 18, 2019, 10:52:32 pm

Title: Synchronize tagged values on operation
Post by: bilon on July 18, 2019, 10:52:32 pm
I'm adding new stereotype to a operation and I need to propagate all the operations tagged values to this operation. There's a method SynchTaggedValues but it exists just for elements. So, what to do with the operation?
Title: Re: Synchronize tagged values on operation
Post by: Geert Bellekens on July 18, 2019, 11:49:12 pm
if you do it correctly the tagged values should appear automatically after setting the stereotype.
Make sure to use StereotypeEx and the fully qualified stereotype name.

Geert
Title: Re: Synchronize tagged values on operation
Post by: bilon on July 19, 2019, 01:09:41 am
I'm used to use plain names, because EA UI does it this way. Anyway, even with fully qualified names, it doesn't work. Here is my code:
Code: [Select]
Set methBP = tab.Methods.AddNew("BASE", Empty)
methBP.Stereotype = "aaBIF metadata::Phase_Basic"
methBP.StereotypeEx = methBP.Stereotype
methBP.Update
tab.Methods.Refresh

What is strange, that when looking at the operation properties afterwards, both stereotypes are plain. It looks like this (name|stereotype|stereotypeEx):
BASE|Phase_Basic|Phase_Basic

Here is the image of my MDG profile:
(https://photos.app.goo.gl/bxCRgp4sXKkuUw2u7)
https://photos.app.goo.gl/bxCRgp4sXKkuUw2u7 (https://photos.app.goo.gl/bxCRgp4sXKkuUw2u7)

Title: Re: Synchronize tagged values on operation
Post by: Geert Bellekens on July 19, 2019, 01:22:27 am
Don't use .stereotype, but ony StereotypeEx
Then you'll have to make sure you are using the correct fully qualified name. Check t_xref to be sure.
An image of the toolbox does not help in any way as neither the name of the UML profile as the name of the stereotypes are shown there.

Geert
Title: Re: Synchronize tagged values on operation
Post by: qwerty on July 19, 2019, 01:35:07 am
Code: [Select]
methBP.Stereotype = "aaBIF metadata::Phase_Basic"
methBP.StereotypeEx = methBP.Stereotype
Makes EA cut the stereo to its base name which you then feed in to Ex. Would be the same as
Code: [Select]
methBP.Stereotype = "aaBIF metadata::Phase_Basic"
methBP.StereotypeEx = "Phase_Basic"

q.
Title: Re: Synchronize tagged values on operation
Post by: bilon on July 19, 2019, 06:35:41 pm
I use both Stereotype and StereotypeEx, because EA UI does it this whay. When using StereotypeEx only, what shall I do with Stereotype? Leave it empty?

Anyway, using this
Code: [Select]
methBP.Stereotype = "aaBIF metadata::Phase_Basic"
methBP.StereotypeEx = "aaBIF metadata::Phase_Basic"
has same effect as using this
Code: [Select]
methBP.Stereotype = "aaBIF metadata::Phase_Basic"ode
methBP.StereotypeEx = methBP.Stereotype
both properties are without qualifier. So, how shall I code it?

By the way, both profile and stereotype are visible in the picture. I have emphasized it.

What is it t_xref?
Title: Re: Synchronize tagged values on operation
Post by: qwerty on July 19, 2019, 06:42:17 pm
t_xref is the table that also holds stereotype information. Have you also tried to JUST use stereotypeEx?

q.
Title: Re: Synchronize tagged values on operation
Post by: Geert Bellekens on July 19, 2019, 06:42:39 pm
Yes, use only .StereotypeEx, don't use .Stereotype at all.
EA will fill in the .Stereotype field for you based on what you set in StereotypeEx

What is shown in your picture is the toolbox panel name, and the toolbox item name.
They can be the same as the profile and stereotype, but don't have to be.

t_xref is the table where the fully qualified stereotype details are stored.

Geert
Title: Re: Synchronize tagged values on operation
Post by: bilon on July 19, 2019, 07:39:56 pm
Ok, I found this in the t_xref (in many rows)
@STEREO;Name=Phase_Basic;FQName=aaBIF metadata::Phase_Basic;@ENDSTEREO;
so my fully qualified name was ok.

My code looks like this
Code: [Select]
Set methBP = tab.Methods.AddNew("BASE", Empty)
methBP.StereotypeEx = "aaBIF metadata::Phase_Basic"
methBP.Update
tab.Methods.Refresh
but the result is still same - both stereotypes without qualifier and no taggad values on the method.

???
Title: Re: Synchronize tagged values on operation
Post by: Geert Bellekens on July 19, 2019, 07:48:24 pm
Ok, I found this in the t_xref (in many rows)
@STEREO;Name=Phase_Basic;FQName=aaBIF metadata::Phase_Basic;@ENDSTEREO;
so my fully qualified name was ok.

My code looks like this
Code: [Select]
Set methBP = tab.Methods.AddNew("BASE", Empty)
methBP.StereotypeEx = "aaBIF metadata::Phase_Basic"
methBP.Update
tab.Methods.Refresh
but the result is still same - both stereotypes without qualifier and no taggad values on the method.

???
The stereotype fields never show the fully qualified name, so that's OK.
The tagged values should have automatically been added.
I've never really used this on operation, so there might be a bug preventing the tagged values to be added directly.

In that case there's a workaround to call Synchronize stereotype, but that will dot it for all items with that stereotype.
Since v14 or v15 you use Repository.SynchProfile (string Profile, string Stereotype)

Geert
Title: Re: Synchronize tagged values on operation
Post by: bilon on July 19, 2019, 07:54:23 pm
Hm, I'm using v12 :-(
Anyway, synchronizing all the objects isn't very handy for my needs.
Title: Re: Synchronize tagged values on operation
Post by: Geert Bellekens on July 19, 2019, 08:03:11 pm
In v12 you can use the Repository.CustomCommand to do the same:

See this script for an example: https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Tools/UML%20Profile/Synchronize%20Steretoypes.vbs (https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Tools/UML%20Profile/Synchronize%20Steretoypes.vbs)

Geert
Title: Re: Synchronize tagged values on operation
Post by: bilon on July 19, 2019, 08:20:50 pm
I've tried and it works. Ok, this is just workaround for me, but thank you.