Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Gendoc » More on stereotypes(Displaying a property that is a list of Strings)
More on stereotypes [message #1709743] Wed, 30 September 2015 16:27 Go to next message
Marc FLAUW is currently offline Marc FLAUWFriend
Messages: 151
Registered: July 2009
Senior Member
Hi

I have stereotype containing a property (triggerConditionList) which is a String[1..*].

Reusing some of the information from a previous post from Scott Mansfield, here is what I use:

[for (cl:uml::Signal | element.ownedElement->filter(Signal))]<drop/>
[cl.name/] notification

[for (st:uml::Stereotype | cl.getAppliedStereotypes())]<drop/>
• [st.name/]
[for (oa:uml::Property|st.ownedAttribute)]<drop/>
[if (not oa.name.contains('base'))][oa.name/]: [if (not cl.getValue(st, oa.name).oclIsUndefined())][if oa.name.contains(' triggerConditionList')][cl.getValue(st, oa.name).oclAsType(String)/] [else][cl.getValue(st, oa.name).oclAsType(EnumerationLiteral).name/][/if][else]<drop/>[/if]
[/if] <drop/>
[/for]<drop/>
[/for]<drop/>

This was working for a single string, but does not seem to work for a list and I still don;t really know how to loop on the values,

Any idea?

Best regards,

MArc
Re: More on stereotypes [message #1709761 is a reply to message #1709743] Wed, 30 September 2015 17:54 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 425
Registered: July 2009
Senior Member
Hello it is quite difficult to "cast" collections generally we use this trick tell me it it does work for you :

[Sequence{cl.getValue(st, oa.name)}->flatten().oclAsType(String)/]






[Updated on: Wed, 30 September 2015 17:55]

Report message to a moderator

Re: More on stereotypes [message #1709788 is a reply to message #1709761] Thu, 01 October 2015 07:03 Go to previous messageGo to next message
Marc FLAUW is currently offline Marc FLAUWFriend
Messages: 151
Registered: July 2009
Senior Member
Thanks, it works and I have now the list, but it is on a single line, just separated by blanks.
I would have prefered one line per condition.
Any way to do that?

Thanks,

Marc
Re: More on stereotypes [message #1709792 is a reply to message #1709788] Thu, 01 October 2015 07:22 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 425
Registered: July 2009
Senior Member
The result of the expression is a sequence of String so you can iterate on it, do some filter ...
instead of [s/] maybe you should call [s.clean()/] if there are some special characters in your stereotype values

[for (s : String | Sequence{cl.getValue(st, oa.name)}->flatten().oclAsType(String))]
[s/]
[/for]




Re: More on stereotypes [message #1709798 is a reply to message #1709792] Thu, 01 October 2015 07:41 Go to previous messageGo to next message
Marc FLAUW is currently offline Marc FLAUWFriend
Messages: 151
Registered: July 2009
Senior Member
Thanks, that works fine.

Best regards,

Marc
Re: More on stereotypes [message #1722732 is a reply to message #1709798] Mon, 08 February 2016 16:39 Go to previous messageGo to next message
Bernd Zeuner is currently offline Bernd ZeunerFriend
Messages: 14
Registered: July 2009
Junior Member
This way works for a list of String values.
What would be the script for retrieving a list of EnumerationLiterals?

Regards
Bernd
Re: More on stereotypes [message #1723084 is a reply to message #1722732] Thu, 11 February 2016 13:41 Go to previous messageGo to next message
Tristan Faure is currently offline Tristan FaureFriend
Messages: 425
Registered: July 2009
Senior Member
can you write a part of your query ? mentionning which type is the enumeration



Re: More on stereotypes [message #1723146 is a reply to message #1723084] Fri, 12 February 2016 07:31 Go to previous messageGo to next message
Bernd Zeuner is currently offline Bernd ZeunerFriend
Messages: 14
Registered: July 2009
Junior Member
This query works for a single value:
[if oa.name.contains('test')]testCategory: [p.getValue(st, oa.name).oclAsType(EnumerationLiteral).name/]

Here the queries that I try for the list (among others) which didn't work:

[if oa.name.contains('test')]testCategory : [for (e : EnumerationLiteral | Sequence{p.getValue(st, oa.name)}->flatten().oclAsType(EnumerationLiteral))]<drop/> [e.clean()/]

[if oa.name.contains('test')]testCategory : [for (e : EnumerationLiteral | Sequence{p.getValue(st, oa.name)}->flatten().oclAsType(EnumerationLiteral).name)]<drop/> [e.clean()/]

Here the profile definition:
+ testCategory : CfsRfsProfile::TestCategory [1..*] = BIP
where TestCategory is an Enumeration with some Literals.

Regards
Bernd
Re: More on stereotypes [message #1723871 is a reply to message #1723146] Thu, 18 February 2016 16:10 Go to previous messageGo to next message
Anne Haugommard is currently offline Anne HaugommardFriend
Messages: 11
Registered: October 2013
Junior Member
Hi Bernd,

Your query was quite ok, with only 2 things to modify:
- type for Stereotype attribute Enumeration literal is "ecore::EEnumLiteral" instead of "EnumerationLiteral"
- type of your variable "e" can be either EEnumLiteral if you remove the ".name" from the query or String if you keep this part

So the following query should work :
[if oa.name.contains('test')]testCategory : [for (e : ecore::EEnumLiteral| Sequence{p.getValue(st, oa.name)}->flatten().oclAsType(ecore::EEnumLiteral))]<drop/> [e.name.clean()/]


Best regards,
Anne
Re: More on stereotypes [message #1723930 is a reply to message #1723871] Fri, 19 February 2016 06:59 Go to previous message
Bernd Zeuner is currently offline Bernd ZeunerFriend
Messages: 14
Registered: July 2009
Junior Member
Hallo Anne,

It's working now Smile
Thank you very much.

Btw. is there somewhere a list which describes how to access the UML artifacts from gendoc?

Regards
Bernd
Previous Topic:Question on fragment syntax
Next Topic:Displaying packages in order
Goto Forum:
  


Current Time: Mon Sep 24 19:25:12 GMT 2018

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

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

Back to the top