[Edapt] Strange behavior in Classifiers ID [message #1771052] |
Mon, 21 August 2017 14:01 |
Alain BERNARD Messages: 1 Registered: August 2017 |
Junior Member |
|
|
Hello,
I've starting to learn Edapt for some migration we have to do on a widely spread model.
So I created a v1 release for the existing version of my model, and then created a simple "Custom Migration" to test the behavior in a V2 version, as explained in the tutorial. Then, I connected the migration process in our editor to have it automatically launched when user starts editing the file.
All the process is starting fine, but then, I ran into two problems:
- I have custom datatypes for which I customized in the factory the convertXFromString and convertXToString methods. Then, when Edapt reload the v1 model, I have an IllegalValueException because these methods are not called anymore, despite still being present in the factory, and not impacted by any change in the model.
I managed to solve it with the extension point o.e.e.edapt.factories, but then I ran into the second problem:
- Having overriden the factory, the values are correctly converted but then I have an exception "The class 'MyClass' is not a valid classifier", because the "create(EClass eClass)" method of the factory is called on MyClass, which seems to have the classifier ID number 25, which is not at all a classifier of my EMF Package (it only corresponds to an attribute), in the v1 or in the V2 version of the package.
Is it a known issue when using custom factories in Edapt? Do I have to do something differently for the first issue I have?
Many thanks,
Alain
|
|
|
Re: [Edapt] Strange behavior in Classifiers ID [message #1774361 is a reply to message #1771052] |
Fri, 13 October 2017 09:47 |
|
Hi Alain,
Sorry that we've missed this message until now.
I think the reason for your problem is, that Edapt recreates the old metamodel versions using dynamic EMF. This is happening in memory only. There is no guarantee about the classifier ids being the same as for the generated code.
So you will have to write the custom factory so that it will switch using e.g. the classifier's name instead of the ID.
I hope this helps you to solve the problem!
Best regards
Johannes
Johannes Faltermeier
Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
|
|
|
Powered by
FUDForum. Page generated in 0.01798 seconds