Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » Edapt migrate the class with slots in inverse order(Edapt migrate the class with slots in inverse order)
Edapt migrate the class with slots in inverse order [message #1816110] Mon, 21 October 2019 11:48 Go to next message
Arun Kumar is currently offline Arun KumarFriend
Messages: 14
Registered: January 2016
Junior Member
I have been using Edapt and Ecore emf for a while but still, few things I dont understand , how it works.

I have made few changes on my ecore model and edapt is performing the migration from 1.5 version to 1.6 version,

I have class called SignalInterfaceand it contains 7 attributes , and my ecore changes is not related to this class at all.
After performing edapt migration, I can see the attributes are in reverse order.

Before migration
<contents xsi:type="com.tool:SignalInterface" name="TPR" length="2" needGlobalVariable="true" includeFile="TxCdlPid.h" statusVariable="PositionStatus" valueVariable="PositionValue"/>


After migration
<contents xsi:type="com.tool:SignalInterface" name="TPR" length="2" valueVariable="PositionValue" statusVariable="PositionStatus" includeFile="TxCdlPid.h" needGlobalVariable="true"/>


I am not sure why the order is being inversed. One more strange issue is that, this reverse order causes to have null field on all the attributes of this class in my ecore resource.,.

I got struck with these.. Please someone help me out ..
Re: Edapt migrate the class with slots in inverse order [message #1816168 is a reply to message #1816110] Wed, 23 October 2019 07:24 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 97
Registered: December 2013
Member

Hi,

Is the 1.6 version of your model the most current one? If so Edapt translates the dynamic model into the concrete model using the generated code as a last step. So there should be no difference when it comes to persistence.
Are you using some Resource-Save-Options or do you have a special Resource Implementation in your application? If you use Migrator.migrateAndSave you may pass in the save options as an additional parameter starting from version 1.1. If you have a special resource implementation, you may use Migrator.setResourceSetFactory(IResourceSetFactory) in order to make the Migrator use this one as well.

Cheers,
Johannes


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: Edapt migrate the class with slots in inverse order [message #1816200 is a reply to message #1816168] Wed, 23 October 2019 13:53 Go to previous messageGo to next message
Arun Kumar is currently offline Arun KumarFriend
Messages: 14
Registered: January 2016
Junior Member
Johannes,

Thanks for the prompt response, I am using some thing like below to migrate
String nsURI = ReleaseUtils.getNamespaceURI(resourceURI);
final Migrator migrator = MigratorRegistry.getInstance().getMigrator(nsURI);
if (migrator != null) {
final Release release = migrator.getRelease(resourceURI).iterator()
					.next();
if (!release.isLatestRelease()) 
	migrator.migrateAndSave(Collections.singletonList(resourceURI), release,null, monitor);


Please let me know what additional parameter your are suggesting to pass on save option.. I have been using edapt migrate from 1.1 -> 1.2 , 1.2 ->1.3 .. I never experienced reverse stuff. I am puzzled on why is it happening now.

I dont have any extra save option on my regular save.. and no special resourcefactory set too

Please guide me

[Updated on: Wed, 23 October 2019 14:56]

Report message to a moderator

Re: Edapt migrate the class with slots in inverse order [message #1816238 is a reply to message #1816200] Thu, 24 October 2019 14:34 Go to previous messageGo to next message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 97
Registered: December 2013
Member

Hi,
you could try using migrateAndLoad, then checking for the null fields in the loaded EObject already, and then performing a regular save and check the results. This might help to narrow the issue down.
Also maybe regenerating the code one more time to make sure there are no problems on this front.


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: Edapt migrate the class with slots in inverse order [message #1817586 is a reply to message #1816238] Tue, 26 November 2019 10:08 Go to previous messageGo to next message
Arun Kumar is currently offline Arun KumarFriend
Messages: 14
Registered: January 2016
Junior Member
Thanks Johannes. Somehow, I narrow down the issue . The issue is that , on below set method on needGlobalVariable attribute , I have to code to set other variables
 if (newNeedGlobalVariable) {
			this.setValueVariable(savedValVar);
			this.setStatusVariable(savedStatVar);
			this.setIncludeFile(savedHeaderFile);
		} else {
			savedHeaderFile = this.getIncludeFile();
			savedStatVar = this.getStatusVariable();
			savedValVar = this.getValueVariable();
			this.setValueVariable(VALUE_VARIABLE_EDEFAULT);
			this.setStatusVariable(STATUS_VARIABLE_EDEFAULT);
			this.setIncludeFile(INCLUDE_FILE_EDEFAULT);
		}
. If I remove this method, then the migration works fine without reversing the variable. But, still, it doesn't make sense to me. Please guide me on how edapt works on "generated NOT" methods .. Thanks in Advance !!
Re: Edapt migrate the class with slots in inverse order [message #1817665 is a reply to message #1817586] Wed, 27 November 2019 16:07 Go to previous message
Johannes Faltermeier is currently offline Johannes FaltermeierFriend
Messages: 97
Registered: December 2013
Member

Hi,

Changing generated setters can cause problems with a lot of EMF related frameworks and utilities. Please see this Blog-Post about EMF Dos and Don'ts: https://eclipsesource.com/blogs/2013/03/05/emf-dos-and-donts-2/

Edapt does not give any guarantees in which order the references/attributes are set on the model.

Cheers


Johannes Faltermeier

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:No property tester contributes a property org.eclipse.emf.ecp.core.project.open
Next Topic:[EEF]
Goto Forum:
  


Current Time: Tue Aug 04 14:58:50 GMT 2020

Powered by FUDForum. Page generated in 0.01976 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top