Author Topic: Build customized UML diagram from source code  (Read 3939 times)

Askar Ibragimov

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Build customized UML diagram from source code
« on: May 15, 2014, 06:33:55 pm »
Hello, I am fairly new to EA. I have a particular code and would like to generate custom UML from the code. Presently, with default settings, I was able to backward engineer my code but it just generated classes "blocks" and shows no apaprent connections between classes. We use "loose binding" strategy in our code.


Here's a representation of what I need to obtain:

Code is a bunch of such C#routines within a Webapi class:

  public class ProjectConfigurationController : WebApiController
    {

        [HttpPost]
        public ProjectStoreResponseDto CreateNewProject(ProjectConfigurationDto project)  
        {
            var reply = CommandProcessor.ProcessCommand(new ProjectConfigurationSaveCommand(project)) as GenericSaveCommandResponse;
         return reply;
        }

  
        [HttpPut]
        public void UpdateProject(ProjectConfigurationDto project)
        {
            try
            {
                var reply = CommandProcessor.ProcessCommand(new ProjectConfigurationSaveCommand(project)) as GenericSaveCommandResponse;
                AssertResponse(reply);
            }
            catch (Exception exception)
            {
        
                throw new HttpResponseException(HttpStatusCode.InternalServerError);
            }
        }
}


and I need a diagram that displays something like this



that is, command names are picked from code, and interface name of ProcessCommand is also used.

I appreciate any pointers about how can I semi- or fully-automatically create such a custom diagram.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13303
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Build customized UML diagram from source code
« Reply #1 on: May 15, 2014, 06:40:08 pm »
I would start from the standard reverse engineering, and then write and add-in to do additional post processing.
I guess that means parsing the code, figuring out the dependencies, and creating the required relations in EA.

EA has an API that you can use for your add-in/script

Geert

Askar Ibragimov

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: Build customized UML diagram from source code
« Reply #2 on: May 15, 2014, 06:45:21 pm »
Quote
I would start from the standard reverse engineering, and then write and add-in to do additional post processing.
I guess that means parsing the code, figuring out the dependencies, and creating the required relations in EA.

EA has an API that you can use for your add-in/script

Geert

Thanks for the reply!
As I am a complete novice to it, where I can read more about addins and what exact tools / languages/ scripting I can employ to reach my goal?

Nizam Mohamed

  • EA User
  • **
  • Posts: 193
  • Karma: +1/-0
    • View Profile
Re: Build customized UML diagram from source code
« Reply #3 on: May 15, 2014, 08:02:25 pm »
Askar,
you can also consider achieving this with Model Transformations. Where you can have your imported model transformed into the controllers and commands you would like to create.

Look for more information in
http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/model_transformation/mdastyletransforms.html

You can try one of the built-in transforms (refer http://www.sparxsystems.com/enterprise_architect_user_guide/9.3/model_transformation/builtintransformations.html)

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13303
  • Karma: +557/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Build customized UML diagram from source code
« Reply #4 on: May 15, 2014, 08:45:37 pm »
Quote

Thanks for the reply!
As I am a complete novice to it, where I can read more about addins and what exact tools / languages/ scripting I can employ to reach my goal?

You can check
- my site: Tutorial: Create your first C# Enterprise Architect addin in 10 minutes
- My Open source Repositories on Github:https://github.com/GeertBellekens/
- The community site http://community.sparxsystems.com/
- The help file
- The examples in your installation folder.

Geert