Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Fix me!
[Acceleo] Fix me! [message #537474] Wed, 02 June 2010 15:02 Go to next message
Daniel  is currently offline Daniel Friend
Messages: 44
Registered: June 2010
Member
Hi, I wanted to know if you know I way to fix some problems I get when using the mt2mtl feature. I got a message telling me it has no equivalent on functions like: get, put and split this are the cases:

1.
From:
<%script type="uml.Model" name="validator" file="<%validationOutput%>"%>
<%get("validationResult")%>

To:
[file (validationOutput(), false))]
[<<<FIXME "get()" has no equivalent in Acceleo OCL. get('validationResult')>>>/]
[/file]

2.
From:
<%script type="uml.Model" name="validationOutput" post="trim" %>
<%doValidate.put("validationResult")%><%validationFilePath% >

To:
[template public validationOutput(model : uml::Model) post(trim())]
[doValidate().<<<FIXME "put(String, Object)" has no equivalent in Acceleo OCL. put('validationResult', 'validationResult')>>>/][validationFilePath()/]
[/template]

3.
From:
<%script type="Element" name="getOrderedCollectionClass" post="trim" %>
<%getOrderedCollectionClassPath.split("\.").nLast()%>

To:
[template public getOrderedCollectionClass(element : Element) post(trim())]
[getOrderedCollectionClassPath().<<<FIXME "split" has no equivalent in Acceleo OCL. split('\.')>>>->last()/]
[/template]
Re: [Acceleo] Fix me! [message #537495 is a reply to message #537474] Wed, 02 June 2010 15:40 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1902
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------080707090804020200010801
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Daniel,

See comments inlined below.

Laurent Goubet
Obeo

Daniel wrote:
> Hi, I wanted to know if you know I way to fix some problems I get when
> using the mt2mtl feature. I got a message telling me it has no
> equivalent on functions like: get, put and split this are the cases:
>
> 1.
> From:
> <%script type="uml.Model" name="validator" file="<%validationOutput%>"%>
> <%get("validationResult")%>
>
> To:
> [file (validationOutput(), false))]
> [<<<FIXME "get()" has no equivalent in Acceleo OCL.
> get('validationResult')>>>/]
> [/file]
>
> 2.
> From:
> <%script type="uml.Model" name="validationOutput" post="trim" %>
> <%doValidate.put("validationResult")%><%validationFilePath% >
>
> To:
> [template public validationOutput(model : uml::Model) post(trim())]
> [doValidate().<<<FIXME "put(String, Object)" has no equivalent in
> Acceleo OCL. put('validationResult',
> 'validationResult')>>>/][validationFilePath()/]
> [/template]

I'll answer here for both 1. and 2. There is no equivalent of the four
"variable stack" services of Acceleo 2 : push(), pop(), put() and get().
In Acceleo 3 the variables are explicit, and the generation should then
be rethought in order to use explicit variables.

That would mean passing the result of "doValidate()" explicitely to the
template using "get('validationResult')" from the template that does
"put('validationResult', doValidate())".

Granted, this is easier said than done with UML2Java or other "big"
modules ... but that should greatly clarify these modules and ease their
maintenance.

>
> 3.
> From:
> <%script type="Element" name="getOrderedCollectionClass" post="trim" %>
> <%getOrderedCollectionClassPath.split("\.").nLast()%>
>
> To:
> [template public getOrderedCollectionClass(element : Element) post(trim())]
> [getOrderedCollectionClassPath().<<<FIXME "split" has no equivalent in
> Acceleo OCL. split('\.')>>>->last()/]
> [/template]

"Split" hasn't been implemented in Acceleo 3, you could use
"tokenize('.')" instead for this use case.


--------------080707090804020200010801
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------080707090804020200010801--
Re: [Acceleo] Fix me! [message #538197 is a reply to message #537495] Sun, 06 June 2010 10:03 Go to previous message
Daniel  is currently offline Daniel Friend
Messages: 44
Registered: June 2010
Member
Thank you very much again.

Tokenize worked perfectly.

I will think on how to do the changes involving the other fixes and if I have problems I will notify it to you.

Thank you very much againg!
Previous Topic:[Acceleo] Properties
Next Topic:[Announce] M2T XPAND 1.0.0RC4 is available
Goto Forum:
  


Current Time: Fri Apr 26 05:20:15 GMT 2024

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

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

Back to the top