Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] multiples imports of classes associates([Acceleo] multiples imports of classes associates)
[Acceleo] multiples imports of classes associates [message #655708] Tue, 22 February 2011 11:55 Go to next message
olafo987  is currently offline olafo987
Messages: 13
Registered: November 2010
Junior Member
Hi
I come back to need your help, please.

I have one class that can it have multiples associations, and I have that make the imports of the paramaters of all operations of associates classes in the first class. I have the following code:

[template private loadSeqClassAssociates(loadSeqClassAssociates : Sequence(Class), bagParameters: Bag(Parameter), isLastAssociation : Boolean, qualifiedNameClass : String) post (trim())]
*************
[for (classPrueba : Class | loadSeqClassAssociates)]
classPrueba -> [classPrueba.name/]
[/for]
*************
[for (classAssociated : Class | loadSeqClassAssociates)]
[let bagParams : Bag(Parameter) = bagParameters -> union(listOfAllParameters(classAssociated))]
[printImportsParametersForBusiness(bagParams, isLastAssociation, qualifiedNameClass) /]
[/let]
[/for]
[/template]

[template public printImportsParametersForBusiness(bagParams : Bag(Parameter), isLastAssociation : Boolean, qualifiedNameClass : String)]
[if (isLastAssociation)][/comment]
[let setParams : Set(String) = bagParams -> collect(type.name) -> asSet()]
[for (className : String | setParams)]
[if (isTypeBasic(className))]
//[className/]
[else]
[let c : Class = findClass(className)]
[if (c.oclIsTypeOf(Class))]
[if (not qualifiedNameClass.equalsIgnoreCase(c.qualifiedName.substrin g(1, c.qualifiedName.index('::'.concat(c.name)))))]
import gnf.[c.qualifiedName.replaceAll('::', '.')/];
[/if]
[/if]
[/let]
[/if]
[/for]
[/let]
[/if][/comment]
[/template]

[template public importsParametersForBusiness(c : Class, qualifiedNameClass : String) post (trim())]
[let seqClassAssocites : Sequence(Class) = Sequence{}]
[let bagParameters : Bag(Parameter) = Bag{}]
[let seqAssociations : Sequence(Association) = c.getAssociations() -> select(a : Association | not c.name.equalsIgnoreCase(a.endType->first().name)) -> asSequence()]
[for (a : Association | seqAssociations)]
[let numAssociationsValid : Integer = seqAssociations -> size()]
[let isLastAssociation : Boolean = seqAssociations -> last().endType -> first().name.equalsIgnoreCase(a.endType -> first().name)]
[let class : Class = findClass(a.endType->first().name)]
[loadSeqClassAssociates(seqClassAssocites -> append(class), bagParameters, isLastAssociation, qualifiedNameClass) /]
[/let][/let][/let]
[/for]
[/let][/let][/let]
[/template]

And I have teh following result:
import gnf.ada.core.exceptions.ServiceException;
*************
classPrueba -> SupplySectorQueryService
*************
import [path ok].GasAttributesCaudalHorarioResultBean;
//Long
//Boolean
import [path ok].SimpleSupplySectorDTO;
//String
*************
classPrueba -> SupplySectorSearchService
*************
import [path ok].SupplySectorListingInfoRequestBean;
import [path ok].PruebaA;
import [path ok].PruebaB;
import [path ok].SupplySectorListingInfoResultBean;
import [path ok].FlowDTO;
*************
classPrueba -> SupplySectorUpdateService
*************
//Long
//String
//Boolean
import [path ok].FlowDTO;

I was hoping that in the last iteration, in the zone "****" would have the 3 classes with the it's associated. I know the variables can not be modified after of to be defined, but, this is valid for your content?, or this is a bug?. Some advice of how to make this?.

in advance, thanks for your help
Re: [Acceleo] multiples imports of classes associates [message #656100 is a reply to message #655708] Thu, 24 February 2011 08:12 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1625
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------070303090801000705060703
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi,

Please make your question concise : I can't figure out within what you
provided here what your problem is.

What is the result you expect, with what (simplified) part of what
model, and with what (simplified) part of the templates? And what is the
"faulty" (part of the) result you obtain?

Laurent Goubet
Obeo

On 22/02/2011 12:56, olafo987 wrote:
> Hi
> I come back to need your help, please.
>
> I have one class that can it have multiples associations, and I have
> that make the imports of the paramaters of all operations of associates
> classes in the first class. I have the following code:
>
> [template private loadSeqClassAssociates(loadSeqClassAssociates :
> Sequence(Class), bagParameters: Bag(Parameter), isLastAssociation :
> Boolean, qualifiedNameClass : String) post (trim())]
> *************
> [for (classPrueba : Class | loadSeqClassAssociates)]
> classPrueba -> [classPrueba.name/]
> [/for]
> *************
> [for (classAssociated : Class | loadSeqClassAssociates)]
> [let bagParams : Bag(Parameter) = bagParameters ->
> union(listOfAllParameters(classAssociated))]
> [printImportsParametersForBusiness(bagParams, isLastAssociation,
> qualifiedNameClass) /]
> [/let]
> [/for]
> [/template]
>
> [template public printImportsParametersForBusiness(bagParams :
> Bag(Parameter), isLastAssociation : Boolean, qualifiedNameClass : String)]
> [if (isLastAssociation)][/comment]
> [let setParams : Set(String) = bagParams -> collect(type.name) -> asSet()]
> [for (className : String | setParams)]
> [if (isTypeBasic(className))]
> //[className/]
> [else]
> [let c : Class = findClass(className)]
> [if (c.oclIsTypeOf(Class))]
> [if (not qualifiedNameClass.equalsIgnoreCase(c.qualifiedName.substrin
> g(1, c.qualifiedName.index('::'.concat(c.name)))))]
> import gnf.[c.qualifiedName.replaceAll('::', '.')/];
> [/if]
> [/if]
> [/let]
> [/if]
> [/for]
> [/let]
> [/if][/comment]
> [/template]
>
> [template public importsParametersForBusiness(c : Class,
> qualifiedNameClass : String) post (trim())]
> [let seqClassAssocites : Sequence(Class) = Sequence{}]
> [let bagParameters : Bag(Parameter) = Bag{}]
> [let seqAssociations : Sequence(Association) = c.getAssociations() ->
> select(a : Association | not
> c.name.equalsIgnoreCase(a.endType->first().name)) -> asSequence()]
> [for (a : Association | seqAssociations)]
> [let numAssociationsValid : Integer = seqAssociations -> size()]
> [let isLastAssociation : Boolean = seqAssociations -> last().endType ->
> first().name.equalsIgnoreCase(a.endType -> first().name)]
> [let class : Class = findClass(a.endType->first().name)]
> [loadSeqClassAssociates(seqClassAssocites -> append(class),
> bagParameters, isLastAssociation, qualifiedNameClass) /]
> [/let][/let][/let]
> [/for]
> [/let][/let][/let]
> [/template]
>
> And I have teh following result: import
> gnf.ada.core.exceptions.ServiceException;
> *************
> classPrueba -> SupplySectorQueryService
> *************
> import [path ok].GasAttributesCaudalHorarioResultBean;
> //Long
> //Boolean
> import [path ok].SimpleSupplySectorDTO;
> //String
> *************
> classPrueba -> SupplySectorSearchService
> *************
> import [path ok].SupplySectorListingInfoRequestBean;
> import [path ok].PruebaA;
> import [path ok].PruebaB;
> import [path ok].SupplySectorListingInfoResultBean;
> import [path ok].FlowDTO;
> *************
> classPrueba -> SupplySectorUpdateService
> *************
> //Long
> //String
> //Boolean
> import [path ok].FlowDTO;
>
> I was hoping that in the last iteration, in the zone "****" would have
> the 3 classes with the it's associated. I know the variables can not be
> modified after of to be defined, but, this is valid for your content?,
> or this is a bug?. Some advice of how to make this?.
>
> in advance, thanks for your help
>


--------------070303090801000705060703
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=
--------------070303090801000705060703--
Re: [Acceleo] multiples imports of classes associates [message #657355 is a reply to message #656100] Wed, 02 March 2011 14:36 Go to previous message
olafo987  is currently offline olafo987
Messages: 13
Registered: November 2010
Junior Member
Hi

I apologize for me the delay in responding. Thanks, I have solved my problem.
Previous Topic:Analyzing accessible EMF metamodels for project
Next Topic:Crash Eclipse Acceleo
Goto Forum:
  


Current Time: Sat Sep 20 08:10:30 GMT 2014

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

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