Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Get information about Metamodel in a model
[Acceleo] Get information about Metamodel in a model [message #505780] Mon, 04 January 2010 22:33 Go to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Hi

I want to transform a model in a XML file using Acceleo. The output would be something like this:
<CD>
<TITLE>Empire Burlesque</TITLE>
<ARTIST>Bob Dylan</ARTIST>
</CD>


My metametamodel is Ecore. My metamodel has an EClass called 'CD', which contains the EAttributes 'title' and 'artist'.
The most obvious transformation would be like this:
<CD>
<TITLE>[cd.title/]</TITLE>
<ARTIST>[cd.artist/]</ARTIST>
</CD>


My question is: Is there a different way to do this, so that the tags corresponding to the EAttibutes of the metamodel, are generated using any command on the script? I think that, to do this, i need to, on the model, get the information about the structure of the EClasse on the metamodel.

I've tried the code below, but it doesnt work:
<CD>
[for ( a : EAttribute | cd.oclAsType("EClass").eAllAttributes )]
<[a.name.toUpper()/]>[cd.a.name]</[a.name.toUpper()/]>
[/for]
</CD>


Can anybody help me?

Thanks,


Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #505806 is a reply to message #505780] Tue, 05 January 2010 07:56 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: loic.fejoz.realtimeatwork.com

Hi,

Well, it is possible at least theoretically.
The loop should be like :
[for ( eattr : EStructuralFeature | cd.eClass().eAllStructuralFeatures )]
[cd.eGet(eattr)/]

and/or
[for ( a : EReference | cd.eClass().eAllReferences )]

depending on your model.

BUT there is (was?) a bug that make it not working!

See bug 286784 for references (especially bug 287052).

--
regards,
Loïc Fejoz

Le 04/01/2010 23:33, Andre a écrit :
> Hi
>
> I want to transform a model in a XML file using Acceleo. The output
> would be something like this:
> <CD>
> <TITLE>Empire Burlesque</TITLE>
> <ARTIST>Bob Dylan</ARTIST>
> </CD>
>
> My metametamodel is Ecore. My metamodel has an EClass called 'CD', which
> contains the EAttributes 'title' and 'artist'. The most obvious
> transformation would be like this:
> <CD>
> <TITLE>[cd.title/]</TITLE>
> <ARTIST>[cd.artist/]</ARTIST>
> </CD>
>
> My question is: Is there a different way to do this, so that the tags
> corresponding to the EAttibutes of the metamodel, are generated using
> any command on the script? I think that, to do this, i need to, on the
> model, get the information about the structure of the EClasse on the
> metamodel.
>
> I've tried the code below, but it doesnt work:
> <CD>
> [for ( a : EAttribute | cd.oclAsType("EClass").eAllAttributes )]
> <[a.name.toUpper()/]>[cd.a.name]</[a.name.toUpper()/]>
> [/for]
> </CD>
>
> Can anybody help me?
>
> Thanks,
>
Re: [Acceleo] Get information about Metamodel in a model [message #505812 is a reply to message #505806] Tue, 05 January 2010 03:56 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060802030904000906020306
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hi Loïc, Andre,

The bug you pointed to will indeed be a problem to Andre if he uses
multi-valued attributes, but not in any other cases.

Andre, all of he loops that have been written here as examples are
missing the same thing : "eAllAttributes", "eAllReferences" and
"eAllStructuralFeatures" are operations, not plain attributes. Accessing
their values require the parenthesis "()".

The loop
<CD>
[for ( a : EAttribute | cd.oclAsType("EClass").eAllAttributes() )]
<[a.name.toUpper()/]>[cd.eGet(a)/]</[a.name.toUpper()/]>
[/for]
</CD>

Should work as expected (keep in mind the bug pointed at by Loïc).

Laurent Goubet
Obeo

Loïc Fejoz wrote:
> Hi,
>
> Well, it is possible at least theoretically.
> The loop should be like :
> [for ( eattr : EStructuralFeature | cd.eClass().eAllStructuralFeatures )]
> [cd.eGet(eattr)/]
>
> and/or
> [for ( a : EReference | cd.eClass().eAllReferences )]
>
> depending on your model.
>
> BUT there is (was?) a bug that make it not working!
>
> See bug 286784 for references (especially bug 287052).
>


--------------060802030904000906020306
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=
--------------060802030904000906020306--
Re: [Acceleo] Get information about Metamodel in a model [message #505900 is a reply to message #505812] Tue, 05 January 2010 14:31 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Hi,

Loïc: the operation eClass() doesn't work. The error is: Cannot find operation (eClass()) for the type (Configuration)

Laurent: when i put the parentesis after 'eAllOperations', this error occurs: Usage of non-standard quoted element name: "EClass".
Without the parentesis, there is no errors, although the output is not the desired, as i reported previously.

My acceleo version is: Acceleo (Incubation) 0.8.0.v200906161003

any suggestion?

thanks,


Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #505931 is a reply to message #505900] Tue, 05 January 2010 15:04 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040604050206040509090008
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Andre,

Fist suggestion is to start using the latest 0.9 version of Acceleo,
this will fix some bugs and enable newly added features :).

Other than that, I copy/pasted your for loop which is why it still
contains errors I didn't notice without your error message. So : strings
in OCL are identified with single quotes, the double quote being used
for special cases. "EClass" should then be 'EClass'. Moreover,
"oclAsType" doesn't take a String as parameters but a Type.
"oclAsType('EClass')" should then be "oclAsType(EClass)".

Your for loop then becomes :
<CD>
[for ( a : EAttribute | cd.oclAsType(EClass).eAllAttributes() )]
<[a.name.toUpper()/]>[cd.eGet(a)/]</[a.name.toUpper()/]>
[/for]
</CD>

Laurent Goubet
Obeo


Andre wrote:
> Hi,
>
> Loïc: the operation eClass() doesn't work. The error is: Cannot find
> operation (eClass()) for the type (Configuration)
>
> Laurent: when i put the parentesis after 'eAllOperations', this error
> occurs: Usage of non-standard quoted element name: "EClass". Without the
> parentesis, there is no errors, although the output is not the desired,
> as i reported previously.
>
> My acceleo version is: Acceleo (Incubation) 0.8.0.v200906161003
>
> any suggestion?
>
> thanks,
>


--------------040604050206040509090008
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=
--------------040604050206040509090008--
Re: [Acceleo] Get information about Metamodel in a model [message #505932 is a reply to message #505900] Tue, 05 January 2010 15:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: loic.fejoz.realtimeatwork.com

Re,

How comes eClass be unknown? Did you said that that your model is an
Ecore one? What is your template header?

Well, Laurent knows Acceleo better than me, so follow his advice! ;-)

--
regards,
Loïc Fejoz

Le 05/01/2010 15:31, Andre a écrit :
> Hi,
>
> Loïc: the operation eClass() doesn't work. The error is: Cannot find
> operation (eClass()) for the type (Configuration)
>
> Laurent: when i put the parentesis after 'eAllOperations', this error
> occurs: Usage of non-standard quoted element name: "EClass". Without the
> parentesis, there is no errors, although the output is not the desired,
> as i reported previously.
>
> My acceleo version is: Acceleo (Incubation) 0.8.0.v200906161003
>
> any suggestion?
>
> thanks,
>
Re: [Acceleo] Get information about Metamodel in a model [message #505966 is a reply to message #505932] Tue, 05 January 2010 11:38 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020706000706070803010306
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Loïc, Andre,

eClass() cannot be found onf any and all objects from OCL : the eClass
of the current object (self) must explicitely extend ecore (namely : in
the metamodel, the "Configuration" class should have its supertype set
to "EObject") for OCL to find the operation directly.

However, Loïc's code would be functional if you cast your object in
EObject beforehand : "oclAsType(EObject).eClass()".

Laurent Goubet
Obeo

Loïc Fejoz wrote:
> Re,
>
> How comes eClass be unknown? Did you said that that your model is an
> Ecore one? What is your template header?
>
> Well, Laurent knows Acceleo better than me, so follow his advice! ;-)
>


--------------020706000706070803010306
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=
--------------020706000706070803010306--
Re: [Acceleo] Get information about Metamodel in a model [message #506298 is a reply to message #505966] Wed, 06 January 2010 20:52 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Hi Laurent

I've updated the Acceleo version installed on my computer. Now the version is:
Acceleo (Incubation) 0.9.0.v200912150944

However, the problema about the using of parenthesis after 'eAllAttributes' still persists.. when i remove the parenthesis, theres no erros, but when i use it, the problem occurs.

Another point is that when i use double quotes, theres no problem too.. but when i put single quote, occurs the following error:
Cannot find operation (oclAsType(String)) for the type (Configuration) toXML.mtl

Another detail that i dont know if it is correct is about the import of the metamodels on the Acceleo module. I'm using this:
[module toXML('http://www.eclipse.org/2009/communication',
'http://www.eclipse.org/emf/2002/Ecore')/]


'http://www.eclipse.org/2009/communication' is my metamodel, and 'http://www.eclipse.org/emf/2002/Ecore' is the metametamodel.

Any suggestion?

thanks,



Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #506352 is a reply to message #506298] Thu, 07 January 2010 08:56 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000308010800030508040204
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Andre,

It seems you've missed my previous answer :

strings in OCL are identified with single quotes, the double quote being
used for special cases. "EClass" should then be 'EClass'. Moreover,
"oclAsType" doesn't take a String as parameters but a Type.
"oclAsType('EClass')" should then be "oclAsType(EClass)".

Your for loop then becomes :
<CD>
[for ( a : EAttribute | cd.oclAsType(EClass).eAllAttributes() )]
<[a.name.toUpper()/]>[cd.eGet(a)/]</[a.name.toUpper()/]>
[/for]
</CD>

Your metamodel import is correct.

Laurent Goubet
Obeo

Andre wrote:
> Hi Laurent
>
> I've updated the Acceleo version installed on my computer. Now the
> version is:
> Acceleo (Incubation) 0.9.0.v200912150944
>
> However, the problema about the using of parenthesis after
> 'eAllAttributes' still persists.. when i remove the parenthesis, theres
> no erros, but when i use it, the problem occurs.
>
> Another point is that when i use double quotes, theres no problem too..
> but when i put single quote, occurs the following error:
> Cannot find operation (oclAsType(String)) for the type
> (Configuration) toXML.mtl
>
> Another detail that i dont know if it is correct is about the import of
> the metamodels on the Acceleo module. I'm using this:
> [module toXML('http://www.eclipse.org/2009/communication',
> 'http://www.eclipse.org/emf/2002/Ecore')/]
>
> 'http://www.eclipse.org/2009/communication' is my metamodel, and
> 'http://www.eclipse.org/emf/2002/Ecore' is the metametamodel.
>
> Any suggestion?
>
> thanks,
>


--------------000308010800030508040204
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=
--------------000308010800030508040204--
Re: [Acceleo] Get information about Metamodel in a model [message #506394 is a reply to message #506352] Thu, 07 January 2010 11:49 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Laurent

Thanks for answering

The usage of double quote or no quotes does not seem to be a problem. The problem is about the parenthesis after eAllAttributes.

I've copied and pasted the code you've written but it doesnt work due the usage of this parenthesis. When i remove it, it works, although the output is not the expected.

When i've copied your code, exactly as you typed, the problem below occurs on the 'for' loop:
Unrecognized variable: (EClass) toXML.mtl

When i remove the parenthesis after 'eAllAttributes', this error dissappear.

Another detail is that when the editor fills the code with 'eAllAttributes', it doesn't put the parenthesis by default.

Isn't strange?

thanks,


Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #506406 is a reply to message #506394] Thu, 07 January 2010 12:42 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050200000102030605080209
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Andre,

That an error on my side, eAllAttributes is indeed a reference and not
an EOperation :p. You don't access it with parenthesis.

Do you still have problems when using the code I wrote here while
removing these erroneous parenthesis? If yes, please elaborate (at least
an error message if there is one).

Laurent Goubet
Obeo

Andre wrote:
> Laurent
>
> Thanks for answering
>
> The usage of double quote or no quotes does not seem to be a problem.
> The problem is about the parenthesis after eAllAttributes.
>
> I've copied and pasted the code you've written but it doesnt work due
> the usage of this parenthesis. When i remove it, it works, although the
> output is not the expected.
>
> When i've copied your code, exactly as you typed, the problem below
> occurs on the 'for' loop:
> Unrecognized variable: (EClass) toXML.mtl
>
> When i remove the parenthesis after 'eAllAttributes', this error
> dissappear.
>
> Another detail is that when the editor fills the code with
> 'eAllAttributes', it doesn't put the parenthesis by default.
>
> Isn't strange?
> thanks,
>


--------------050200000102030605080209
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=
--------------050200000102030605080209--
Re: [Acceleo] Get information about Metamodel in a model [message #506411 is a reply to message #506406] Thu, 07 January 2010 13:13 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Laurent

there is no error when removing the parenthesis after eAllAttributes, but none of the attributes are listed on the generated xml file. It acts like there is no attributes on the EClass, although it has.

Another point is that after i've updated the Acceleo version, an error appeared on some java files corresponding to the mtl acceleo script. The error is on this command:
AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false, monitor);
The error is:
The method doGenerate(Module, String, EObject, List<? extends Object>, File, Monitor) in the type AcceleoService is not applicable for the arguments (Module, String, EObject, List<capture#5-of ? extends Object>, File, boolean, Monitor)


What do i do? is it possible to regenerate the java file of an mtl? why this error occurs not in all mlt files?

thanks,




Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #506418 is a reply to message #506411] Thu, 07 January 2010 13:29 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Laurent

I've noticed now that when i run the transformation, the error log shows the message below, exactly on the loop we've talked about:
Empty loop iteration at position 403 in Module toXML for block for (c.oclAsType(ecore::EClass).eAllAttributes). Last recorded value of self was Communication.impl.ConfigurationImpl@126c554 (name: local) (adaptationAction: NONE).

Notice that at the end of the message is possible to see the two attibutes of the eClass: (name: local) (adaptationAction: NONE).

I've used the CD example to simplify the question, but in fact im not using this kind of application

thanks,


Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #506436 is a reply to message #506418] Thu, 07 January 2010 14:29 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060408060605010503000105
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Andre,

Empty loop iteration means that something went awry when retrieving the
collection on which the for should have iterated.

In the current case, I believe that your "c" is not an EClass (i.e : the
cast to ecore::EClass failed). Isn't what you seek to do more like :
"c.oclAsType(EObject).eClass().eAllAttributes" ?

Laurent Goubet
Obeo

Andre wrote:
> Laurent
>
> I've noticed now that when i run the transformation, the error log shows
> the message below, exactly on the loop we've talked about:
> Empty loop iteration at position 403 in Module toXML for block for
> (c.oclAsType(ecore::EClass).eAllAttributes). Last recorded value of self
> was mailto:Communication.impl.ConfigurationImpl@126c554 (name: local)
> (adaptationAction: NONE).
>
> Notice that at the end of the message is possible to see the two
> attibutes of the eClass: (name: local) (adaptationAction: NONE).
>
> I've used the CD example to simplify the question, but in fact im not
> using this kind of application
>
> thanks,
>


--------------060408060605010503000105
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=
--------------060408060605010503000105--
Re: [Acceleo] Get information about Metamodel in a model [message #506564 is a reply to message #506436] Fri, 08 January 2010 01:20 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Laurent

It is working now!! thanks a lot!
The loop used is:
[for ( a : EAttribute | c.oclAsType(EObject).eClass().eAllAttributes )]
<[a.name.toUpper()/]>[c.oclAsType(EObject).eGet(a)/]</[a.name.toUpper()/] >
[/for]


Another question: have you read my doubt about compatibilitie between acceleo 0.8 and 0.9, described on a message in this topic? Here it is:

Another point is that after i've updated the Acceleo version, an error appeared on some java files corresponding to the mtl acceleo script. The error is on this command:
AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments, targetFolder, false, monitor);
The error is:
The method doGenerate(Module, String, EObject, List<? extends Object>, File, Monitor) in the type AcceleoService is not applicable for the arguments (Module, String, EObject, List<capture#5-of ? extends Object>, File, boolean, Monitor)


What do i do? is it possible to regenerate the java file of an mtl? why this error occurs not in all mlt files?

Thanks,



Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #506602 is a reply to message #506564] Fri, 08 January 2010 09:37 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050702020704000608090103
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Andre,

Glad to hear the loops works as expected now ^^.

For the generated java file, yep, you simply need to regenerate it.
Since you have compilation errors on some files and not others, I
believe you have removed or altered the "@generated" tag from the files
where errors arise, preventing our builder from regenerating the java
launcher. If not, there is a possibility these files are no longer
needed since they had been generated for files you have since
renamed/removed.

Laurent Goubet
Obeo

Andre wrote:
> Laurent
>
> It is working now!! thanks a lot!
> The loop used is:
> [for ( a : EAttribute | c.oclAsType(EObject).eClass().eAllAttributes )]
> <[a.name.toUpper()/]>[c.oclAsType(EObject).eGet(a)/]</[a.name.toUpper()/]
> >
> [/for]
> Another question: have you read my doubt about compatibilitie between
> acceleo 0.8 and 0.9, described on a message in this topic? Here it is:
>
> Another point is that after i've updated the Acceleo version, an error
> appeared on some java files corresponding to the mtl acceleo script. The
> error is on this command:
> AcceleoService.doGenerate(module, TEMPLATE_NAMES[i], model, arguments,
> targetFolder, false, monitor);
> The error is:
> The method doGenerate(Module, String, EObject, List<? extends Object>,
> File, Monitor) in the type AcceleoService is not applicable for the
> arguments (Module, String, EObject, List<capture#5-of ? extends Object>,
> File, boolean, Monitor)
>
>
> What do i do? is it possible to regenerate the java file of an mtl? why
> this error occurs not in all mlt files?
>
> Thanks,
>
>


--------------050702020704000608090103
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=
--------------050702020704000608090103--
Re: [Acceleo] Get information about Metamodel in a model [message #506626 is a reply to message #506602] Fri, 08 January 2010 12:26 Go to previous messageGo to next message
Andre is currently offline AndreFriend
Messages: 29
Registered: November 2009
Location: Brazil
Junior Member
Laurent

The two java files that contain erros correspond to the templates that are the ones that are used only as libraries, being imported in other templates.

I did not alter anything on them, including '@generated' tag.

Talking about the regeneration, how can i do it? in this case, when the .mtl is used as a library, is the java file necessary?

thanks


Andre Silva
Natal-RN
Brazil
Re: [Acceleo] Get information about Metamodel in a model [message #507003 is a reply to message #506626] Mon, 11 January 2010 11:34 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1892
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------000809090808040805080003
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Andre,

If you use these modules as libraries, then no, the java files are not
necessary. In fact they're no longer generated for modules that do not
sport the [comment @main/] tag in a template.

regenerating the java files is done automatically when the template is
compiled, you shouldn't ever need to manually do it :).

Laurent Goubet
Obeo

Andre wrote:
> Laurent
>
> The two java files that contain erros correspond to the templates that
> are the ones that are used only as libraries, being imported in other
> templates.
>
> I did not alter anything on them, including mailto:'@generated' tag.
>
> Talking about the regeneration, how can i do it? in this case, when the
> .mtl is used as a library, is the java file necessary?
>
> thanks


--------------000809090808040805080003
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=
--------------000809090808040805080003--
Previous Topic:[Xpand] LET statement
Next Topic:[XPAND] Need for formatting commands?
Goto Forum:
  


Current Time: Thu Feb 25 16:56:15 GMT 2021

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

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

Back to the top