Setting a tagged value with refining mode? [message #896233] |
Tue, 17 July 2012 12:27  |
Eclipse User |
|
|
|
I'm currently building a transformation chain. The last step should be to set some tagged values in my model. This should be done for a specific stereotype.
I tried to use the refining mode, but I have to realize, that the refining mode doesn't support do blocks.
My aim is to set a tagged value which represents a position with an increasing number (so I think I need a counter variable or something).
Could such a problem be formulated in a declarative way in ATL.
Here is the code I have tried, but it contains a do block. (code not working)
module postprocessing;
create OUT: UML refining IN: UML, PRO: UML, BDT: UML;
helper def: getStereotype ...
rule EnumerateProperties {
from
cl:UML!Class
using {
counter:Integer = 0;
t:UML!Property = OclUndefined;
}
to
c2:UML!Class()
do {
for (a in cl.getAllAttributes()){
t <- a;
thisModule.debug(t.getAppliedStereotypes());
if(t.isStereotypeApplied(thisModule.getStereotype('xsdElement')))){
thisModule.debug('adding position ' + counter + ' to attribute ' + a.name + ' in class ' + cl.name);
a.setValue(thisModule.getStereotype('xsdElement'), 'position', counter);
counter <- counter + 1;
}
}
}
}
Would be great if there are some advices. Thank you very much.
Martin
|
|
|
|
Powered by
FUDForum. Page generated in 0.07367 seconds