Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » c.getAppliedStereotypes().name doesn't work in acceleo template
c.getAppliedStereotypes().name doesn't work in acceleo template [message #1796681] Wed, 17 October 2018 14:08 Go to next message
Eclipse UserFriend
Hi,
My goal is to generate a file.txt from a model annotated by MARTE profile.
For example(attached figure) the UML class is annotated with 'SwSchedulableResource' and my goal is to disply the value of its attribut numNodes in the generated file as indicated in the code:.
The file is generated but empty. (I must have a line in the file containing: nombre = 5)
Could one help me to correct my code. Really, I'm pressed and i have a deadline for today.
Thank you in advance.
[comment encoding = UTF-8 /]
[**
 * The documentation of the module generate.
 */]
[module generate('http://www.eclipse.org/papyrus/MARTE/1', 'http://www.eclipse.org/uml2/5.0.0/UML')]
 
 
[**
 * The documentation of the template generateElement.
 * @param aModel
 */]
[template public generateElement(m : Model)]
[comment @main/]
[file (m.name.concat('.txt'), false, 'UTF-8')]
[for (c:Class|m.eContents(Class))]
[if c.getAppliedStereotypes().name->includes('SwSchedulableResource')]
[for (p : Property| c.getAppliedStereotypes().getAllAttributes())]
[if (p.name->includes('numNodes'))]
nombre = [p.getDefault()/]
[/if]
[/for]
[/if]
[/for]
[/file]
[/template]

  • Attachment: exple.png
    (Size: 6.20KB, Downloaded 244 times)
Re: c.getAppliedStereotypes().name doesn't work in acceleo template [message #1796684 is a reply to message #1796681] Wed, 17 October 2018 14:50 Go to previous messageGo to next message
Eclipse UserFriend
Please can one help me.
I have a deadline today.
Thank you in advance.
Re: c.getAppliedStereotypes().name doesn't work in acceleo template [message #1796693 is a reply to message #1796684] Wed, 17 October 2018 17:18 Go to previous message
Eclipse UserFriend
Hi

If you provided an executable repro, it might be possible. Without that I can only recommend you read the many threads on users struggling with UML and SysML initialization. Marte is probably equally hard.

p.name->includes('numNodes') seems like a really hard way to code p.name = 'numNodes' or even ...->select(name = 'numNodes')

Regards

Ed Willink
Previous Topic:[Acceleo]Run Problem
Next Topic:input model
Goto Forum:
  


Current Time: Mon Feb 17 02:13:11 GMT 2025

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

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

Back to the top