Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » Filter Classes(Filter classes)
Filter Classes [message #637359] Fri, 05 November 2010 04:35 Go to next message
Eclipse UserFriend
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 06:19 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Filter Classes [message #637650 is a reply to message #637359] Mon, 08 November 2010 03:42 Go to previous message
Eclipse UserFriend
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 Jul 06 05:13:59 EDT 2025

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

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

Back to the top