I have a number of "ad-hoc" stereotypes in a Sparx EA model. That is, I just typed a stereotype name in the element properties, then used the same name in other elements to which it applies ... without using a profiles.
Each of these then appears in Project --> Settings --> UML Types --> Stereotypes
.
Eventually, I added Shape Script icons, etc.
However, I created some confusion with one Stereotype name. I used "Tablespace" as a design concept to indicate "group of related database tables". Our database team finds this confusing due to the physical concept of a "tablespace" in Oracle.
So, I want to rename.
If I do this from UML Types --> Stereotypes
, all of the existing elements retain the original name (eg. Tablespace) and revert to their Shape Script-less appearance. If I visit an element and change to the new name, the Shape Script, etc. appears.
I'm not keen on finding each element with stereotype and manually applying the new name.
Is it time for me to learn EA Scripting or is there another way?
Your only escape is using the automation (or native DB access). If your stereotype is just used in objects you may iterate over the result of
Repository.SQLQuery("SELECT object_id FROM t_object WHERE stereotype='oldStereo'")
to get all object ids. Then you need to
elem = Repository.GetElementByID(theId)
to retrieve the single elements. Finally you can change the stereotype with
elem.stereotype = "newStereo"
elem.update()
You can also run a direct SQL with
Repository.Execute("UPDATE t_object SET stereotype='new' WHERE stereotype='old'")
Note that the latter uses one of the landmine functions not being supported officially.
Edit: You might also run the last SQL in a native RDBMS client. When using EAP you might need to rename it temporarily to .mdb
to pretend it's an MS Access database (which it actually is).