Home > Reverse Engineering

Reverse Engineering


This section is composed by:

  1. Java code
    1. Create a detailled model including your full project information
    2. Create a view of your project
    3. Merge exiting model with modified java code
  2. JPA annotations
  3. Database Reverse
  4. Sequence diagram reverse
  5. Reverse engineering Example


1. Java Code

Import your java code inside Eclipse then select one of the following option:

1.1 Create a detailled model including your full project information

We recommend mapping all your project information inside your model, btw you can also only use the automatic detection.
The XMI Backup will immediately save the following java project information:

The XMI Backup menu is available in the Package Explorer by selecting src > Open / Reverse UML > Deep Reverse > XMI Backup.



This is a heavy refactoring process which requires 12 minutes on my laptop (intel duo core 2Ghz - ram 2048) for Xerces (large project size composed by over 1 000 classes&Interfaces). This process will map each piece of Java information into a UML 2.2 model.
This means that 100% of your Java or JEE project skeleton will be saved.

Please note that if you want to save business rules inside your model, then you need to manually reverse each method. This reverse is too heavy to be completed automaticly (will require between 12 to 24 hours for xerces) and don't really have any sens to be done for each method. The best approach is to select strategic business rules methods and only reverse these methods.

1.2 Create a view of your project

The create a view of your project requires to have java code and use automatic detection.
You can click on a package and reverse java code immediately at any any time.
Note that only the created diagram represented by the package and classifiers will be saved in the model.

To reverse a package using automatic detection you can use three options:





If you look at the model then you will notice that only the selected package classifiers and connectors have been saved in the model.



  • select a package or a classifiers in the package explorer and drop them in a class diagram. You can create for example an empty package diagram if you select src > New UML Diagram > Package Diagram and drop inside existing packages from the Package Explorer.




Please note that the dependencies detection between packages is only activated if you reverse your project at src level (e.g. you can not see dependencies between packages if you don't use src level reverse).


1.3 Merge existing model with modified java code

The merge option is an important concept if the java project is evolving with the creation of new UML diagrams.
The principe is too reverse the full project at the beginning of the modeling stage, then to create diagrams and close EclipseUML.
After few weeks of coding another iteration stage is needed.
At this stage the model merge will add all detected new packages, classifiers and connectors to the exisitng model.

The merge option is available if you select the src > Open / Reverse UML > Deep Reverse > Merge Model.


The merge mecanism is working at XMI level and is repescting the following rules:

Please note that if you copy and paste diagrams into another project then diagrams will not anymore be synchronized with Java or the model.
If you move diagrams inside your project then diagrams will keep the same properties and will always be synchronized.


2. JPA Annotations

JPA annotations are automaticly reversed in both live code/model/UML Editor synchronization.
You can use deep reverse menus (e.g. XMI backup or Merge Model).

For example if you reverse the following code:

package p;

import javax.persistence.Entity;
import javax.persistence.Id;

@Entity(name="name")
public class JPAEntity {

@Id
 private long id;
  
    public long getId()
    {
        return id;
    }

    public void setId(long id ){
        this.id = id;
    }
}

You will get the following in your class diagram:




3. Reverse a database

The use of the Dali plugin with EclipseUML is required.
The concept is :

Dali plugin connect the database and reverse it into Java code including annotations.
EclipseUML then reverse these annotations from the code into the UML Editor and the Model
More information at: Persistence Development topic



4. Sequence Diagram Reverse Engineering

You can reverse a method by selecting a method in: