Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » Filter Classes(Filter classes)
Filter Classes [message #637359] Fri, 05 November 2010 08:35 Go to next message
olafo987  is currently offline olafo987 Friend
Messages: 13
Registered: November 2010
Junior Member
Sorry for my poor English.

Hi, I'm newbie with acceleo/ ocl and I need your help.
I have one model with several class, and with cross references, and I'm tried cross it.

I need to find only relations where the actual class is the init of relation no duplicates With the following code I had painted this relations:
[I][for (a : Association | c.getAssociations())]
a.endType.name => [a.endType.name/]
[for (p : Property | a.memberEnd->asSet())]
[if not (c.name.equalsIgnoreCase(self.type.name))]
[self.type.name/]
[/if]
[/for]
[/for][/I]


And I get the following:
1er for : Contract
a.endType.name => ContractCostumer
Costumer
a.endType.name => MainteinanceContractRequestBeanContract
MainteinanceContractRequestBean
a.endType.name => ContractContractedService
ContractedService
a.endType.name => ModifyContractRequestBeanContract
ModifyContractRequestBean
a.endType.name => MainteinanceContratServiceResultBeanContract
MainteinanceContratServiceResultBean
a.endType.name => ContractCostumer
Costumer


And basing on this I tried the following

[I][for (a : Association | c.getAssociations()->collect(a : Association | a.endType.name.startsWith(c.name)))]
dentro del 2do for
[for (p : Property | a.memberEnd->asSet())]
[if not (c.name.equalsIgnoreCase(self.type.name))]
[self.type.name/]
[/if]
[/for]
[/for][/I]


but never paint "dentro del 2do for".

Thanks
Re: Filter Classes [message #637584 is a reply to message #637359] Sun, 07 November 2010 11:19 Go to previous messageGo to next message
Sergio  is currently offline Sergio Friend
Messages: 21
Registered: August 2010
Location: Cardedeu
Junior Member
Hi olafo,

Maybe this could help you...

this is what I do to cross references in a class:

[for (a : Association | c.getAssociations() )] 
[if( not (c.name.equalsIgnoreCase(a.endType->last().name)))]
	[a.endType->last().name/]
[/if]
[/for]


what I'm trying to do here is:
1- get the all the associations of a class
2- filter the associations where my class is not the 'destination' class.
3- After that, I can do different things based on the type of the association

With this code it's possible to have repeated class name's, but only if the uml is not right.

Well, maybe there's another way to do that, but in my tests this was right. Smile

See you,
Sergio



Sergio Sacristán
http://s2o-bcn.blogspot.com/
Re: Filter Classes [message #637650 is a reply to message #637359] Mon, 08 November 2010 08:42 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1638
Registered: July 2009
Senior Member
Hi Olafo,

I must admit I don't really understand what you're trying to achieve. If Sergio's answer doesn't help, could you elaborate on what you have, what is the result you expect and what kind of information you have as a source for this particular need (part of your model)?

Laurent Goubet
Obeo
Previous Topic:[Acceleo] UML 2 Java - Non basic types + Magicdraw
Next Topic:[acceleo] How do I Delete Obsolete Metamodels?
Goto Forum:
  


Current Time: Sun Nov 23 11:14:38 GMT 2014

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

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