Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo 3] Classfier VS Collaboration VS Class(How to convert classifier in collaboration or Class)
[Acceleo 3] Classfier VS Collaboration VS Class [message #543919] Thu, 01 July 2010 06:24 Go to next message
Laviale Benoit is currently offline Laviale BenoitFriend
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
Hi,

I have a little trouble with acceleo...
I want to convert a classifier object ( Who is in fact a collaboration or a class) in his real type...

I don't know how to do this...

Thanks for the help

Best regards
Benoit


Trainee
Thales Communications France
Re: [Acceleo 3] Classfier VS Collaboration VS Class [message #543954 is a reply to message #543919] Thu, 01 July 2010 07:56 Go to previous messageGo to next message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020202040409030909090403
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Benoit,

I must admit I don't really understand what you're trying to do here...
I'll try a blind shot :

You have an EObject of type Class, and you want to retrieve its
qualified name? This is done with code like :

class.ancestors(NamedElement)->reverse().name.toLowerCase()- >including(class.name.toUpperFirst())->sep('.')

Laurent Goubet
Obeo

Laviale Benoit wrote:
> Hi,
> I have a little trouble with acceleo... I want to convert a classifier
> object ( Who is in fact a collaboration or a class) in his real type...
> I don't know how to do this...
>
> Thanks for the help
> Best regards Benoit


--------------020202040409030909090403
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=
--------------020202040409030909090403--
Re: [Acceleo 3] Classfier VS Collaboration VS Class [message #543988 is a reply to message #543954] Thu, 01 July 2010 09:43 Go to previous messageGo to next message
Laviale Benoit is currently offline Laviale BenoitFriend
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
I try to explain ...

I want to get all the interaction diagrams in a model.
The interaction can be in a class context, or in collaboration context.

In the main template I parse my model and I get all "owned element" (with the method ownedelement) of my model.
So I get classes objects, collaborations objects, and other types objects...

After this, I do a condition on all of this objects.
If the current object is a class or a collaboration, i call an other template ( it wants a classifier in parameter )

[template public getAllCollabsAndClasses(m : Model)]
[comment @main /]

[for (el : Element | m.ownedElement)]
	[if el.oclIsTypeOf(Collaboration) or el.oclIsTypeOf(Class)]
		[el.oclAsType(Classifier).generateStep()/]
		[el.oclAsType(Classifier).BatchGenCol()/]
	[/if]
[/for]
[/template]



Now, I only have Collaboration or Classes object who typed in Classifier.
I must "cast" my classifier object to have access of the method ownedBehavior...
I want to do something like that :
[template public generateStep(c : Classifier)]
[if c.oclIsTypeOf(Class)]
	[MyObjc= c.oclAsType(Class)  /]
[elseif  c.oclIsTypeOf(Collaboration)]
	[MyObjc= c.oclAsType(Collaboration)  /]
[/if]

		[for (i : Interaction | Myobjc.ownedBehavior)]
.................
..........


or
	[if c.oclIsTypeOf(Class)]
		[for (i : Interaction | c.oclAsType(Class).ownedBehavior)]
	[elseif c.oclIsTypeOf(Collaboration)]
		[for (i : Interaction | c.oclAsType(Collaboration).ownedBehavior)]
	[/if]


But I dont find the good issue...

Thank you



Trainee
Thales Communications France
Re: [Acceleo 3] Classfier VS Collaboration VS Class [message #544068 is a reply to message #543988] Thu, 01 July 2010 13:58 Go to previous messageGo to next message
Laviale Benoit is currently offline Laviale BenoitFriend
Messages: 25
Registered: April 2010
Location: Paris
Junior Member
Its resolve
The issue :
we don't care about the "real" type of the object.
I have just replace ownedbehavior by ownedElement, and that's good!




Trainee
Thales Communications France
Re: [Acceleo 3] Classfier VS Collaboration VS Class [message #544270 is a reply to message #544068] Fri, 02 July 2010 07:39 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------030808080704000406040306
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Happy to see you fixed it ... as I didn't really understand the issue :p

Laurent Goubet
Obeo

Laviale Benoit wrote:
> Its resolve The issue :
> we don't care about the "real" type of the object.
> I have just replace ownedbehavior by ownedElement, and that's good!
>
>


--------------030808080704000406040306
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=
--------------030808080704000406040306--
Previous Topic:[Acceleo 3] GetKeywords & GetEannotation
Next Topic:[Xtend] Casting doesn't work
Goto Forum:
  


Current Time: Sun Nov 23 02:26:15 GMT 2014

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

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