Author Topic: Synchronize stereotype  (Read 1635 times)

tzafrir

  • EA User
  • **
  • Posts: 127
  • Karma: +0/-0
    • View Profile
Synchronize stereotype
« on: May 06, 2019, 01:19:44 am »
Hi,

I would like to simulate the action of synchronizing a stereotype from an Addin.
The action in EA is:
Go to toolbox tab -> choose any stereotype -> click Synchronize StereoType.

Is this action feasible threw the EA API?

Tzafrir

qwerty

  • EA Guru
  • *****
  • Posts: 12446
  • Karma: +348/-291
  • I'm no guru at all
    • View Profile
Re: Synchronize stereotype
« Reply #1 on: May 06, 2019, 03:29:03 am »
You could use Repository.SynchProfile (string Profile, string Stereotype)

unless someone threw it away  ;D

q.

Guillaume

  • EA Practitioner
  • ***
  • Posts: 1088
  • Karma: +34/-2
    • View Profile
    • www.umlchannel.com
Re: Synchronize stereotype
« Reply #2 on: May 06, 2019, 04:31:48 pm »
You can look at Geert's script here:
https://github.com/GeertBellekens/Enterprise-Architect-VBScript-Library/blob/master/Framework/Tools/UML%20Profile/Synchronize%20Steretoypes.vbs

It runs Repository.CustomCommand method on a collection of stereotype.
Guillaume

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


qwerty

  • EA Guru
  • *****
  • Posts: 12446
  • Karma: +348/-291
  • I'm no guru at all
    • View Profile
Re: Synchronize stereotype
« Reply #3 on: May 06, 2019, 05:32:28 pm »
Actually Repositor.Synchprofile had been opened to overcome the misuse of the undocumented Repository.CustomCommand.

q.

tzafrir

  • EA User
  • **
  • Posts: 127
  • Karma: +0/-0
    • View Profile
Re: Synchronize stereotype
« Reply #4 on: May 12, 2019, 07:26:56 pm »
thanks for the help

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8001
  • Karma: +211/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Synchronize stereotype
« Reply #5 on: April 07, 2021, 03:25:34 pm »
Actually Repositor.Synchprofile had been opened to overcome the misuse of the undocumented Repository.CustomCommand.

q.
We're about to use this is a serious way.  As we've been playing with tag inheritance and tag prefixes, we've repeatedly found we need to "Synchronize Stereotype".

We're about to programmatically resynchronise various stereotypes (perhaps, on occasion, all in the profile).  Are there any gotchas anyone can provide (or alternatively confirm that "it works as expected")?

TIA,
Paolo

Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11315
  • Karma: +422/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Synchronize stereotype
« Reply #6 on: April 07, 2021, 03:45:14 pm »
From my experience it does exactly the same as the manual synchronize.

Do keep in mind that the read-only status either through locking or version control will not be respected.

Geert

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8001
  • Karma: +211/-127
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Synchronize stereotype
« Reply #7 on: April 07, 2021, 03:50:47 pm »
From my experience, it does exactly the same as manual synchronisation.

Do keep in mind that the read-only status either through locking or version control will not be respected.

Geert
First (potential) Issue...
I used SynchProfile as a function in a VBScript script checking the return result to see if it failed.
Code: [Select]
dim bReturnStatus
bReturnStatus = Repository.SynchProfile("<myProfile>","ZZZZZ<MyStereotype>")
if not bReturnStatus then
Session.Output("Previous SynchProfile - FAILED!!!")
Exit sub
end if
Does SynchProfile return a result?  It seems to return false regardless of whether the Synchronization worked or not.

Paolo
« Last Edit: April 12, 2021, 04:52:15 pm by Paolo F Cantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!