[Edapt] Can't get values in Custom Migration [message #1780999] |
Wed, 31 January 2018 02:41  |
Eclipse User |
|
|
|
Hi there!
I'm stuck at a custom migration and hope to find help here. These are the steps I took so far:
- Attach a Custom Migration to 2 Delete-Operations
- implement the migrateBefore and migrateAfter-Methods as shown in the library example (https://www.eclipse.org/edapt/libraryexample.php#custom)
- call the unset() on our model instance
- try to set the obtained value in a new model instance
My migrateBefore():
public void migrateBefore(Model model, Metamodel metamodel) throws MigrationException {
value = metamodel.getEAttribute("forms.Vertex.value");
orderNumber = metamodel.getEAttribute("forms.Vertex.orderNumber");
}
My migrateAfter():
public void migrateAfter(Model model, Metamodel metamodel) throws MigrationException {
for (Instance vertex : model.getAllInstances("forms.Vertex")) {
String oldValue = vertex.unset(value);
Integer oldOrderNumber = vertex.unset(orderNumber);
Instance dimensionPoint = model.newInstance("forms.DimensionPoint");
dimensionPoint.set("value", oldValue);
dimensionPoint.set("orderNumber", oldOrderNumber);
vertex.set("dimensionPoint", dimensionPoint);
}
}
What I'm trying to do is move the "value"- and "orderNumber"-Attributes from the "Vertex" to a new instance named "DimensionPoint" which is a reference of the Vertex. The code runs fine but the "oldValue" and "oldOrderNumber" are null so that the migration doesn't work in the end.
I have attached the model which is saved temporarily during migration.
Another question would be how to migrate the graphiti elements that are contained in our model. As far as I understand I would have to specify the necessary migrations in the migrateAfter, too. Any suggestions on this?
Thank you so much in advance!
Cheers,
Felix
[Updated on: Wed, 31 January 2018 02:45] by Moderator
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04463 seconds