[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [ATL] Copying UML2 Elements with profile application and stereotypes

Hi Urs!

Now it works.
However, there's a comment to do. Initially, my input uml file applied the profile into the uml package element. So, the rule which applies the profile was not working because the imperative code below was in the model rule (of course :-) ).
s.debug('ModelRule');
for (p in s.getAllAppliedProfiles()){
t.applyProfile(thisModule.findProfile(p.getQualifiedName()));
}


When I replicated it in the package rule, it worked fine:

rule Package {
   from s : UML2!"uml::Package" (
		if thisModule.inElements->includes(s) then
			s.oclIsTypeOf(UML2!"uml::Package")
		else false endif)
   to t : UML2!"uml::Package" mapsTo s (
       name <- s.name,
       visibility <- s.visibility,
       ...
       packagedElement <- s.packagedElement,
       profileApplication <- s.profileApplication)
  do {
	s.debug('PackageRule');
        for (p in s.getAllAppliedProfiles()){
        	t.applyProfile(thisModule.findProfile(p.getQualifiedName()));
        }
      }   		
}

Regards,
Bruno.

ps.: I changed the subject just to make it updated with the current discussion.