Skip to main content

Automatically Generating MagicDraw Report

Someone asked me how to generate MagicDraw HTML report from a certain UML model automatically. This feature is actually quite practical since if you are working in a group of business analysts, architects, developers, quality assurance personnel and operators, you mostly don't want to tell them to use MagicDraw to open the MDZip file. In this case you have two choices available:
  1. Export the diagrams as pictures (JPG or PNG) and put them somewhere like in your company Wiki. This can be done easily but you lose the structure of your model and you need to copy the structure in your Wiki which kind of unpractical.
  2. Export the whole MDZip file as a HTML (dynamic) report, which can be browsed nicely afterwards.
MagicDraw gives you an example how to do this from Maven, so you can generate the report automatically. So here are the steps:
  1. Create a Maven plugin project to run MagicDraw: You need to build a Maven Plugin project which should be used later in your main project. Copy the example from [magicdraw-install]\openapi\examples\mavenintegration\mdmvn and customize it as you need.
  2. Create a Maven report exporter project where you have your MDZip file which should be exported as HTML dynamic report. See this example from MagicDraw: [magicdraw-install]\openapi\examples\mavenintegration\execute.
To be able to run the report exporter project you need to do following:
  • Use the CommandLine class of MagicDraw to be run from the Maven plugin: 
 <mdmvn.mainClass>com.nomagic.magicdraw.magicreport.CommandLine</mdmvn.mainClass>   
  • Include following classpath additionally to the MagicDraw classpath:
 <mdmvn.classpath>plugins/com.nomagic.magicdraw.codeengineering/codeengineering.jar:plugins/com.nomagic.magicdraw.codeengineering/codeengineering_api.jar:plugins/com.nomagic.magicdraw.codeengineering/lib/antlr_2.7.6.1.jar:lib/y.jar:plugins/com.nomagic.magicdraw.diagramtable/diagramtable.jar:plugins/com.nomagic.magicdraw.diagramtable/diagramtable_api.jar:plugins/com.nomagic.magicdraw.reportwizard/reportwizard.jar:plugins/com.nomagic.magicdraw.reportwizard/reportwizard_api.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/avalon-logkit-2.1.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/commons-beanutils-1.7.0.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/commons-collections-3.2.1.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/commons-lang-2.4.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/commons-logging-1.1.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/commons-net-ftp-2.0.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/jsch-0.1.40.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/log4j-1.2.14.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/magicreport.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/oro-2.0.8.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/stax2-api-3.0.1.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/velocity-1.6.2.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/velocity-tools-generic-1.4.jar:plugins/com.nomagic.magicdraw.reportwizard/lib/woodstox-core-asl-4.0.7.jar</mdmvn.classpath>  
  • Include the mdreport.properties with following content, customize the directory and package as you need: 
 project=D:\\projects\\project-exporter\\src\\main\\resources\\model\\project.mdzip  
 output=D:\\output\\project-report\\report.html  
 template=Web Publisher 2.0  
 package=Analysis;Architecture;Implementation  
 report=Built-in  
 recursive=true  
That's it! You are now able to run the Magic Draw project exporter automatically which creates the dynamic HTML files. Some additional ideas to make the thing more smooth:
  • Run the report exporter in your CI / Jenkins environment. You still need X server to be able to do this in Linux, so you need something like Xvnc plugin for Jenkins. Also check out this Blog: http://goo.gl/0LW3bK.
  • You can extend the Maven exporter project and integrate Spring Boot, so you can deploy the MagicDraw HTML files as a webapp, so your users can smoothly browse it.
I would prepare some code examples in Github if you are interested in this topic, just mail me.

Have fun!
Lofi

Comments

Popular posts from this blog

Creating Spring Bean dynamically in the Runtime

In my training someone asked me whether it is possible to create an object (a Spring Bean) dynamically so you can choose which implementation you want to have in the runtime. So at the compile time you don't know what object actually should be created yet. The application should decide what object to be created based on a property file.

1. We create an annotation so we can mark the method which should be able to create the object dynamically:

...
package your.package;
...
@Retention(RetentionPolicy.RUNTIME)
public @interface InjectDynamicObject {
}
...
2. Use the new created annotation in your method which should be able to create the object dynamically:
... @Named("customerBo") public class CustomerBoImpl implements CustomerBo { ...     @Override @InjectDynamicObject public Customer getDynamicCustomer() {         return this.dynamicCustomer; } ...
3. Write an aspect with Pointcut and Advise which change the object returned by the method in the step 2:
... @Named @Aspect public class Dyn…

GWT Training for Java Developers with GWT Boot

I'm always a fan of "one language solution with Java to rule them all", here are sofar my opinions about Polyglot Programming:
Why "Polyglot Programming" or "Do It Yourself Programming Languages" or "Language Oriented Programming" sucks?Warum Polyglot Programming nicht praxistauglich istJava als universelle Programmiersprache Until today nobody can excite me about Polyglot Programming. My points are getting another big support after I read the "Rise of Polyglot at Netflix" presentation which says that Polyglot is expensive, also for company in the category of Netflix. At the end of the day we need to be productive. Our applications should have a high quality standard and the total costs (TCO) of our software development should be manageable and low. To be able to reach this goal we have Java with Spring Boot or JakartaEE on the server-side which offers REST interfaces. So logically for user interface development on the client-side I…

Smart Home Sweet Home with Gigaset Elements?

Introduction
Last week I had a chance to try the Smart Home solution from Gigaset Elements. I read some articles about this product which said how easy to install this product for dummy users. Those articles woke my interest and I began to google products for Smart Home solutions.

In this article (German language) you will find a nice overview about some products for Smart Home, which can be bought in Germany. The Nest product from Google is still not available in Germany. Although it seems that RWE will offer Nest products in Germany in couple of months.

The installation of Gigaset Elements was really easy. The problem I encountered was to add the sirensensor. I had to push hard the button on the siren sensor at the same time with the button on the base, so that they can communicate with each other. After about one hour I managed to install everything properly.

Points to mention
Generally the idea is very nice. Gigaset Elements try to push KISS (Keep it Simple Stupid) principle. Howev…