Book a Demo

Author Topic: SOLVED: Changing enumeration value in MDG  (Read 5117 times)

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
SOLVED: Changing enumeration value in MDG
« on: March 11, 2015, 04:41:06 am »
What is the proper way to update my repository when changing an enumeration value in my MDG Technology?

For instance: I have changed an enumeration value from ”To-Be” to ”Tobe”. Lots of existing elements have a tag with the value “To-Be”. Their metatype + stereotype should still remain the same - but reflect the new enumeration on tags associated with this (as well as updating the obsolete values, of course).

What is the proper way to update all of my repository for this (in EA12)?
« Last Edit: March 12, 2015, 09:57:24 pm by svenderiknygaard »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Changing enumeration value in MDG
« Reply #1 on: March 11, 2015, 07:23:04 am »
There is no proper way for this case. Use automation or a SQL to find the TVs and change the value in the notes. Check if the value has already been set to the changed value and change it too.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Changing enumeration value in MDG
« Reply #2 on: March 11, 2015, 11:08:52 pm »
In this case definitely use an SQL update query.

You can do that in a script if you don't have access to an SQL editor
Code: [Select]
Sub Main
      dim updateTaggedValues
      updateTaggedValues= "update t_objectproperties set Value = 'Tobe' where Value = 'To-Be'"
      Repository.Execute updateTaggedValues
End Sub

Main

Geert

Svend Erik Nygaard

  • EA User
  • **
  • Posts: 131
  • Karma: +2/-2
  • Business Information Architect
    • View Profile
Re: Changing enumeration value in MDG
« Reply #3 on: March 12, 2015, 09:43:03 pm »
Thanks qwerty and Geert,
I perform some transformations on the individual element and also calll elem.SynchTaggedValues() which brings the individual element in line with the new metamodel (including changed enumerations). It works fine now.

In fact it seems to me, that I should use a script also when a user wants to change a single element's stereotype (when it’s a stereotype from UML profile / MDG). EA doesn’t handle this very well and removes tagged values when the new stereotype does not have corresponding tags – and the user is typically not even aware of thus deleting tagged values. EA is really unpopular on this point.

SQL: I use my sql editor on a daily basis (SQuirreL is particuallerly nice when using different kinds of databases) – but I’ve always been too wooried about bypassing EA objectmodel in updates – so I have never used sql to update EA. I’ve never used Repository.Execute() – I’ll have a look at that.
« Last Edit: March 12, 2015, 09:44:49 pm by svenderiknygaard »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Changing enumeration value in MDG
« Reply #4 on: March 12, 2015, 09:55:59 pm »
The API layer covering the data model is not very thick in most cases. Exceptions of that rule exist as you see with the MDG/TV story. But in most cases you'll do yourself a favor getting acquainted with the data model and dealing with that directly. Of course: backup regularly!

q.