Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Why Activity node get executed in a template that accepts only Class Type ?
[Acceleo] Why Activity node get executed in a template that accepts only Class Type ? [message #986045] Sat, 17 November 2012 15:41 Go to next message
HJA JAB is currently offline HJA JAB
Messages: 2
Registered: November 2012
Junior Member
Hello,
I have an uml diagram made with Topcased 5.2. The uml contains Class diagram and Activity Diagram.
I wrote a template to generate java classes that accepts a parameter of a Class type.

The java classes were generated but in addition my method get executed for Activity node. How can prevent execution of Activity node?

Following my template:

[template public generateEntity(c : Class)]
[comment @main /]
[file (c.getEntityFullPathFile().trim(), false)]
[c.generateEntity()/]
[/file]
[/template]

Thanks for your help

[Updated on: Sun, 18 November 2012 02:03]

Report message to a moderator

Re: [Acceleo] Why Activity node get executed in a template that accepts only Class Type ? [message #986149 is a reply to message #986045] Mon, 19 November 2012 03:31 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1621
Registered: July 2009
Senior Member
Hi,

This has been answered on http://stackoverflow.com/questions/13438388/activity-node-get-executed-in-a-template-that-accepts-only-class-type .

Basically, an Activity -is- a Class, the template must be guarded to avoid generating on -some- Classes :

[template public generateEntity(c : Class) ? (not c.oclIsKindOf(Activity))]


Laurent Goubet
Obeo
Re: [Acceleo] Why Activity node get executed in a template that accepts only Class Type ? [message #986167 is a reply to message #986149] Mon, 19 November 2012 04:36 Go to previous messageGo to next message
HJA JAB is currently offline HJA JAB
Messages: 2
Registered: November 2012
Junior Member
Thank you very much for your help !
Re: [Acceleo] Why Activity node get executed in a template that accepts only Class Type ? [message #1022946 is a reply to message #986149] Fri, 22 March 2013 17:39 Go to previous message
Tomasz  Babczyński is currently offline Tomasz Babczyński
Messages: 2
Registered: March 2011
Junior Member
Laurent Goubet wrote on Mon, 19 November 2012 09:31

[template public generateEntity(c : Class) ? (not c.oclIsKindOf(Activity))]



Isn't it better to write:
[template public generateEntity(c : Class) ? (c.oclIsTypeOf(Class))]

to get only "true" classes? It filters out also OpaqueBehaviors, Interactions etc.

Tomasz Babczyński
Previous Topic:[Acceleo] Simple, step by step, working tutorial, from UML to code?
Next Topic:[Acceleo] Cannot find the Acceleo perspective after installation
Goto Forum:
  


Current Time: Thu Jul 24 21:45:31 EDT 2014

Powered by FUDForum. Page generated in 0.02090 seconds