Writing your own code generator for e.g., Activity Diagrams

General discussions about code engineering

Moderator: Moderators

Writing your own code generator for e.g., Activity Diagrams

Postby MSDL » Fri Jul 27, 2018 4:52 am

I am new to MagicDraw. I would like to write my own code generator, which is fully customized and can generate code for any model element I want. Currently the only option I see is to write a complete plug-in for this. Is that correct?
I would expect that code templates and a code generation language would be present (like e.g., Acceleo https://wiki.eclipse.org/Acceleo/Getting_Started), but I cannot seem to find this.

What is the best way to write your custom code generator? Thank you in advance!

(By the way, I am aware of the LieberLieber Embedded Engineer plug-in, but I am looking for custom-made code generation.)
MSDL
Forum Newbie
Forum Newbie
 
Posts: 4
Posts Rating:1
Joined: Fri Jul 27, 2018 4:40 am

Re: Writing your own code generator for e.g., Activity Diagrams

Postby gedkvi » Tue Aug 14, 2018 4:09 am

Hello,

Unfortunately, the Code Generation code is not exposed to OpenAPI, thus there is nothing to extend.
The only way would be to, like you mentioned, write a plug-in from scratch yourself.
Of course there are various profiles like XML Schema Profile, Java SE8 Model Library and other profiles that contain various profiles. They contain stereotypes, types and other information that might come in handy to you in your model. And you would not need to duplicate them by yourself. They can be found in the profiles or modelLibraries folders in the installation directory.

Sincerely,
No Magic Customer Support
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Writing your own code generator for e.g., Activity Diagrams

Postby stefan.roehrig@vaillant-group.com » Fri Jan 25, 2019 12:24 pm

Is it correct, that there is no way to customize the java code generation which is delivered with MagicDraw professional?
stefan.roehrig@vaillant-group.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Fri Jan 25, 2019 12:19 pm

Re: Writing your own code generator for e.g., Activity Diagrams

Postby gedkvi » Mon Jan 28, 2019 1:20 am

stefan.roehrig@vaillant-group.com wrote:Is it correct, that there is no way to customize the java code generation which is delivered with MagicDraw professional?


Hello,

It is only as customizable as Options allow it.
If we are talking about customizing using code for extensability then yes, there is no way to customize the current implementations of java code generation. The API has methods to call code reverse/generate. So if a "post processing" mechanism would be enough for you, maybe that could be a solution.

Sincerely,
No Magic Customer Support
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Writing your own code generator for e.g., Activity Diagrams

Postby stefan.roehrig@vaillant-group.com » Mon Jan 28, 2019 3:02 am

Hi,
I'm really sad to hear this, because then I guess it is not possible for me to use it.
What I need is java code with special annotations in it and the generation of the OData service interface, which belongs to it.

Is there any 3rd party code generator which works together with MagicDraw?

Regards,
Stefan
stefan.roehrig@vaillant-group.com
Forum Newbie
Forum Newbie
 
Posts: 3
Posts Rating:0
Joined: Fri Jan 25, 2019 12:19 pm

Re: Writing your own code generator for e.g., Activity Diagrams

Postby gedkvi » Mon Jan 28, 2019 6:49 am

Hi,

Using current Java code generator it is possible to model annotations. You can read more about annotations in <modeling_tool>\manual\MagicDraw CodeEngineering UserGuide.pdf, maybe it could be of any use for you.
But unfortunately there is no way to plug into the reverse/generate process itself. and e.g. call different code when reversing methods.

Is there any 3rd party code generator which works together with MagicDraw?

I have not heard of such code generator for Java. Actually we don't have a repository and don't provide any 3rd party plugins. Sometimes users share code in the forums, but rarely a full plugin.

Sincerely,
No Magic Customer Support
gedkvi
Customer Support
Customer Support
 
Posts: 55
Posts Rating:7
Joined: Wed Sep 16, 2015 11:25 am

Re: Writing your own code generator for e.g., Activity Diagrams

Postby koffeekingston@protonmail.com » Wed Jun 12, 2019 3:26 am

This code generator gets the solution and helps you to debug easily. https://errorcode0x.com/fixed-dell-printer-error-016-302/ helped me to with this annotation.
koffeekingston@protonmail.com
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:-1
Joined: Wed Jun 12, 2019 2:11 am

Re: Writing your own code generator for e.g., Activity Diagrams

Postby sunitapr9091@gmail.com » Fri Sep 20, 2019 1:30 am

Thanks for the post. It is helpful for me.
sunitapr9091@gmail.com
Forum Newbie
Forum Newbie
 
Posts: 1
Posts Rating:0
Joined: Fri Sep 20, 2019 1:20 am


Return to Code engineering

Who is online

Users browsing this forum: No registered users and 1 guest