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…

Enterprise Applications Customization with Microservice

Introduction Today in highly paced enterprise environment you, as the leader of enterprise IT division, need to be fast. Simplicity is the key for the speed. What are the key factors to simplify your IT? Three different areas are very important to take care of: Technology, Organisation and Environment(TOE Framework: http://goo.gl/tQlX5z). Here are some detail points for technology and organisation:

1. Technology: in most enterprises there are already one or more ERP and CRM solutions the so called Enterprise Applications. We need to manage them carefully as they support the business processes. In context of the core compentencies most enterprises customize the enterprise applications to fit their needs. We need to manage the customizations in detail as they represent the core competencies and at the same time the differentiation of our enterprise to other competitors. 2. Organisation: working in a small team with different roles and functions is already proved as the best …

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…