2

Inspired by the "Making sense of a legacy db" am I trying to use the "autoforms feature" to make sense of a db having more than 8000 tables. Now have I reduced the number to 800 classes. All classes have gotten the table name, a typical four letter abbreviation. But I have managed to get a list of "good" names from business. I need this to get the names correct in order to move on and use autoforms.... The question is how can rename the classes via an ocl expression (for the Class.Name)? Tried in model debugger but I do not get access to "TableWithNewClassNames" (holding the mapping of the old and new class names) ?

1 Answers1

2

The current name of the class is stored in the Name attribute.

If you have reversed the table, you can freely change the class name without disturbing the table name used to access the table in the database.

The extra information for mapping the class to the underlying table are stored in tagged values linked to the class model object.

In the image below, you see the tagged values providing this info Class tagged values

Note the tab "TaggedValuesAndAttributes". Click it and click "load" to see the editor.

So, you can rename classes freely using the Name value of the class.

Model debugger class listing

Then, if you want to write EAL to do the changes, read this wiki article for help: https://wiki.mdriven.net/index.php/How_to_rename_a_class_in_your_model_%E2%80%93_using_the_model_debugger

Hope this helps!

Lars
  • 191
  • 4
  • Yes, but how do I access "dynamic" data from the debugger, the example only shows how to do it with "static" values. Should I paste the tablenames as a collection in the debugger or what? – Rolf Carlson Feb 07 '18 at 15:13
  • With dynamic data, are you referering to new data? Like an Excel table that you want to use for renaming? – Lars Feb 09 '18 at 09:09
  • Yes, exactly. I imported from excel to a class, but I cant access the class? I am thinking of building a ”bag”, but do not know how to do ”value pairs” in a sensible way – Rolf Carlson Feb 10 '18 at 13:19
  • You can't create new classes in the model of the designer. And there's no link between the meta-model and the model you're modelling :-) – Lars Feb 11 '18 at 21:40
  • But, you can create a collection of collections from a commaseparated string like this; `'A, B; X, Y'.Split(';'.toCharArray)->collect(pair | pair.Split(','.toCharArray)->at(1), pair.Split(','.toCharArray)->at(2))` – Lars Feb 11 '18 at 21:41
  • Thanx! I could find any example of a " collection of collections". Perfect. This will solve my problem. – Rolf Carlson Feb 12 '18 at 19:12