Enterprise Architect version 13

download
purchase

English Chinese (Simplified) Czech Dutch French German Italian Korean Polish Portuguese Russian Slovak Spanish Swedish

My Profile

Social Media Channels

facebook google plus twitter youtube linkedin

VISEO EA UML to JHipster Generator MDG Technology

This article shares an MDG Technology that integrates Sparx Enterprise Architect UML models with JHipster.

VISEO EA UML to JHipster Generator MDG produces JDL (JHipster Domain Language) content from UML models maintained in Enterprise Architect. This output can be used in JHipster to create the application's entities, including properties and relations.

Not being able to find a suitable tool that generates JHipster entities from UML models, I started such integration for a software application that has been implemented with JHipster 2.

Note: the current version of the MDG is compatible with JHipster 2, latest available version when the project started. JHipster 3 new features could be integrated in a future version.

Context

A modelling project has been launched with Enterprise Architect to gather and maintain all the information and knowledge related with the project for the development team and stakeholders.

The initial models included business classes to identify the concepts, shared through a visual representation with UML. This approach has been useful when integrating these concepts in the technical environment JHipster.

JHipster, or “Java Hipster”, is a handy Open Source application generator that aims to create a complete and modern Web app:

  • A high-performance and robust Java stack back-end (Spring Boot, Spring Security, Spring Data, Spring MVC, etc.)
  • A sleek, modern, mobile-first front-end (Angular.js and Bootstrap)
  • A suite of pre-configured development tools like Yeoman, Maven, Gradle, Grunt, Gulp.js and Bower

UML to JHipster JDL generator

Overview

Defining class models on both business and technical layers enabled a proper integration of the business definitions in the software application. Design workshops were carried in an efficient manner through the use of a common language and tool (Sparx Enterprise Architect and UML).

Looking for existing integration solutions between UML tools and JHipster yielded XMI exports/imports. However XMI implementations in UML tools don't provide most of the time a proper and full exchange of UML models i.e. without loss or modification of definitions. JDL Studio looked interesting; this online tool renders an entity diagram matching the JDL content. The downloaded file can be used to generate entities in JHipster (command line example: "yo jhipster:import-jdl export-jdl-uml.jh").
Without a suitable link between Enterprise Architect and JHipster, I wrote a script that generates such content directly from Enterprise Architect models. It requires the following JHipster 2 customizations carried in Enterprise Architect:

  • Data types: JHipster types are available for the entities' attributes.
  • UML profile: stereotypes on UML classes and attributes to provide JHipster properties via tagged values, listed below.
    • Classes
      • jhipsterDto : use mapstruct for the DTO-entity mapping
      • jhipsterPaginate : pagination choice for lists (infinite-scroll, pager, pagination)
      • jhipsterService : apply serviceClass to the entity
    • Attributes
      • jhipsterisRequired : the attribut is required
      • jhipsterMin: provides the minimum value (declared as minlength for String attributes, or min for Integer, Long, Float, Double, or BigDecimal attributes)
      • jhipsterMax: provides the maximum value (declared as maxlength for String attributes, or max for Integer, Long, Float, Double, or BigDecimal attributes)
      • jhipsterPattern: provide the pattern value for a String attribute
    • Script: generates the JDL content

The following UML class diagram illustrates the meta-model applied for the UML to JHipster 2 JDL integration:

SparxSystems Enterprise Architect UML to JHipster JDL File generator metamodel

The script and UML profile have been improved through users' feedback and reviews from JHipster experts at VISEO.

Installation

The EA UML to JHipster MDG is published via an XML file. Once installed, it is listed in the MDG Technologies screen:

MDG EA UML to JHipster JDL

Note: this MDG is available on request (e-mail: jhipster[at]umlchannel.com).

JHipster diagram and toolbox

EA/JHipster MDG Technology supports a diagram with its toolbox to create stereotyped classes and attributes:

uml to jhipster sparx en toolbox

UML profile and JHipster stereotypes

EA/JHipster MDG Technology includes a UML profile with stereotypes on classes and attributes to provide relevant Tagged Values.

When starting a JHipster design class diagram, JHipster entities contain tagged values available from the JHipster tab: DTO, paginate, service. The "none" value is set by default so all tagged values are optional.

uml jhipster entity properties

The JHipster entity "Language" field is set to JHipster so its attributes are associated with the JHipster data types list.

The diagram toolbox can be used to add a stereotyped attribute to a JHipster Entity class. Such attributes also contains properties from the Tagged Values tab:

sparx ea uml attribute jhipster

UML to JHipster generation script

The following UML class diagram has been defined with Sparx Enterprise Architect based on the JDL Studio example. This model provides a mean to check that the generated JDL content from either solution matches.

Compared with the JDL studio diagram, UML class diagrams have the advantage of being based on the OMG standard. Furthermore using a tool like Sparx Enterprise Architect provides a way to maintain the entity design model within a complete modelling repository e.g. including requirements, business, analysis and architecture models.

The following JDL content has been generated using this script:

=== EA UML to JHipster Entity Export ===
== More information is available from www.umlchannel.com/jhipster ==
INSTRUCTIONS: copy and paste the following content in a text file, and rename it e.g. as dpl.jh =
entity Department {
departmentId Long,
departmentName String required
}
entity JobHistory {
startDate ZonedDateTime,
endDate ZonedDateTime,
language Language
}
entity Job {
jobId Long,
jobTitle String,
minSalary Long,
maxSalary Long
}
/**
* The Employee entity.
*/
entity Employee {
employeeId Long,
/**
* The firstname attribute.
*/
firstName String,
lastName String,
email String,
phoneNumber String,
hireDate ZonedDateTime,
salary Long,
commissionPct Long
}
entity Location {
locationId Long,
streetAddress String,
postalCode String,
city String,
stateProvince String
}
entity Task {
taskId Long,
title String,
description String
}
entity Country {
countryId Long,
countryName String
}
entity Region {
regionId Long,
regionName String
}
enum Language {
FRENCH, ENGLISH, SPANISH
}
relationship OneToOne {
Department{location} to Location
}
relationship OneToMany {

/**
* A relationship
*/
Department{employee} to
/**
* Another side of the same relationship
*/
Employee
}
relationship OneToOne {
JobHistory{department} to Department
}
relationship OneToOne {
JobHistory{employee} to Employee
}
relationship OneToOne {
JobHistory{job} to Job
}
relationship ManyToMany {
Job{task(title)} to Task{job}
}
relationship ManyToOne {
Employee{manager} to Employee
}
relationship OneToMany {
Employee{job} to Job
}
relationship OneToOne {
Location{country} to Country
}
relationship OneToOne {
Country{region} to Region
}
paginate JobHistory, Employee with infinite-scroll
paginate Job with pagination
dto Job, Employee with mapstruct
service Employee with serviceClass

The final step involves copying this content to a JH file, and use it in JHipster to generate entities.

Scope

This approach was used as a mean to easily generate new versions of the design entity model within JHipster. Updates were carried in Enterprise Architect to remain consistent with the business model, whilst being generated, tested and approved directly in the application.

Once entities are updated in JHipster with custom code, it prevents any synchronization with the UML model. Where a full synchronization between the JHipster and UML projects is not the final purpose of this MDG, it allows having a design model that matches exactly the entities definition in the development environment during the first iterations of the project. This level of information in the design layer is very useful, even if mismatches with the code are bound to occur. The design team may chose to manually update the UML design model when needed.

Future versions

This MDG has been implemented and used with JHipster 2. A future version could be released to support JHipster 3 that has introduced new properties such as:

  • new serviceImpl service
  • new syntax e.g. "dto (ou service ) * with … except …"
  • skipClient and skipServer declaration on entities
  • angularSuffix
  • Microservices (e.g. microservice with <jhipster app name>)
  • elasticsearch search on entities (e.g. search * with elasticsearch except …)
  • New types (AnyBlob, ImageBlob)
  • Generate minbytes and maxbypes for blob attributes( Blob, AnyBlob, ImageBlob)

 

Published in Case Studies
Thursday, 24 March 2016 11:07

New: Dunstan Thomas Consulting MDG Workshop

MDG Workshop

Dunstan Thomas Consulting is proud to announce the new one day MDG Workshop!

Overview


Sparx Systems Enterprise Architect provides modelling extensions to supplement UML through a technology known as Model Driven Generator or MDG. Tools are provided in Enterprise Architect for experienced users to develop their own MDGs either from scratch or based upon an existing MDG such as ArchiMate, or BPMN. This one day workshop will provide attendees with a practical experience of the tasks required to build a typical MDG.

User Story Screenshot


Agenda

The following topics will be covered:

  • What is an MDG, what it can contain and the benefits an MDG can provided to an organization.
  • Using the Model Wizard to create an MDG model repository.
  • The steps in planning an MDG.
  • Tagged values, their typed, use and creation.
  • Using the MDG Helpers to create a Profile.
  • Using the MDG Helpers to create a customized Toolbox.
  • Using the MDG Helpers to create a customized Diagram.
  • Generating the MDG.
  • Testing the MDG.
  • Deploying the MDG.
  • Making changes to the MDG and applying those changes to an existing model repository.
  • Shapescripts, their use, structure and applicability to an MDG.
  • The concept of Quicklink and its application to a customized Diagram.

Full details are available on our website.

Published in News

BPMN GeneratorBPMN Generator

An add-in for Enterprise Architect from Dunstan Thomas Consulting

We have had our very own Phil Chudley busy beavering away at a new project which is now commercially available & already in use with DT's customer base.

Overview

Sparx Systems Enterprise Architect has the functionality to create diagrams directly from Use Case textual scenarios, the most common of which is termed an Activity Graph. This Activity Graph is a simplified form of UML Activity Diagram. This works well, but many organisations have, or are in the process of, standardising the modelling of process flows using BPMN 2.0, and this form of diagram is not supported by Enterprise Architect. The BPMN Generator extension for Enterprise Architect has been developed by Dunstan Thomas Consulting Ltd to provide the functionality to generate a BPMN 2.0 process flow diagram from Use Case textual scenarios. A typical example is shown below:

Textual Scenario for the Basic Path

BPMN Generator - basic path  

Textual Scenario for the Alternate Path

BPMN Generator - alternate path  

Generated BPMN 2.0 Diagram

BPMN Generator - generated diagram


The BPMN Generator also provides the modeller with options to set:

  • The top margin of the generated diagram.
  • The left margin of the generated diagram.
  • The default height of each task.
  • The adjustment height of each task (used to ensure that text fits in a task).
  • Whether or not a new diagram and elements will be generated rather than overwrite any existing diagram and elements.

Watch the video below to see the BPMN Generator in action:

https://youtu.be/WhL9vEdvHF0 


The BPMN Generator is available from Dunstan Thomas Consulting at £85.00 +Vat per licence. If you would like additional information or to purchase licences for the BPMN Generator then please contact us.

Published in News