Quantcast
Channel: The GenMyModel blog
Viewing all 52 articles
Browse latest View live

Introducing the New GenMyModel Dashboard

$
0
0

dashboard-genmymodel In preparation for **coming out of beta September 27, 2014, we’ve launched an all new user dashboard that we’re excited to tell you about today.** Why the change? We wanted to take the dashboard to a whole new level that will also incorporate the new changes to GenMyModel.

Model History You can now see the model’s

** command (modification) history**. This is especially helpful if you’re collaborating with others (especially as a part of a distributed team) as you can see if the UML model has been modified and the number of commands applied since the last time you opened it. Recent activity for all your projects is displayed on your main dashboard page and Project page, and activity for a specific project is available on the project’s page.

Social and Sharing The new dashboard is also

more social with options to easily share your models with others or your social networks. Only public models will be viewable by those you didn’t invite as a collaborator. You are also able to edit your user profile. You can even add a description to your model, a great way to highlight what your model is for.

Coming soon… We will soon be releasing model versioning which will also be available in the dashboard. What do you think of the new dashboard? And more importantly, are you on the dark or light side of the force (on your user profile)?


Out of Beta: Special Offer for Current GenMyModel Users

$
0
0

genmymodel out of beta

We are pleased to announce a special offer for anyone who signs up for an account with GenMyModel before September 27, 2014.

Starting September 27, GenMyModel will be out of beta. Thanks to all of your feedback, we have made the move to a professional modeling application.

In order to thank you for using GenMyModel, we’d like to offer you a special discounted price.

If you subscribe to a GenMyModel paid plan between September 27  and October 31, 2014, you will benefit from 25% off normal subscription prices. Even better, you will benefit from this reduced price for as long as you keep a paid subscription (even if you change plans)! This discount applies to all monthly and yearly plans:

genmymodel pricing

If you have private projects and do not wish subscribe to a paid plan, your private plans will remain private in read-only mode. In order to edit them, you can make the project public or switch to a paid plan.

We have big plans for the future of GenMyModel once we’re out of beta: new features, improved GUI, and more! Even more reason to love modeling in the cloud.


If you have any questions, please contact us.

Video Demo: Editing Code in the Cloud: C9, GenMyModel, and GitHub

$
0
0

We’ve been using a great tool called Cloud9 to edit our code generated by GenMyModel. Find out more with our video demo.

What is Cloud9 (C9)?

For those of you who haven’t used it yet, C9 is a great online code editor that allows you to edit your code from any browser and collaborate with others. We really like how easy it is to use and how it can be used together with GenMyModel and Github.

Video Tutorial

We’ve prepared a short video on how to generate code from your UML class diagrams and then edit that code with C9.

ChangeLog October 23th 2014

$
0
0

We’re excited to unveil new features including model generation from Java, dashboard notifications, and the coloring that will make collaboration with your diagrams even easier. Read on!

UML Model generation from Java

It’s now possible to create an UML model out of an existing Java code repository. Just give the URL of your Git repository and GenMyModel analyzes the Java classes to generate the UML structure. It generates a model containing the classes with attributes, associations, inheritance, etc.

uml diagram generation java
Reverse Java repository from the GenMyModel dashboard
uml diagram generation java
Configurating model generation from Square Picasso project

After opening the model in the editor, you can drag and drop the elements from the project explorer to the diagramming zone:

Class diagram with 2 classes dragged and dropped from the project explorer
Class diagram with 2 classes dragged and dropped from the project explorer

 

Read more and give it a try: getting started, documentation.

Notifications

Notifications are now pushed into the dashboard for providing useful information regarding your activity and your projects. The notifications are displayed at the top-right corner of the dashboard when:

  • you are shared a project
  • you’ve been removed from a project
  • you generate UML models from code. Reversing a Java repository can take minutes and the process runs asynchronously in the background. You’re notified whatever the process outputs.
uml notifications
Notification panel in the dashboard

More notifications will be added over time.

Diagram coloring

The new coloring feature enables you to group objects together and have a clearer overview. Color settings in your diagrams are preserved when generating images and PDF reports:

uml diagram color
Class diagram coloring

Click an element in the diagramming zone and select the color in the property panel. You can also type your own HTML color:

uml-diagram-palette
Color setting in the property panel

 

Sign in and check out the new features

 

We hope you enjoy the latest features! Vote for the features you’d love in our UserVoice area.

Special Offer until November 30th

$
0
0

Good news: the special offer continues until November 30th.

If you subscribe to a GenMyModel paid plan before November 30th 2014, you will still benefit from 15% off normal subscription prices. Even better, you will benefit from this reduced price for as long as you keep a paid subscription (even if you change plans)! This discount applies to all monthly and yearly plans.

Paypal support has been available since a couple of days and many of you asked us to pursue the special offer. We are pleased to let you use Paypal and get the special offer until Nov 30th.

Early adopters

If you signed up to GenMyModel before October 5th, the special offer remains 25% off normal subscription prices.

ChangeLog November 7th 2014

$
0
0

As our sprint has just ended, we’re excited to announce what comes out: copy/paste, revision history, custom canvas size, class association in the class diagram, and the self-delegation in the sequence diagram. Want to see this in action? Sign in now.

Copy / paste

Copy and paste model elements to your diagrams. For the moment, elements cannot be pasted to another project.

We observe that ctrl C/V really helps for time savings. It has also been insanely time consuming to code it properly! Under the hood, it was challenging for the collaborative mode and because the diagrams must always be in-sync with the structured model behind.

copy paste
Pasted class: AdapterCopy

With an intense use of the shortcuts and copy/paste, create and modify diagrams in the time it takes for the sun’s light to reach us.

Revision history

You can now view and restore the last 3 versions of your project. A revision is created for every work session, even collaborative. Setting tags on the chosen versions will also be possible soon. Notice that the revision history is available from the micro plan.

uml model history

TAB power

It’s now possible to jump from the elements of the diagrams using the “TAB” key. The selector jumps from one element to the next one following (x,y) order. For example, It makes the setting of types easier . Here’s how you get a typed attribute within a mouse click:

  1. From a class, create an attribute using the shortcut ‘a’
  2. Rename the attribute
  3. Press TAB
  4. Select its type (the mouse click is here)
uml attribute
Use TAB to jump from attribute name to type

Canvas resizing

Choose the canvas size that best suits your diagram contents. Access the menu using a right click on your diagram. Easy and useful. A resize handle is in the pipeline.

genmymodel uml canvas

uml diagram size
Canvas size setting popup

Class associations

The association class joins the toolbar. An association class designates an association that has class-like properties, such as attributes, operations, and other associations. It is used to model an association as a class.

 

uml class association
UML class association example

 

As an example, consider a many-to-many association between classes Person and Company. The association could have properties; e.g., salary, jobClassification, startDate, etc. In this case, the association is more correctly modeled as an association class with attributes rather than trying to fold the attributes into one of the classes in the association.

Self delegation in sequence diagrams

In the sequence diagram, self-delegation is used when a message is sent by an object to itself. Create a Call from the toolbar over an Execution, the arrow targets the object itself by default.

uml sequence self delegation

 

Want to see this in action? Sign in now.

Hopefully you’ll enjoy these new tricks. Vote for the next ones in our UserVoice area.

Introducing the GenMyModel code template editor

$
0
0

We are excited to unveil the code template editor in GenMyModel.

It’s now possible to create, modify and share Acceleo templates that generate code from your online diagrams. For example, you can design a code template that takes your class diagram and produces your REST API interfaces. Or it could just be your snippet generator. You decide what you generate and everything happens in the browser. The online editor relies on the Acceleo syntax (propulsed by Obeo) and provides live compilation, error checking, syntax coloring, auto-completion, generation preview and run.

Sign in and check this out

How does it work?

In the application, a new panel ‘Generators’ lists the available generators. The template editor opens a new tab next to your diagrams :

code generator online overview

The template editor is a Model-to-Text editor. It’s based on Acceleo (an implementation of the Object Management Group MOF Model to Text Language standard) syntax. Basically, a Acceleo template takes a model and writes text in files following its translation rules. The following template takes a UML model as an input and generates one text file per class. It browses the model and fills the generated text files with the class attributes. Here’s the rendering of the template in the editor:

code generator template

Given the following class diagram:

code generator diagram

You can get a preview of the generated code: two files Account.txt and User.txt with the details of their attributes:

code generator example

You can copy/paste the generated code. The configuration panel also enables you to generate a zip archive or push the generated files to your Git repository:

code generator configuration

Template library

GenMyModel provides several templates for Java, C#, SQL, C++, PHP, Ruby and Python. You can customize them all. The Pro plan lets you share your template within your organization / team.

code generator library

You’d like to add a template in our libray to make it available for everyone? Submit it here.

Why generating code online?

You may already have evaluated the time spent coding dumb code. Unit test signatures, configuration files, framework-dependent code, etc: we spend hours every week writing dumb code. We’re all aware of it. The fact is that we usually design our architecture, domain models,etc and the resulting diagrams just remain documentation. The GenMyModel template editor lets you take advantage of the design models you create by producing the tedious parts of your applications. It helps you focus on hard stuff and coding exploits. You don’t let a generator replace your programming style, you design it to generate what you want.

Acceleo

Acceleo uses a template based approach. With this approach, a template is a text containing dedicated part where the text will be computed from elements provided by the inputs models. Those dedicated parts are most of the time expressions specified on the entity of the input models used to select and extract information from those models. For more information, see the Acceleo support page.

mtl template in genmymodel

Sign in and check this out

We love your feedback. There might be things to improve. Feel free to contact us for any questions or suggestions. Enjoy!

Online Python code generator

$
0
0

We recently introduced the online code template editor in GenMyModel for creating  your own templates which generate code from your diagrams.

The editor is a full-featured MTL tool runing in the browser. Below are a few snapshots and details about the Python template of our library. In our sample library, the Python template produces the classes, attributes, inheritance relations, etc from the class diagrams. The template takes a UML model, browses its elements and translates the elements into code. The template is written in the standard MTL syntax (like Acceleo) and can easily be customized.

Provide input UML Class Diagram

The Python generator takes a UML class diagram as an input.

code generator python diagram

Preview the generated code

Open the simpleUML2Python template from the generator panel on the left and click ‘Preview’. The generated files are automatically opened on the right:

code generator python template

When generating from our your class diagram above, you end up with a single model.py file as there’s only one package.

python code

Customize the template

The simpleUML2Python template is composed of 6 template rules. Each rule deals with one UML element type and each time this element type is found in the input model it outputs the corresponding code.

code generator python view

[template public generate(m : Package)]

For each package found in the input model, it produces a Python file having the package name.

[template public generate(m : Class)]

For each package found in the input model, it produces a Python file having the package name.

[template public generate(m : Property)]

Set a default value for each attribute.

[template public generate(m : Interface)]
[template public generate(m : Operation)] 
[template public generate(m : Enumeration)] 
[template public generate(m : Enumeration)]

We’ll add more stuff here soon. As always, we’d love to hear what you think! Please reach out here or on Twitter, Facebook and UserVoice.


Introducing the Database Model Editor

$
0
0

Our team is happy to unveil the new Database Diagram Editor in GenMyModel. It enables you to design databases online with the power of real-time collaboration and code generation. The data modeling editor completes the GenMyModel modeling platform which now covers a wide spectrum of diagrams: ER, UML, Flowchart and EMF. As a full-featured collaborative platform in the browser, GenMyModel is now at the center of software design in agile teams.

Sketch a big picture of your system design

The database editor enables you to design database models at the tables and references level. From the GenMyModel dashboard, start a new project and select the database diagram type:

design database online

Edit your model in a single window and save time using keyboard shortcuts (To see all the keyboard shortcuts just press ?) and the Copy – Paste feature. The editor validates your model all the time:

database online diagram

The project explorer presents the tree structure of your design model:

database model properties

Some elements of a database model have a complex structure. The panel properties lets you set all custom values:

database online diagram properties  

Work together in real-time GenMyModel helps you collaborate efficiently with the Google Drive-style collaborative mode.

You can share your database model and work together in real-time with no lock or constraints. All collaborators see the changes occurring in real-time:

database model real-time collaboration

Generate SQL and customize the generator

At any time you can generate a SQL script that creates all elements in your database. GenMyModel checks your database model before SQL generation and notifies you of any errors or warnings.

database diagram sql generator

The SQL generator can be entirely customized with the template editor:

database model sql generation

Generated SQL scripts can also be pushed to your Git repository.

Try the editor now >

GenMyModel platform now acts as an information hub to share the core data definitions, business rules, and data structures across your team and organization!

Model Scripting in your Browser: Introducing CatsooLang

$
0
0

A new Domain Specific Language (DSL) built to give you the ability to modify and query your models from your browser, directly in GenMyModel.

Who does not want to query or modify her/his model? Do you ever tell to yourself after a modification in your model: “Damn, I need to postfix all my 50 Classes with ‘DAO’…”? Or “I must add an attribute to all my classes… It’s gonna take forever”. If you don’t, well… lucky you, I asked myself this kind of questions many times a day.

Query/Refactor Your Model with CatsooLang

Model query is usually made using Object Constraint Language (OCL). If you want to know more about OCL, I strongly suggest you to read the Object Constraint Language (OCL): a Definitive Guide by Jordi Cabot and Martin Gogolla. This language is often used as basis for model to model transformation language (QVT, ATL…) and model to text transformation (Acceleo…). OCL is a static typed language and is very powerful but sometimes you only want to quickly interpret a simple query without thinking about type casting or without thinking about how to create a simple reusable function which will modify your model or create your model in a textual way.

As an answer, the GenMyModel team presents you the Catsoo Model Scripting Language (CatsooLang) and the CatsooLang terminal, a model scripting language interpreted in the browser. This language is dynamically typed, support ad-hoc polymorphism and support imperative and sort of functional programming style. CatsooLang is integrated in GenMyModel using an interactive console (the CatsooLang terminal) in which you can type your CatsooLang expressions.

What does it look like?

Its syntax is close to OCL with some ideas taken from QVT. It’s is a mix between imperative and functional programming language. Here is a query example:

var classes := __ROOT objects()[uml::Class]->select(e | e.ownedAttribute <> []);

This fragment will put in the variable classes all the Class from your model having attributes. You can read it this way: ‘From the root of my model, get all the elements and keep the classes.Then, from this collection, select the classes which have a non empty collection of attributes’.

Want more? Here’s a model fragment creation:

var newclass := create uml::Class{name := 'MyNewClass'; isAbstract := true};

This fragment will create a new abstract class named ‘MyNewClass’ but does not attach it to your model yet.

As you can see, CatsooLang is a low level language (understand: ‘you can modify each single feature of your model regarding its metamodel’) but it comes with various libraries that will help you to easily handle/modify/create your model. You can reach a work in progress documentation at this adress: CatsooLang Documentation about language features (function call, function creation, model navigation…).

Can I try it in GenMyModel?

Sure! Since few weeks, you probably noticed there is a new bad ass layout for the GenMyModel editor which uses docks. If you look closely, you can see that a dock has been added in the bottom left of your screen: Terminal tab. If you gently click on it, the CatsooLang terminal will gently open.

CatsooLang Terminal

This terminal is equivalent to Python, Lua, OCaml, you_name_it interactive console, you can directly write your CatsooLang expression in there and wait for the result. Here is what happens if you type the expressions presented above on a UML class diagram in GenMyModel (notice the use of the log(...) keyword):

Catsoo Expression Evaluation on UML Models

You can also try these codes on other UML models (e.g., on this class diagram), feel free to browse and fork models from our model repository.

Design Faster?

Sometimes, it can become handy to have a bunch of functions on the shelf that can be used in order to easily create big inheritance trees, to rename all model elements or to generate getter/setter for all your attributes in one line. To sum up, you can define a lot of refactoring functions in CatsooLang. Some are already coded and available in predefined libraries. Later on, we will explain you how to tame this language and how to get the most out of it for more productivity. We’ll give a few hints on how to provide your own scripts and share them with all your teammates.

To conclude this post, here is a tip for you: the terminal is embedded with a bunch of shortcuts (more or less the same you have in a UNIX/Linux terminal), use them to type and edit your CatsooLang expressions faster. Also, we could work on smart auto-completion. If you are interested, let us know!

General Keyboard Shortcuts
==========================

* CTRL + SHIFT + h     Displays this help
* ENTER                Evaluates the current line
* SHIFT + ENTER        Inserts a new line at cursor position
* UP                   Selects previous entry from history
* CTRL + UP            Selects previous entry from history (skips multi-lines)
* DOWN                 Selects next entry from history
* CTRL + DOWN          Selects next entry from history (skips multi-lines)
* CTRL + l             Clears shell screen
* CTRL + a             Moves the cursor to the begining of the line
* CTRL + e             Moves the cursor to the end of the line
* CTRL + f             Moves the cursor to the right
* CTRL + b             Moves the cursor to the left
* CTRL + k             Cuts the line from the cursor position to the end of the line
* CTRL + u             Cuts the line from the cursor position to the beginning of the line
* CTRL + y             Pastes the previously cut line at cursor position
* CTRL + j             Evaluates the current line (same effect than ENTER)
* CTRL + d             Deletes the character to the right of cursor
* CTRL + h             Deletes the character to the left of cursor

CatsooLang Keyboard Shortcuts
=============================

* CTRL + i       Wraps current instruction into a 'log();' instruction and sets the cursor position before the last bracket
* CTRL + s       Inserts a 'select' instruction at cursor position
* CTRL + r       Inserts a 'reject' instruction at cursor position

CatsooLang Documentation
========================

There is some commands relative to the terminal only
'help'         Displays this screen
'history'      Displays all the command written in the terminal since the session beginning
'#sandbox-on'  Enables sandbox mode (safe-mode)
'#sandbox-off' Disables sandbox mode (safe-mode)

Love,

Build your own PHP generator from UML online using Acceleo – Part 1

$
0
0

A comprehensive journey into the deep wild code generator world. Part 1, translating class diagram structure: Class, Interface, class inheritance and interface realization to PHP code.

In this series of articles, we will teach you step-by-step how to build with your bare hands a UML to PHP generator. Each time, we will detail: Acceleo code, the identified UML model fragments and how everything is put together. With the keys you will get in these articles, you should be able to code your generator for any language in no time.

Developing code generators in GenMyModel – Tools

As you know, the GenMyModel editor enables you to create online models (UML, Database, Flowchart, BPMN), share them and edit them collaboratively. GenMyModel also gives you the ability to generate code from your class diagram to Java, Java-JPA, SQL… using existing code generators. You can also create your own Acceleo generator and code it directly in you browser by using the GenMyModel MTL Editor.

This editor provides syntax highlighting, smart autocompletion and type checking. During the code/test process, the MTL editor delegates Acceleo/MTL script compilation and execution to our servers whereas the smart autocompletion and the type checking are performed in your browser. Finally, one of the most useful feature of the MTL editor is the preview mode which gives you a quick feedback about the files generated by your script.

In order to write and test your generator, the process that we will apply is the following:

  1. script creation,
  2. small model creation (only few elements for testing purposes),
  3. script coding,
  4. preview.

Obviously, points 3. and 4. will be repeated all along the development process.

Note for impatient people: you can get the full example code of this first article and use it on a very simple class diagram.

Setup your environment

First thing first, we’re going to create a new code generator and a new UML model. I assume you already know how to create a GenMyModel UML project and you have opened it in the GenMyModel model editor. Now, click on the Generator tab on the top left of your model editor, the generator management view will open:

Code Generator Management

Click on the +, a new tab named newgenerator will open in your main dock with code in it. As you can see, everything is integrated into the editor:

New Online Empty Generator

Let’s try it! Click on Preview and wait for the result. At this point your code is compiled and executed on our server, using your current project as input model.

If your model is empty (no Class/Interface…), a Result report should pop up with a beautiful warning message saying:

No generated file:
    Did you forget to create '[file' block or to call the template which contains it/them?

Here is a translation “Hey! I’m the server, your code compiled fine but when I ran your code, I was unable to produce files. Don’t you forget to ask for files creations?”. That’s obvious that no files were generated as our model is empty. At the moment, don’t look at the existing code, we will detail it later. Up to now, change your generator name:

  1. click on Configuration,
  2. change your generator name from newgenerator to PHP,
  3. click on Update,
  4. go back to your script and in the first line, change newgenerator to PHP, the first line should now looks like this: [module PHP('http://www.eclipse.org/uml2/4.0.0/UML')/]
  5. hit CTRL + s in order to save modifications performed on your script.

Before we jump into code, we have to create elements in our model to test the script. Go to your diagram and draw 2 classes and 2 interfaces so it looks like this:

UML diagram for PHP Code Generator

We have two classes, A (which is abstract) and B with an inheritance relation between B and A. Two interfaces C and D with an inheritance relation between C and D. Finally class A implements C interface.

CatsooLang Tip

If you are lazy like me, you can use the CatsooLang terminal to create your model: first open your terminal, type:

#import 'UML'

and wait for the CatsooLang UML module loading. Then, copy/paste/enter the script below (If you want to learn more about CatsooLang, try the documentation).

__ROOT _uml_cInterface('D', 100, 100);
__ROOT _uml_cInterface('C', 100, 200) _uml_inherits(D);
__ROOT _uml_cClass('A', 270, 180){isAbstract := true} _uml_implements(C);
__ROOT _uml_cClass('B', 270, 300) _uml_inherits(A);

We are now ready to begin our trip to Acceleo.

Understand the current Acceleo script

When you create a new generator, the file comes with a kind of hello word script. It is minimal and allows you to get a first idea of what an Acceleo script looks like. Here are some explanations about what it does:

Line 1. this is the module name definition and the metamodel of the input model. In our case the input metamodel is UML: 'http://www.eclipse.org/uml2/4.0.0/UML'.

Line 3. defines a template called generate which can be applied on Class elements. The general syntax for template is [template _visibility_ _tname_(_args_)]...[/template] where _visibility_ can be private or public. If you don’t remember template syntax, you can access code snippets using CTRL + SPACE.

Line 4. defines that this template is the main entry point. In GenMyModel, your main entry points (yes, entry point_S_) MUST be named generate.

Line 5. defines a file block which creates files named after the input class name concatenated with .txt (c.name + '.txt') in an UTF-8 format.

Line 6. is the text which will be written in the generated file. All text written in between [file...][/file] tags is written in the generated file. Each code written between [.../] will be interpreted and the result of the expression will be written in the generated file. So, what does this line 6. means? Easy, “write ‘#Hello world from’ in the file then write the class name”.

That’s all for this code fragment. As you see, Acceleo and OCL are quite verbose language, but they are quite easy to read.

PHP generator strategy

There are many ways for organizing PHP classes: many classes/interfaces per file or one class/interface per file. It depends on what you want, you can apply one strategy or another, it is up to you. In this series of articles, we are going to assume that each class/interface will be generated in its own file.

Generate PHP Classes

Finally… we are going to write a template for PHP Class code generation \o/

So, we are going to modify the existing generate template. Each file must be now named after the class name postfixed by .php instead of .txt. The line 5. is modified as this:

[file (c.name + '.php', false, 'UTF-8')]

If we launch a Preview of our modified script, two tabs named ‘A.phpandB.php` should appear. Not bad!

Now lets modify the template contents. Instead of # Hello... we want our PHP class code. The template becomes:

[template public generate(c : Class)]
[comment @main/]
[file (c.name + '.php', false, 'UTF-8')]
<?php

    class [c.name/]
    {

    }

?>
[/file]
[/template]

Hit the Preview button once again. Behold your generated code:

PHP Generated Code Preview

Great, this is your first generated PHP code!

But the A class is abstract in our input model… It should also be abstract in the PHP code. So, the question here is how can we gain access to this information? There is two main ways of doing this without leaving your browser and GenMyModel:

  1. You can type [c. and use smart auto-completion to look through the attribute you can access. Then, you can search for attribute that sounds good (names are pretty explicit so you should find them easily).
  2. You can use the CatsooLang terminal to question your model.

We will take the second option here. Open the CatsooLang terminal and type introspect(Class);, this command will ask the Class metaclass from the UML metamodel to display its attributes (result is quite verbose):

cl> introspect(Class);
-= Super types =-
  [EncapsulatedClassifier, BehavioredClassifier]

-= Attributes =-
  ...      <-- bunch of attributes here
  inheritedMember : NamedElement [0..*] - READONLY
  isAbstract : Boolean [1..1]
  isFinalSpecialization : Boolean [1..1]
  ...      <-- bunch of attributes here

From the displayed attribute, the isAbstract one sounds interesting. Let’s test it in the terminal on A and B:

cl> log(A.isAbstract);
true

cl> log(B.isAbstract);
false

Yep, that’s it, isAbstract is the attribute we are looking for. If this attribute is true, it means the class is abstract. Thus, the strategy is the following: if the isAbstract attribute is true, then we will write abstract in the file. You can easily write this “strategy” in Acceleo by using [if (...)] [/if] tags. Our request becomes: [if (c.isAbstract)]abstract [/if] and our template now looks like this:

[template public generate(c : Class)]
[comment @main/]
[file (c.name + '.php', false, 'UTF-8')]
<?php

    [if (c.isAbstract)]abstract [/if]class [c.name/]
    {

    }

?>
[/file]
[/template]

Running a Preview gives us:

<?php

    abstract class A
    {

    }

?>

That’s what we wanted. Now, we are going to translate class inheritance. This point is a little bit more complex because we have to understand how inheritance is built in UML. Let’s take a look to the model tree in CatsooLang terminal:

cl> tree(__ROOT);
+- Model 'model' [-]
|  +- (PackageImport, 10144) [packageImport]
|  +- (PackageImport, 10145) [packageImport]
|  +- Class 'A' [packagedElement]
|  |  +- InterfaceRealization 'null' [interfaceRealization]
|  +- Class 'B' [packagedElement]
|  |  +- (Generalization, 10139) [generalization]
|  +- Interface 'C' [packagedElement]
|  |  +- (Generalization, 10140) [generalization]
|  +- Interface 'D' [packagedElement]

As we can see, the B class contains a Generalization. Moreover, the tree(...) command shows us that you can access this Generalization from B using the generalization attribute. If we try to look into here what we found:

cl> introspect(Generalization);
-= Super types =-
  [DirectedRelationship]

-= Attributes =-
  eAnnotations : EAnnotation [0..*]
  ownedComment : Comment [0..*]
  ownedElement : Element [0..*] - READONLY
  owner : Element [0..1] - READONLY
  relatedElement : Element [1..*] - READONLY
  source : Element [1..*] - READONLY
  target : Element [1..*] - READONLY
  general : Classifier [1..1]          <-- sounds good, but is Class instance a Classifier?
  generalizationSet : GeneralizationSet [0..*]
  isSubstitutable : Boolean [0..1]
  specific : Classifier [1..1]

cl> log(B isKindOf(Classifier));
true

cl> log(B.generalization.general);
[CL_EOBJECT(Class, A, 11045)]  <-- sweet

cl> type(B.generalization.general.name);
'Collection: [String: A]

In UML, Generalization elements represent an inheritance relation between two objects. The object that contains the Generalization is the object that inherits from another object.

We can now use this information. We know that we can access a collection of name by navigation. So if the collection is not empty, we will simply write extends in the file, followed by the name contained in the collection. In Acceleo, here is the code: [if (c.generalization->notEmpty())] extends [c.generalization.general.name/][/if]

We add this Acceleo request to our template:

[template public generate(c : Class)]
[comment @main/]
[file (c.name + '.php', false, 'UTF-8')]
<?php

[if (c.isAbstract)]abstract [/if]class [c.name/][if (c.generalization->notEmpty())] extends [c.generalization.general.name/][/if]
{

}

?>
[/file]
[/template]

And we get:

<?php

    class B extends A
    {

    }

?>

Victory! With a simialar idea, we now tame the interface realizations. Beware, the template line will be very, very long (I told you it is a verbose language). I cut to the chase and give you the CatsooLang request result:

cl> type(A.interfaceRealization.contract);
'Collection: [CL_EOBJECT(Interface, C, 13131)]

The line is almost the same as the one for inheritance BUT there is a twist: this time, we want to put a , between each interface the class implements. Using the CatsooLang information, the Acceleo line is:

[if (c.interfaceRealization->notEmpty())] implements [c.interfaceRealization.contract.name->sep(', ')/][/if]

and our generate template becomes:

[template public generate(c : Class)]
[comment @main/]
[file (c.name + '.php', false, 'UTF-8')]
<?php

[if (c.isAbstract)]abstract [/if]class [c.name/][if (c.generalization->notEmpty())] extends [c.generalization.general.name/][/if][if (c.interfaceRealization->notEmpty())] implements [c.interfaceRealization.contract.name->sep(', ')/][/if]
{
    [comment Told you the line will be very long/]
}

?>
[/file]
[/template]

and the result for A class (Yeaaaay \o/):

<?php

    abstract class A implements C
    {

    }

?>

Generate PHP Interfaces

The generation process for Interface is almost the same as the one for Class. The only differences are that an Interface cannot implement another Interface and abstract Interface does not exist. Here is the template for Interface:

[template public generate(i : Interface)]
[comment @main/]
[file (i.name + '.php', false, 'UTF-8')]
<?php

    interface [i.name/][if (i.generalization->notEmpty())] extends [i.generalization.general.name/][/if]
    {

    }

?>
[/file]
[/template]

The only thing that should bother you is the [comment @main/]. With the one in the generate template for Class, our PHP generator has now two main entry points. Is that possible in Acceleo? Short answer, yes. You can put as many entry points as you want, they all will be evaluated against your input model.

And that’s all for Class and Interface.

 Is anything missing?

The careful readers and PHP enthusiasts should be boiling at this point: “What about includes? You extend classes, implement interfaces but no includes? Burn him!”.

So, how to deal with include? Pretty much the same way we dealt with inheritance and interface implementations:

  • In Class context, if the generalization collection is not empty, we generate an include and for each element of interfaceRealization collection, we generate and include.
  • In Interface context, if the generalization collection is not empty, we generate an include.

Here is the code for inherited class inclusion in Class context (in Interface context, the code is the same, except variable i is used instead of c):

[if (c.generalization->notEmpty())]require_once("[c.generalization.general.name/].php");[/if]

And here is the code for interface realizations:

[for (s : String | c.interfaceRealization.contract.name)]
require_once("[s/].php");
[/for]

This time we used [for (...)][/for] tags. The for block enables us to iterate on each element of a collection and to do something with this element. In our case, we iterate on each name of the implemented interfaces and we write the require_once(...) code into the generated file.

Finally, here is the generate template for Class with all the fragments:

[template public generate(c : Class)]
[comment @main/]
[file (c.name + '.php', false, 'UTF-8')]
<?php
    [if (c.generalization->notEmpty())]require_once("[c.generalization.general.name/].php");[/if]
    [for (s : String | c.interfaceRealization.contract.name)]
    require_once("[s/].php");
    [/for]

    [if (c.isAbstract)]abstract [/if]class [c.name/][if (c.generalization->notEmpty())] extends [c.generalization.general.name/][/if][if (c.interfaceRealization->notEmpty())] implements [c.interfaceRealization.contract.name->sep(', ')/][/if]
    {

    }

?>
[/file]
[/template]

and here is the generated PHP code for B class:

<?php
    require_once("A.php");

    class B extends A
    {

    }

?>

To sum up

The language used to write our code generator is Acceleo and the language we used to question the model is CatsooLang. We saw many things:

  • how to search information in UML metamodel using CatsooLang,
  • how inheritances and interfaces realizations are managed in UML,
  • if, for, file blocks and template definitions in Acceleo.

At the end of this article, your generator should generate code for classes, interfaces and it manages class/interface inheritance and class interface implementations.

What’s next?

As you probably imagine, there are numerous ways for accessing model elements and generating text in Acceleo. In further articles, we will show you advanced tips to improve your generator speed.

Well, this is a goodbye, but let us meet again for the part 2. This time, we will discuss about UML packages and enumerations. I’m sure you guess that we will have to discuss a lot about generation strategies.

If you have any question, feel free to comment this post!

Love,

Generate SQL from Java-JPA, usage in UML to SQL generator

$
0
0

You have some Java-JPA code and you want to generate a SQL schema? Or you wonder how GenMyModel generates from UML to SQL? Read on this practical post to find out more.

Java-JPA to SQL ?

JPA annotations are very useful to introduce a new abstraction from SQL to Java. Defining and handling Java entities mapped to SQL entities becomes very easy because of the level of information embedded in your Java code. And what if this information was used to generate your SQL schema? I would be pretty sweet isn’t it?

Well you and me are not the first to think about it. Developers already addressed this issue and wrote a Maven plugin to deal with this. The idea is simple but very effective: your annotated Java code is compiled and executed. During code execution, your database schema is created from the JPA annotations embedded in your Java code, then the maven artifact exports the created schema in a file.

Use your JPA annotations with Maven

There are many artifacts that generate SQL schemas from annotated sources. In this article, we are dealing with Hibernate 3 maven plugin. Here is an example with version 2.2. Of course, you must have a maven Java-JPA project, here is part of the pom.xml relative to the maven plugin inclusion:

<?xml version="1.0" encoding="UTF-8"?>
<project ...>
     ...
   <build>
    <plugins>
      <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>hibernate3-maven-plugin</artifactId>
            <version>2.2</version>
        <configuration>
          <components>
            <component>
              <name>hbm2ddl</name>
              <implementation>jpaconfiguration</implementation>
            </component>
          </components>
          <componentProperties>
            <outputfilename>schema.ddl</outputfilename>  <-- put here schema file name
            <format>true</format>
          </componentProperties>
        </configuration>
        <dependencies>
          <dependency>
              <groupId>org.hsqldb</groupId>
              <artifactId>hsqldb</artifactId>
              <version>2.2.9</version>
          </dependency>
          <dependency>
              <groupId>org.hibernate</groupId>
              <artifactId>hibernate-entitymanager</artifactId>
              <version>3.5.3-Final</version>
          </dependency>
          <dependency>
              <groupId>org.hibernate</groupId>
              <artifactId>hibernate-core</artifactId>
              <version>3.5.3-Final</version>
          </dependency>
        </dependencies>
      </plugin>
    </plugins>
  </build>
</project>

And obviously, you have to fill your persistence.xml:

<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">

<persistence-unit name="_my_unit_name_Unit" transaction-type="RESOURCE_LOCAL">
    <provider>org.hibernate.ejb.HibernatePersistence</provider>
    <class>...</class>  -+
    <class>...</class>   |  Put here your entity class definition
    <class>...</class>  -+
       ...
    <properties>
      <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
      <property name="hibernate.connection.url" value="jdbc:hsqldb:mem:spring"/>
      <property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver"/>
      <property name="hibernate.connection.username" value="_my_user_name_"/>
      <property name="hibernate.connection.password" value="_my_pass_"/>
      <property name="hibernate.hbm2ddl.auto" value="create-drop"/>
    </properties>
</persistence-unit>

Finally, the only things to do is to call the maven plugin:

mvn compile hibernate3:hbm2ddl

And voilà, your SQL schema is generated. This is as simple as that.

Cool… And what about GenMyModel?

As you probably know, GenMyModel is shipped with a UML to SQL generator that takes UML classes for SQL generation. Unlike traditional UML to SQL approaches which directly translate class diagrams to SQL, GenMyModel uses JPA annotations in order to give your more freedom in your diagram design.

Traditional UML2SQL generators use a small subset of the class diagram as input model. Unfortunately, you often cannot use class inheritance of class abstraction because translating class inheritance in SQL is not an easy task. Consequently, the code generator becomes difficult to maintain and to understand.

In GenMyModel, we wanted to more flexibility for designing their class diagrams. Class abstraction and class inheritance had to be handled by the generator so it can break the classical constraints implied by a direct translation from UML to SQL. Obviously, we had to go to the drawing board and the first results were not very conclusive (you should have seen them… but folks, that was thinking/testing time). We went back to the drawing board once again when we reached the UML2SQL enlightenment. The solution was right under our noses, we only had to use the JPA to SQL schema generation. Think about it:

  1. UML to Java is a tamed code generation.
  2. You already know how to deal with inheritance.
  3. Abstract classes? Easy-peasy.
  4. UML associations give us all the information we need about cardinality.

Finally, this is the strategy we have chosen and without the last generation pass, we have a UML to Java-JPA code generator – two for the price of one – not bad :) ! The final generation flow is the following:

UML -> Java-JPA -> SQL

It looks like a simple yet effective MDE approach isn’t it? This generator is quickly accessible using right-click on your diagram, then Direct Generation -> SQL (do not confuse it with the one available in the generator panel, this one does not use JPA as intermediate representation):

UML to SQL Generator Menu

The counterpart to this solution is that we have to generate a fully compilable Java-JPA code. In addition, we still have to find the correct way to deal with interfaces. Perhaps you have a solution?

Any tips or plugins you use to generate your SQL schema from your code? Feel free to share your tricks with every one, any comment is welcome.

Love,

The GenMyModel online BPMN editor is out!

$
0
0

As you may have noticed, it’s been a few week since we released a major new release and we’d like to let you know more about it. You can now create a BPMN process online with GenMyModel! So let’s take a few minutes to discover it.

Create your BPMN project

To create a new BPMN project from your dashboard, go to new project and select the BPMN2 model type:

Create a new BPMN project

As you can see, you can choose to create either a collaboration or a process diagram by default.

What’s the difference between process and collaboration diagrams?

A BPMN process diagram describes just one process meaning a sequence or flow of activities in an organization. A BPMN collaboration diagram shows two or more processes and interactions (message flows) between each process.

If you prefer you can also clone an existing project from our BPMN process examples. Select the project you want to clone and click the green button Fork this project.

BPMN2 compliant processes

Like always, we are following the OMG specification (Business Process Model and Notation). It means that GenMyModel stores the BPMN models using a standard format. Thereby you can export and import BPMN2 diagrams to BPMN process tool like Eclipse BPMN2 Modeler, Bonitasoft, BPMN Web Modeler or any other one that supports the standard BPMN2 format.

How to export my model to BPMN2 format?

In the BPMN editor, right click the canvas and select export as BPMN or go to the menu tools/export as BPMN2.

  • Export as BPMN from the context menu
  • Export as BPMN from the menu

You obtain a XML file which matches the BPMN2 specification of OMG.

BPMN tools

For a better user experience, we have improved our toolbar with a grouping feature. For example, all task tools are grouped together as you can see on this screenshot:

BPMN new toolbar

Of course, shortcuts are available for most of the tools (type ? to show all shortcuts in the editor).

What’s next?

Note that this is just the first version of our online BPMN editor and new features will be added in the future. Some of the features we are planning so far:

  • BPMN2 diagram import to GenMyModel (under development).
  • Ability to change the type of tasks, events and gateways (e.g change a user task to service task).
  • Enable pool creations or process diagrams from an existing process.

As usual, we are opened to any ideas that you might have to improve your favorite modelling tool. So don’t hesitate to give us your feedback about this new release in the comments or in our forums.

GenMyModel, finally available on GameBoy™!

$
0
0

At GenMyModel we aim at making you more productive. We give you the ability to model BPMN, UML, Flowcharts and more any place, any time. You just login and start modeling right from your browser on any device, with no installation.

We decided to push it one step further by making GenMyModel available… on the Original Nintendo GameBoy™.

Why choosing the GameBoy™?

We had to think of a device, familiar, fun to use and easy to carry.

With its light weight of 400g, its impressive 4 shades of grey (better than 50!), and an outstanding 10 hours battery life (on four AA batteries), the Nintendo GameBoy™ was an ideal choice!

What does it looks like?

Checkout this gorgeous interface taking full advantage of the graphic capabilities of this next-gen console:

 

  • GenMyModel online bpmn uml tool console
  • GenMyModel online bpmn uml tool

 

What features do we support?

After months of hard work, our engineering team managed to make all the features you love available on the GameBoy™

  • UML, BPMN, Flowchart, Database and EMF Modeling
  • Real-time collaboration using the Game-Link™ cable
  • Code Generation
  • Export and print your diagrams on the Game Boy Printer™
  • Coloring elements in an outstanding 4 shades of grey

How do I get it?

GenMyModel for GameBoy™ is available today, April 1st 2015 in all major stores across the globe.

If you can’t find it anywhere, just send us a quick request at team@genmymodel.com, and we will send it to you by mail.

So leave your pricey smartphones, tablets, and computers and start enjoying GenMyModel on your beloved GameBoy™ today.

Discover the revision history in your GenMyModel projects

$
0
0

Our team is happy to unveil the revision history in GenMyModel.

When can you use the revision history?

You can use the history revision when you want to:

  • see missed changes on your diagrams since you logged out
  • revert your diagram to an older version
  • find out who has modified your work

Your work is safe with the diagram revision history

With the revision history, you can now replay all changes made on your diagrams (UML, Flowchart, RDS, BPMN…) by you and your collaborators. You can watch changes play live by pressing the play button just like a video. A progress bar enables you to navigate in revisions using a cursor.

By default, GenMyModel sets a tag every 100 commands made on your diagrams. A command is a minimal change in your diagram (move, creation, etc.). Only the last 3 tags are saved in our databases meaning you can restore your diagram up to 300 past commands.

How to display the history?

To launch the revision history player, just click the “history” button at the top-right corner of the editor.

Display more information about a change

Put your mouse cursor over the progress bar. You will see who has made the change and when.

Tags

The blue pins correspond to the tags that are automatically created by GenMyModel. Those tags are created every 100 changes. Other tags exist like the revision tag which is created when you revert your diagram to an older version.

What’s next?

Manual setting of revision tags is on the roadmap. It implies a refactoring of our command storage management system and it should be available in late Q2 or Q3. Stay in touch!


Top 5 Design Patterns gathered in one UML Class Diagram

$
0
0

According to software architects, design patterns are everywhere, you probably use them without knowing it. There is a lot of article dealing with those and their usage in very simple contexts. They are presented as small examples without connection between them. In this article, we propose 5 design patterns in a bigger picture.

Design patterns can sometimes look like voodoo magic: depending on the language you use, the implementation can be very different. However at high level, everything sounds more clear: diagrams help a lot to understand things (you cannot deny this). So, we took a practical case and we decided we could explain each design patterns you can find in it to you. Each design pattern is detailed with links to more academic definitions. Please consider this as a practical and illustrated example about the design/conception of a computer (we assumed everybody knows that).

5 design patterns in a UML class diagram

When we designed our computer, we assumed that:

  • a computer is made of a processor, a memory and potentials additional cards (sound…etc),
  • a processor is either a CPU either an accelerator card that will add behavior to an existing CPU,
  • a processor must be init (as well as accelerator cards) and has the ability to read/write from/in memory, to load a program to an address and execute it.
  • a memory can be either a RAM or a cache,
  • a cache is always dealing with a RAM,
  • if a cache exists it is primarily questioned by the processor,
  • a computer can directly handle up to 3 additional cards,
  • in order to handle new cards, a computer must have an extension board,
  • many sounds cards with different behaviors exist.

The solution we came up with is the following (we remove some parts):

UML Class diagram of computer components

You can find the full uml class diagram here, clone it and modify it as you please. In this diagram, we colored the different design patterns. That way, you should be able to easily identify the five of them.

The proxy pattern

First, let’s begin with a simple one: the proxy pattern. We use it to design the RAM/Cache elements.

Proxy design pattern in UML

Find the definition of this pattern here. The main idea behind this pattern is to use a middleman, which is exactly what happens when the processor needs to read something in memory. When the processor tries to read in Memory, it only performs a read(@) operation. If a Cache is present, the Cache looks inside the chunk of bytes it fetched. If the address is not there: it reads in RAM, fetches a new chunk of memory and gives the read byte to the processor. This flow is invisible to the Processor as the proxy gives access to the hid object when required. The proxy pattern has many usages (change few operations behavior, restrict operations visibility, lazy access to objects…) but the idea is always the same: a proxy is a kind of middleman.

Composite pattern

This pattern is really handy when you have to define recursive typed objects. Any guess about what part of the machine needs it?

Composite design pattern in UML

To see the full description of the pattern, go there. This time, we want to deal with composite recursion. Our computer can only manage 3 additional cards. However, it can use ExtensionBoard that will enable the use of other cards. Actually, this ExtensionBoard can contain and gather many Cards and, why not, other ExtensionBoard that will enable the computer to use other ones. Do you feel the recursive idea here? That’s what the composite pattern is made for.

Adapter pattern

Let’s stay in the Card and stuffs area of our computer to talk about SoundCards. Like I said in the introduction, many vendors design SoundCards for computers:

Adapter design pattern in UML

Having a choice about our SoundCard is nice. However, even they are on the same page about the way the card should work, they do not use a common interface and provide different operations that have almost the same semantics. In this context, the adapters are kind of socket converters that will wrap the vendor SoundCards and implement the common interface by delegating the behavior to the wrapped Card. For example, the Vendor2Adapter implements the end() method by delegating its execution to the halt() method of the Vendor2Sound element.

Decorator pattern

We detailed how the Memory and the additional Cards are handled by our computer. Now, we will concentrate on the Processor. Our processor can be get a boost by using AcceleratorCards. How did we modeled this?

Decorator design pattern in UML

To see the full description of the pattern, this time, go there. Our Processor has always and must always have the same behavior. But we would like to add new behavior to it without perturbing its original process. The decorator pattern is thus a great candidate. It adds additional behavior for the initialization phase and the execution phase. The implementation or the FastCard shows that when the init() method is called, the card first calls the additionalInit() method, then it calls the init() method of the CPU it decorates (ok, in this case, the difference between the proxy pattern and the decorator pattern is thin, by the way, some people call it ‘smart proxy’). The same thing is performed for the execute() method.

Facade pattern

Finally, the “main” pattern here, the facade pattern. This pattern is used here in the Machine element:

Facade pattern definition

Find this last pattern definition in this website. The main purpose of the facade pattern is to hide the complexity of a system by providing easy and comprehensible methods. In our case, the execute() method of the Machine Element enables us to execute a dedicated program. The way the program execution is performed is quite complex. The processor must be started as well as the additional cards. Then, the program that should be executed must be loaded and located in the memory at a specific address. The execute() method hides all this complexity by orchestrating all object instantiations/initializations and by adding all required magical values. This pattern is used almost all the time when complex systems need to be simply handled.

That’s all for these patterns, I hope you enjoyed your trip and be sure we will renew this kind of article.

Love,

Easily Import Most Common Java Types in your UML Project

$
0
0

This article is a tip: learn how to import common Java Types into your GenMyModel UML project. Part 3 explains how to create your own library of types.

Catsoo: language + terminal for advanced modeling

As you probably know, UML is not bound to a programming language, thus it cannot provide dedicated types out of the box. It only provides few simple types : Unlimited Natural, Integer, Real, String. If you want to bind your code to a framework/language and use its types, you have to define aaaaall the types you want (classes/interfaces/datatypes). For one project, it can be acceptable (but quite long and unpleasant), but when you have to do this for all your projects, it goes from unpleasant to very annoying. That’s when CatsooLang comes in to help you do that programmatically.

enter image description here

GenMyModel provides a low-level terminal based on a proprietary language called CatsooLang. FYI, Catsoo is a tiny virtual cat, insanely inspiring. The language and its terminal enable advanced users to handle model elements and diagram elements using syntax and commands. It’s much more powerful than click+drag’n’drop.

If you want to test the feature without applying changes to your model, go into safe mode by typing: #sandbox-on and perform your tests. Exit the safe mode with #sandbox-off and type again the commands you want to execute for real.

Get Java types in seconds

We provide a Java type library written in CatsooLang (source: here in github) so you get the Java types available right away.

1.First import the UML module. Just type #import 'UML':

cl> #import 'UML'
   !! Accessing 'UML'...
   !! Loading metamodel 'http://www.eclipse.org/emf/2002/Ecore' under 'ecore'
   !! _gmmf_cSegment : (src:NodeWidget x dest:NodeWidget x segtype:EClassifier x seg:Object x srcE:Object x destE:Object) -> SegmentWidget
   !! _uml_cLibrary : (name:String) -> Package
   !! _uml_cLibType : (lib:Package x tname:String x eclass:ENamedElement) -> Object
   !! _uml_cLibType : (lib:Package x tname:String) -> DataType
   !! _uml_cAssociation : (src:Type x dest:Type x aggreg:AggregationKind) -> Association
   !! _uml_cComposite : (src:Type x dest:Type) -> Association
   !! _uml_cAssociation : (src:Type x dest:Type) -> Association
   !! _uml_implements : (src:Class x dest:Interface) -> Class
   !! _uml_cPackage : (name:String x x:Integer x y:Integer) -> Package
   !! _uml_cOperation : (parent:Object x name:String) -> Object
   !! _uml_withReturnType : (parent:Operation x type:Object x lower:Integer x upper:Integer) -> Operation
   !! _uml_returnsVoid : (parent:Operation) -> Operation
   !! _uml_addParameter : (parent:Operation x name:String x type:Object x lower:Integer x upper:Integer) -> Operation
   !! _uml_withPProps : (p:Property x props:String) -> Property
   !! _uml_cAttribute : (parent:Classifier x name:String x type:Object x props:String) -> Property
   !! _uml_inherits : (src:Classifier x dest:Classifier) -> Classifier
   !! _uml_cClassifier : (parent:Object x eclass:EClass x widget:EClass x name:String x x:Integer x y:Integer) -> Class
   !! _uml_cClass : (parent:Object x name:String x x:Integer x y:Integer) -> Class
   !! _uml_cClass : (parent:Object x name:String) -> Class
   !! _uml_cInterface : (parent:Object x name:String x x:Integer x y:Integer) -> Class
   !! _uml_cInterface : (parent:Object x name:String) -> Class
   !! _uml_cPackages : (root:Package x name:String) -> Package
   !! _uml_cPackages : (root:Package x names:Collection) -> Package

2.Import the Java library

The Java library is a set a CatsooLang commands, hosted as a Gist on Github. Import it:

cl> #import 'https://gist.githubusercontent.com/aranega/865d8605321536fb2cd2/raw/javalib.catsoo'
!! Accessing 'https://gist.githubusercontent.com/aranega/865d8605321536fb2cd2/raw/javalib.catsoo'...
Java Library creation... Started
* java.lang created
* java.util created
* java.io created
Java Library creation... Done!

The Java elements are now created. List them all:

cl> tree(__libs::java);
+- Package 'java' [-]
|  +- Package 'java' [packagedElement]
|  |  +- Package 'lang' [packagedElement]
|  |  |  +- Class 'System' [packagedElement]
   ... obviously, there is more

You can also easily check if the library had been well loaded by looking at your project tree view (in the Project panel, top left). You should be able to see a new package named **gmmlibs** and if you unfold this package, you will see packages/types created by the Catsoo script.

You can use these elements in your diagram by drag/dropping them or using them as attributs parameters.

Use Java types in your online UML diagram

Create your own Java library

Is there any Java class/interface you need that is not in our library? You can add it using the terminal.

To add new Java types, we need the UML module we have already loaded:

_uml_cLibType : (lib:Package x tname:String x eclass:ENamedElement) -> Object 
_uml_cLibType : (lib:Package x tname:String) -> DataType

Documentation is available for these functions, enter doc(_uml_cLibType);.

Call _uml_cLibType with: a package, the type name and the type metaclass. Let’s create a new type MyFrameworkType which is a Class:

__libs::java _uml_cLibType('MyFrameworkType', Class);

If you want to add a new interface called Interf1 to the java.io package:

__libs::java::java::io _uml_cLibType('Interf1', Interface);

This is as simple as that. The second _uml_cLibType function behaves like the first one but creates a named DataType. So,if you want to add a new type, you can do this:

__libs::java _uml_cLibType('org.eclipse.emf.ecore.util.EcoreUtil');

Here is a little trick you can use if you want to create many Class at once

['C1', 'C2', 'C3']->_iter(__libs::java _uml_cLibType(self, Class));

Put more in your library using the editor

Now you have the java.io package created, you can drag’n drop it onto the diagramming canvas and fill it:

  1. drag and drop the java.io,

    Drag and drop package (here 'io')

  2. add your new types into it

    New type creation

Our Java library includes the well-known Java types. Do you miss your favorite one? Let us know, we’ll add it!

Love,

GenMyModel, Bizagi, Visio, Lucidchart…: the main key-points you have to check before choosing your BPMN modeling tool

$
0
0

The Business Process Management (BPM) approach is becoming increasingly popular in large organizations and in medium-sized companies. In the same time, we see new initiatives to match the different needs (advice and expertise, dedicated infrastructures, modeling tools) and the different situations (new projects, rework processes, optimization). Considering all these criteria, it can become very difficult to choose the right partners for the implementation of a BPM strategy. Our contribution will focus on the issue of modeling tools: drawing tools, analysis tools and process design, execution tool … What are we talking about? how to choose? according to what criterias? how to appreciate the short / long term criteria? The key idea here is to choose the right tool that will match your right needs.

BPM Cloud Modeling: the big change!

Modeling in the cloud is the big trend in 2015 in the market for BPMN tools. With this new modeling approach, the market of BPMN tools is now structured as follows:

  • Classic desktop tools, with the most extensive functional scope for BPMN experts or experienced users.
  • Desktop drawing tools, easier to use but less advanced and without collaborative features.
  • Online drawing tools, very light and very collaborative, but not really useful in a truly professional mode which requires a strong model conformance in order to be able to perform various analysis on it.
  • Online modeling tools – the new segment – that are both “real modelers” and “collaborative tools”, but depending on the level of maturity.

Of course, there is not a single tool that works for all kind of projects. You probably know the maxim: “in 80% cases, we only use 20% of a features”, you can have as many features as you want in a tool, they probably will not be all useful for a project. However, there is “fundamentals” every tool should have. Let’s go in depth.

17 comparison points

We identified 17 points that BPMN tools should provide. There are quite different and go from the ability to share your models to the adherence with the BPMN 2.0 OMG standard. We crunched results for:

These results are summarized in the following table:

Feature/Tool Bizagi Visio2013 LucidChart GenMyModel
Easy to Use
Easy to Install
Easy Sharing
Real Time Collaboration    
Revision history & Restore    
Web Interface    
Model Repository      
Organization Management    
BPMN compliance    
Auto BPMN Syntax Checking      
Export BPMN    
Export Image
Multi Platfom    
Multilingual support    
Create Elements using Shortcuts      
Add image in diagram  
Object property Edition  

Result analysis

From this table, we observe that there is a clear advantage for web-based tools. Not only they are totally installation free, but they also provide real-time collaboration. They best suit for team work, at the same time and on the same model. More important, you can access your work from anywhere at anytime.

However, accessibility is not the only point that should be taken into account. BPMN is a language, its syntax rules should not be broken. There are two ways to ensure BPMN compliance: during your modeling session or after your modeling session. In both cases at least, you are sure that your model is correct and you can forward it to execution/simulation engines. The advantage for performing syntax check during construction is the following: practically it gets easier for non experts to quickly produce models that conform the BPMN standard. The resulting BPMN models are valid all along the modeling process. But strict BPMN adherence is not commonly implemented. Bizagi and Visio-2013 implement model validation afterwards while LucidChart does not check anything. Yet adherence is the key to interoperate with third party environments.

Another point underlined here is related to productivity. Designing a business model can be a hard thing to achieve, time must be used to think and not to struggle with the modeling tool. People also want BPMN tools to help them get design models quickly. Example libraries may avoid you to start from scratch. A model repository is an interesting idea as it enables you to search through existing models. A solution to your problem may already exist, or at least a part of it. Let’s face it, some of our modeling problems are common to others.

Also, the use of shortcuts is a strong feature which releases the user from the classical click routine. These kind of features definitely impact the user experience and enables you to gain in productivity while easing the tool accessibility.

That’s all folks. Hopefully the key points highlighted above will help you see clear in the BPMN tool jungle. If you are about to choose a BPMN modeling tool, keep in mind that there’s one tool for one specific usage. And think about conformity and interoperability!

Import BPMN 2.0 models into GenMyModel

$
0
0

The BPMN 2 standard is packaged in two parts: a structural part and a graphical one. This means your BPMN model has two flavors in the same artifact: the model and the diagram. The fact that a standard exists for these two parts enables GenMyModel to import all standard BPMN 2 projects no matter the BPMN editor the projects come from.

You can get your BPMN models online and work collaboratively within seconds. They will be safely stored in the cloud and be available everywhere.

The BPMN 2 format structure

BPMN 2 file format is structured as follows: the model is defined before the graphical part (the visual diagram). Obviously, the graphical part reference elements of the model using the model element id. Here is a small example of how the structural model and the graphical model look like in a BPMN 2 file and how the graphical part references the structural one:

<?xml version="1.0" encoding="ISO-8859-1" standalone="yes"?>

<semantic:definitions id="_1373649849716" name="A.1.0" ...stuffs abouts metamodels and extensions schemas...>

    <!-- structural model part here -->
    <semantic:process isExecutable="false" id="WFP-6-">
        <semantic:startEvent name="Start Event" id="_stevent_01"/>
    </semantic:process>

    <!-- graphical model part here -->
    <bpmndi:BPMNDiagram documentation="" id="diag_A10_1" name="A.1.0" resolution="96.00000267028808">
        <bpmndi:BPMNPlane bpmnElement="WFP-6-">
            <bpmndi:BPMNShape bpmnElement="_stevent_01" id="shape_stevent_01">
                <dc:Bounds height="30.0" width="30.0" x="186.0" y="336.0"/>
                <bpmndi:BPMNLabel labelStyle="LS1373649849858">
                    <dc:Bounds height="12.804751171875008" width="94.93333333333335" x="153.67766754457273" y="371.3333333333333"/>
                </bpmndi:BPMNLabel>
            </bpmndi:BPMNShape>
        </bpmndi:BPMNPlane>
    </bpmndi:BPMNDiagram>

</semantic:definitions>

As you can see, the graphical part is divided into the diagram and the plane. The BPMNDiagram element represents a graphical diagram. This diagram contains a BPMNPlane which is the equivalent to the blank page in which each element will be graphically drawn. Below the BPMNShape element is bound to the start event model element _stevent_01 (look at the bpmnElement attribute). This shape also contains various information about its location in the plane, its height and its width. It is as simple as that.

Import BPMN2 models in GenMyModel

Importing standard BPMN 2 models in GenMyModel is straightforward as this unity in BPMN2 file format is the key point GenMyModel import feature relies on. The import feature is available from your dashboard:

  1. in your dashboard, go to the project view and click on “Import”

    BPMN Import Menu

  2. in the project import view, enter the project information and choose the .bpmn file

    BPMN Import Project Information

  3. a nice message will confirm when the import is done

    BPMN Import Sucess

  4. once imported, you can edit your model right away. This is what you get importing the file shown above:

Enjoy BPMN Modeling

Darkness over wonderland

Unfortunately, having a standard does not mean that everybody sticks to it. During our coding and test phases, we observed that some BPMN editors do not strictly respect the BPMN2 format as their output files could not be correctly imported. Some add their secret sauce and interpret on their own what “standard” means. Either they do not conform the BPMN2 metamodel or they define graphical elements that are badly bound to model elements.

We try our best to retrieve the most graphical elements but we couldn’t solve all cases from all editors. Perhaps our import engine will miss the tricky cases. If so, please let us know and send us an email with your model attached at team_at_genmymodel.com. If you are used to work with a real standard BPMN 2 tool, well, importing your models and enjoy online BPMN modeling is a no-brainer !

Love,

BPMN editor goes to the next level!

$
0
0

One month ago, we released the first version of our BPMN2 editor. As promised in my last post, it was just the beginning to bring you the best tool for modeling your BPMN process on the web. After several days in total darkness, only armed with the BPMN2 specification and our keyboards, we’d like to show you what we’ve been working on.

Boundary event

The first thing that we have added is the boundary events. Now catch events can be attached to activities. That way, you can easily model what happens when an activity triggers some events. The activity will then be interrupted or not.

Boundary event example

Note that some events must not be attached to an activity, and conversely, some events can only be created as boundary. Thankfully, GenMyModel will help you create your events the way you want.

Subprocess

The most important addon is the support of subprocesses. A subprocess is an activity which can be “opened up” to show a lower-level process. It can be collapsed or expanded. Note that if you drag an element to a subprocess, it will be automatically expanded in order to accept the dragged element.

Subprocesses example

A subprocess can be specialized in three different types and each of them can be created from the toolbar:

  • Event subprocess
  • Ad-hoc subprocess
  • Transaction

I will describe them in the following sections.

Event subprocess

An event subprocess is not part of the normal flow of its parent process and no incoming or outgoing sequence flows can be attached to it. An event subprocess must have a start event with a trigger. And each time the start event is triggered while the parent process is active, the event subprocess will start.

To define a subprocess as an event subprocess, you need to set the flag triggeredByEvent to true in the property panel:

"Event subprocess properties"

After that, your subprocess has a dotted border and you won’t be able to attach sequence flows to it.

Event subprocess example

Ad-hoc subprocess

Another type of subprocess that has been added to our BPMN2 tool is the ad-hoc subprocess. Activities in an ad-hoc subprocess have no required sequence relationships. This means that activities can be executed in any order. We generally use it when activities within a subprocess are disconnected from each other. The performers determine when activities will start, what the next activity will be, and so on.

An ad-hoc subprocess is visualized by a marker with a “tilde” symbol placed at the bottom center as shown in the diagram below:

Ad-hoc subprocess example

Transaction

According to OMG specification A transaction is a specialized type of subprocess that will have a special behavior that is controlled through a transaction protocol. Furthermore, all activities in a transaction logically belong together.

Generally, a transaction can have three outcomes:

  • Successful completion: represented by the sequence flow that leaves the transaction.
  • Failed completion (cancel): activities inside the transaction can be subjected to be canceled. This can be done by adding a cancel boundary event to the transaction. When the transaction will be canceled, the flow will be redirected to the cancel boundary event.
  • Hazard (error): this means that something went terribly wrong and a normal success or cancel is not possible. In order to show hazard outcome, you need to add an error boundary event to the transaction.

The following illustration shows a transaction created in GenMyModel with this three basic outcomes:

Transaction subprocess example

Call activity

GenMyModel also supports caldeliveredl activities. As the name suggests, call activities can be used to call a global process or a global task in a process. A call activity acts like a “wrapper” for the called element within the execution. Once your call activity is created, the called element can be set in the properties of this one (in the property panel).

Call activity example

Group

The BPMN “group” is also a new addon. Groups are often used to highlight certain sections of a diagram without adding additional constraints as a subprocess would. Groups do not affect the flow of the process. This means that neither sequence flows nor message flows can be connected to groups. A group can stretch across the boundaries of a pool to surround diagram elements, often to identify activities that exist within a distributed business-to-business transaction.

Group example

Task, event and gateway conversion

We’ve delivered a little (but really useful) capability in the editor: the ability to convert some elements to another. All activities, events and gateways can be converted. If you missed it, you can do that by using the context menu (right click) on the element you want to convert. For example, it’s now possible to create a throw event with no definition and then, by using the context menu, set its definition.

BPMN activity conversion

Tips

This can save you a lot of time in addition to the shortcuts. For example, you can create a task with the t shortcut and then convert it to user task. Same thing for events (s for start event, e for end event, w for throw event and c for catch event).

BPMN2 import

The import functionality has also been vastly improved to be more compatible with most common BPMN tools. All the new added elements (boundary events, subprocess, call activity and group) should now be imported correctly.

You can find more information about it in this post, Vince (our beer lover) explains how this works and how you can import your BPMN2 files to GenMyModel.

What’s next?

Like you can see, many features have been added to our BPMN editor and…this is not over! Indeed we will continue to enhance it and we can already tell you what we’re working on:

  • Documentation export in PDF format.
  • More “links” between diagrams, like the possibility to create a process diagram from a subprocess.
  • BPMN process simulation (flow animation).

We hope you enjoy the new features and, as usual, your feedback is welcome.
Thanks for reading.

Viewing all 52 articles
Browse latest View live