Book a Demo

Author Topic: Stereotype bulk change  (Read 13016 times)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Stereotype bulk change
« on: March 30, 2018, 03:36:13 am »
We are using a custom UML in Sparx with quite a few a stereotypes extending Sparx base elements. The development of this profile is iterative with more detailed added to the profile as we progress on our architecture journey. As part of the last iteration, we decided to rename one of the stereotypes to something a bit more orthodox. Is there are a way to bulk update the “old/previous” stereotypes to the new stereotype?

I have tried a number of things none of which give me the right result. My first attempt was to do an export, change the stereotypes outside Sparx, and reimport. Needless to say it did not work.

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Stereotype bulk change
« Reply #1 on: March 30, 2018, 06:26:57 am »
You can either run a script to iterate through elements or run a direct database update (use a sandbox for testing!). However, once you switched the stereotypes you should run a Sync Stereotype from the toolbox to make the new TV appear. It will not remove existing TVs from the previous profile (though there had been a couple of changes with TVs from profiles over the time and I might be wrong). In any case you can proof run in a sandbox to see what happens.

q.

Nizam

  • Prolab Moderator
  • EA User
  • *
  • Posts: 320
  • Karma: +15/-2
  • Model Sharing - Simplified
    • View Profile
    • Professional Model Collaboration
Re: Stereotype bulk change
« Reply #2 on: March 31, 2018, 09:02:47 am »
Further to above post, just make sure you set StereotypeEx too (FQ Name)

Code: [Select]
Dim eaElem as EA.Element
set eaElem = Repository.GetElementByID (eaObj.ElementID)
eaElem.Type = "Event"
eaElem.Stereotype = "BPMN2.0::IntermediateEvent"
eaElem.StereotypeEx = "BPMN2.0::IntermediateEvent"
eaElem.Update


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Stereotype bulk change
« Reply #3 on: March 31, 2018, 05:00:22 pm »
Further to above post, just make sure you set StereotypeEx too (FQ Name)

Code: [Select]
Dim eaElem as EA.Element
set eaElem = Repository.GetElementByID (eaObj.ElementID)
eaElem.Type = "Event"
eaElem.Stereotype = "BPMN2.0::IntermediateEvent"
eaElem.StereotypeEx = "BPMN2.0::IntermediateEvent"
eaElem.Update


You should only set StereotypeEx, not Stereotype.

Geert

Sunshine

  • EA Practitioner
  • ***
  • Posts: 1353
  • Karma: +121/-10
  • Its the results that count
    • View Profile
Re: Stereotype bulk change
« Reply #4 on: April 01, 2018, 05:35:45 am »
Here is a full script listed in JScript I've posted before.
http://www.sparxsystems.com/forums/smf/index.php/topic,30653.msg223132.html#msg223132

Just change the conversions[] array part of the code. Can add many conversions by adding more elements
Code: [Select]
var Conversions = new Array();
// sourceObject,sourceStereotype,targetObject, targetStereotypea
//Add Array of conversions here
Conversions[0] = new TypeConversion("Class", "ArchiMate_Requirement", "Class", "Requirement");
Conversions[1]= new TypeConversion("Class", "ArchiMate_Principle", "Class", "Requirement");
...
Hope that helps
Happy to help
:)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Stereotype bulk change
« Reply #5 on: April 03, 2018, 02:49:48 am »
Thanks to all, I will give a go tomorrow. I will reply back on this post if I encounter any hitches.

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: Stereotype bulk change
« Reply #6 on: April 03, 2018, 04:39:52 pm »
Hi,

You can also change Stereotypes and more by the Open Source 'hoTools' (Bulk change EA Elements). For more information see: https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/BulkEaItemChange

Best regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Stereotype bulk change
« Reply #7 on: May 02, 2018, 03:29:37 am »
Hi,

You can also change Stereotypes and more by the Open Source 'hoTools' (Bulk change EA Elements). For more information see: https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/BulkEaItemChange

Best regards,

Helmut
Thanks Helmut, please remind me where the install is, I seem to have misplaced my notes and cannot remember.

Modesto Vega

  • EA Practitioner
  • ***
  • Posts: 1183
  • Karma: +30/-8
    • View Profile
Re: Stereotype bulk change
« Reply #8 on: May 05, 2018, 02:35:39 am »
Hi,

You can also change Stereotypes and more by the Open Source 'hoTools' (Bulk change EA Elements). For more information see: https://github.com/Helmut-Ortmann/EnterpriseArchitect_hoTools/wiki/BulkEaItemChange

Best regards,

Helmut
Thanks Helmut, please remind me where the install is, I seem to have misplaced my notes and cannot remember.

I found it, very useful tool.

Is it possible to bulk change the language using it?

Nizam

  • Prolab Moderator
  • EA User
  • *
  • Posts: 320
  • Karma: +15/-2
  • Model Sharing - Simplified
    • View Profile
    • Professional Model Collaboration
Re: Stereotype bulk change
« Reply #9 on: May 05, 2018, 10:01:25 am »
You can also set the language (bulk change) using 'Update Package Status'