Generation of ID's [message #1822573] |
Tue, 10 March 2020 04:31  |
Eclipse User |
|
|
|
Hello,
Good day..!!
I have used XML language in generator to create an application. Inside application i want to generate GUID and link it with other classes as references. How can i do it in generator? Is it possible to make some changes in meta-model so that it creates ID automatically?
Will be looking forward for a response.
Regards,
Adil
|
|
|
|
|
Re: Generation of ID's [message #1822676 is a reply to message #1822631] |
Wed, 11 March 2020 05:37  |
Eclipse User |
|
|
|
Hi
OK. It seems like your use of XML and ID in the same paragraph confused me. You are not interested in xmi:id at all, but an ordinary model attribute that has a GUID value.
It is fairly easy to specify a custom EDataType that auto-allocates unique values using the EcoreUtil.generateUUID().
Once you have implemented it, you can then start to tackle the following bugs that are probably due to a lack of consideration of what you actually want to achieve.
- when you reload the model different UUIDs are allocated
- when you cut and paste in the editor, duplicate UUIDs appear
- when you change an ancestor, the UUID is not changed
- when you change an ancestor and then change it back again the UUID remains changed
I think I might be inclined to maintain a load-time GUID-to-EObject map, a think-of-a-new-GUID cell editor action, and a validation that each actual GUID is consistent with load-time and subsequently created elements.
Regards
Ed Willink
|
|
|
Powered by
FUDForum. Page generated in 0.04016 seconds