|
Re: [Acceleo] How to generate code from Actions in Activity diagram in control flow order? [message #535100 is a reply to message #534798] |
Fri, 21 May 2010 09:48 |
|
This is a multi-part message in MIME format.
--------------080401020305070908070406
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Michal,
I have no idea as to how this would be represented in an UML model, but
I do know UML has no "ordered" reference : everything is unordered (see
also my answer on
http://lists.gforge.enseeiht.fr/pipermail/topcased-users/201 0-May/003777.html
).
I believe your choices are to either use the "sortedBy" OCL operation in
order to properly order your ValueSpecifications (or ControlFlows) or
make use of recursive Acceleo Queries or Templates.
As I said earlier, I haven't got even the slightest idea as to how your
diagram would be represented in UML, so I can't really help with the OCL
you'd need.
Laurent Goubet
Obeo
Michal Jani wrote:
> Hi, I want to generate a code for Actions in Activity diagram with
> Acceleo v3.0, IN ORDER which is affected by Control flow arrows (which
> are connecting the single Actions together between them)
> For example if diagram looks like : (Activity Initial Node)
> ---{control flow arrow}---> (Value Specification Action 1) ---{control
> flow arrow}---> (Value Specification Action 3) ---{control flow
> arrow}---> (Value Specification Action 2) ---{control flow arrow}--->
> (Activity Final Node)
>
> Then I want to generate code from it in the same order, like :
> generated code for Value Specification Action 1;
> generated code for Value Specification Action 3;
> generated code for Value Specification Action 2;
>
>
> Thx for any help or advice :)
>
> (by the way, there is some solution described on
> http://www.acceleo.org/forum/read.php?11,881 , but its for older
> version of Acceleo and dont know how to make it works on Acceleo 3.0.... )
--------------080401020305070908070406
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=
--------------080401020305070908070406--
|
|
|
|
|
Re: [Acceleo] How to generate code from Actions in Activity diagram in control flow order? [message #536890 is a reply to message #536500] |
Mon, 31 May 2010 12:17 |
|
This is a multi-part message in MIME format.
--------------050701090704050601080205
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Hi Michal,
Sorry, I realize I let one of your posts slip through last week.
Your code ... scared me :p.
Couldn't you at least use a recursive template such as
[for (i : InitialNode | a.ownedElement)]
[getNodeFlow(i)/]
[/for]
[template public getNodeFlow(node : InitialNode)]
node.outgoing.target.name;
[if (not outgoing.target.outgoing.oclIsUndefined())]
[getNodeFlow(outgoing.target)/]
[/if]
[/template]
Laurent Goubet
Obeo
Michal Jani wrote:
> After some finding and trying I finally understood, that generating code
> from activity diagram by control flow is not a good idea, cose Activity
> diagram is not designed and suitable for it. (or if you like, for way
> of use which I wanted)
>
> In some very strict example, where is amount of control flow from one
> node to another restricted to one and number of nodes is restricted
> maximally to 8, the code for generator could look somehow like:
>
> [template public generateJavaFunctionsFromActivityDiagram(a : Activity)]
> [file (a.name.concat('.java'), false)]
> package [a.name/];
> public class [a.name/] {
>
> [for (i : InitialNode | a.ownedElement)]
> [i.outgoing.target.name/] ;
> [i.outgoing.target.outgoing.target.name/] ;
> [i.outgoing.target.outgoing.target.outgoing.target.name/] ;
> [i.outgoing.target.outgoing.target.outgoing.target.outgoing.
> target.name/] ;
> [i.outgoing.target.outgoing.target.outgoing.target.outgoing.
> target.outgoing.target.name/] ;
> [i.outgoing.target.outgoing.target.outgoing.target.outgoing.
> target.outgoing.target.outgoing.target.name/] ;
> [i.outgoing.target.outgoing.target.outgoing.target.outgoing.
> target.outgoing.target.outgoing.target.outgoing.target.name/ ] ;
> [i.outgoing.target.outgoing.target.outgoing.target.outgoing.
> target.outgoing.target.outgoing.target.outgoing.target.outgo
> ing.target.name/] ;
> [/for]
>
> }
> [/file]
> [/template]
>
>
>
> Its a pitty :p
>
>
--------------050701090704050601080205
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=
--------------050701090704050601080205--
|
|
|
Powered by
FUDForum. Page generated in 0.02095 seconds