├── UmlGenerator
├── .gitignore
├── .settings
│ ├── org.eclipse.m2e.core.prefs
│ └── org.eclipse.jdt.core.prefs
├── src
│ └── main
│ │ └── java
│ │ └── com
│ │ └── uml
│ │ └── generator
│ │ ├── classDiagram
│ │ ├── models
│ │ │ ├── ModifierType.java
│ │ │ ├── ClassType.java
│ │ │ ├── PackageModel.java
│ │ │ ├── MethodModel.java
│ │ │ ├── ClassDiagramModel.java
│ │ │ ├── FieldModel.java
│ │ │ └── ClassModel.java
│ │ └── ClassDiagramGenerator.java
│ │ ├── spring
│ │ ├── models
│ │ │ ├── DependencyType.java
│ │ │ ├── SpringClassType.java
│ │ │ ├── SpringDependencyDiagramModel.java
│ │ │ └── SpringClassModel.java
│ │ └── SpringDependencyDiagramGenerator.java
│ │ ├── jpa
│ │ ├── models
│ │ │ ├── JpaEntityType.java
│ │ │ ├── JpaDependencyType.java
│ │ │ ├── JpaDependencyDiagramModel.java
│ │ │ └── JpaClassModel.java
│ │ └── JpaMappingDiagramGenerator.java
│ │ ├── componentDiagram
│ │ ├── models
│ │ │ ├── ComponentType.java
│ │ │ ├── ComponentGroupModel.java
│ │ │ ├── ComponentModel.java
│ │ │ └── ComponentDiagramModel.java
│ │ └── ComponentDiagramGenerator.java
│ │ ├── UmlOptions.java
│ │ ├── models
│ │ └── UmlModel.java
│ │ ├── UmlGeneratorUtility.java
│ │ └── UmlGenerator.java
├── .classpath
├── .project
└── pom.xml
├── UmlGeneratorTool
├── .gitignore
├── icons
│ ├── JPAIcon.png
│ ├── SpringIcon.png
│ ├── ._SpringIcon.png
│ ├── ClassDiagramIcon.png
│ └── ComponentDiagramIcon.png
├── .settings
│ ├── org.eclipse.m2e.core.prefs
│ └── org.eclipse.jdt.core.prefs
├── .project
├── .classpath
├── META-INF
│ └── MANIFEST.MF
├── build.properties
├── pom.xml
├── src
│ └── main
│ │ └── java
│ │ └── umlGenerator
│ │ ├── Activator.java
│ │ ├── windows
│ │ ├── GenerateComponentDiagramOptionsDialog.java
│ │ └── GenerateUMLOptionsDialog.java
│ │ ├── actions
│ │ ├── GenerateComponentDiagramAction.java
│ │ ├── GenerateJpaMappingDiagramAction.java
│ │ ├── GenerateSpringClassDiagramAction.java
│ │ └── GenerateClassDiagramAction.java
│ │ └── MultipleProjectAction.java
└── plugin.xml
├── .DS_Store
├── Resources
├── UmlGeneratorMenu.png
├── SampleClassDiagram.png
├── SampleComponentDiagram.png
├── SampleJPAMappingDiagram.png
├── ComponentDiagramOptionsDialog.png
├── SampleSpringDependencyDiagram.png
├── ClassAndSpringDiagramOptionsDialog.png
└── .project
└── README.md
/UmlGenerator/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /target
3 |
--------------------------------------------------------------------------------
/UmlGeneratorTool/.gitignore:
--------------------------------------------------------------------------------
1 | /bin/
2 | /.gitignore
3 | /target
4 |
--------------------------------------------------------------------------------
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/.DS_Store
--------------------------------------------------------------------------------
/Resources/UmlGeneratorMenu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/UmlGeneratorMenu.png
--------------------------------------------------------------------------------
/Resources/SampleClassDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/SampleClassDiagram.png
--------------------------------------------------------------------------------
/UmlGeneratorTool/icons/JPAIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/UmlGeneratorTool/icons/JPAIcon.png
--------------------------------------------------------------------------------
/Resources/SampleComponentDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/SampleComponentDiagram.png
--------------------------------------------------------------------------------
/Resources/SampleJPAMappingDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/SampleJPAMappingDiagram.png
--------------------------------------------------------------------------------
/UmlGeneratorTool/icons/SpringIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/UmlGeneratorTool/icons/SpringIcon.png
--------------------------------------------------------------------------------
/UmlGeneratorTool/icons/._SpringIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/UmlGeneratorTool/icons/._SpringIcon.png
--------------------------------------------------------------------------------
/Resources/ComponentDiagramOptionsDialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/ComponentDiagramOptionsDialog.png
--------------------------------------------------------------------------------
/Resources/SampleSpringDependencyDiagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/SampleSpringDependencyDiagram.png
--------------------------------------------------------------------------------
/UmlGeneratorTool/icons/ClassDiagramIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/UmlGeneratorTool/icons/ClassDiagramIcon.png
--------------------------------------------------------------------------------
/UmlGenerator/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/UmlGeneratorTool/icons/ComponentDiagramIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/UmlGeneratorTool/icons/ComponentDiagramIcon.png
--------------------------------------------------------------------------------
/Resources/ClassAndSpringDiagramOptionsDialog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/suken/UmlGeneratorTool/HEAD/Resources/ClassAndSpringDiagramOptionsDialog.png
--------------------------------------------------------------------------------
/UmlGeneratorTool/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/UmlGenerator/src/main/java/com/uml/generator/classDiagram/models/ModifierType.java:
--------------------------------------------------------------------------------
1 | package com.uml.generator.classDiagram.models;
2 |
3 | public enum ModifierType {
4 |
5 | PUBLIC,
6 | PRIVATE,
7 | PROTECTED,
8 | DEFAULT,
9 | NONE;
10 | }
11 |
--------------------------------------------------------------------------------
/Resources/.project:
--------------------------------------------------------------------------------
1 |
2 |
4 | UML Generator provides APIs for generating UML diagrams from java source. The UML Generator uses plantuml and graphviz liraries for generating diagrams. The utility outputs UML in following format files:
5 |
6 |
9 |
7 |
85 |
86 | Component Diagram and JPA Mapping diagram
88 |
--------------------------------------------------------------------------------
/UmlGenerator/src/main/java/com/uml/generator/jpa/models/JpaClassModel.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.uml.generator.jpa.models;
5 |
6 | import java.util.List;
7 | import java.util.Map;
8 | import java.util.Map.Entry;
9 |
10 | import lombok.Setter;
11 |
12 | import com.google.common.collect.Lists;
13 | import com.google.common.collect.Maps;
14 | import com.uml.generator.classDiagram.models.ClassModel;
15 | import com.uml.generator.classDiagram.models.ClassType;
16 |
17 | /**
18 | * @author SShah
19 | */
20 | public class JpaClassModel extends ClassModel {
21 |
22 | private static final String TABEL = " << (T,#BB3255) TABLE >> ";
23 | private static final String MAPPED_SUPER_CLASS = " << (M,#CD45FF) MAPPED SUPER CLASS >> ";
24 | private static final String ENTITY_CLASS = " << (E,#ACFFFF) ENTITY >> ";
25 | private static final String COLUMNS_SEPARATOR = "__COLUMNS__";
26 | private static final String ID_COLUMNS_SEPARATOR ="__ID COLUMNS__";
27 | private static final String TABLE_NAME_SEPARATOR = "__TABLE__";
28 | private static final String ONE_TO_ONE_UML_STR = "--";
29 |
30 | @Setter
31 | private String tableName;
32 | @Setter
33 | private JpaEntityType jpaEntityType;
34 | private final Map51 | * 52 | * @param projectJarUrl URL of the project jar for which the class diagram is to be generated. 53 | * @param jarURLs dependent jars 54 | * @param packagesIncluded Are packages included? 55 | * @param fieldsIncluded Are fields included? 56 | * @param methodsIncluded Are methods included? 57 | * @param testIncluded Are tests included? 58 | * @param projectName name of the project 59 | * @param umlDirPath Output directory path 60 | * @throws Exception If anything goes wrong just raise it to the caller. 61 | */ 62 | public static void generateClassDiagram(URL projectJarUrl, URL[] jarURLs, String projectName, String umlDirPath, UmlOptions options) throws Exception { 63 | ClassLoader loader = Thread.currentThread().getContextClassLoader(); 64 | try { 65 | // parse all the classes from the jars 66 | URLClassLoader classLoader = new URLClassLoader(jarURLs); 67 | Thread.currentThread().setContextClassLoader(classLoader); 68 | ClassDiagramModel classDiagramModel = ClassDiagramGenerator.generateClassDependencies(classLoader, projectJarUrl, options); 69 | String uml = classDiagramModel.getUml().replace("$", "_Inner"); 70 | 71 | // generate the UML and plant uml text files 72 | String sourceFilePath = exportToPlantUMLFile(projectName, umlDirPath, uml, "_ClassDiagram"); 73 | exportToFile(projectName, umlDirPath, sourceFilePath, "_ClassDiagram", options.getFileFormat()); 74 | } 75 | finally { 76 | Thread.currentThread().setContextClassLoader(loader); 77 | } 78 | } 79 | 80 | /** 81 | * Generate the Spring class diagram for the given project jar. The method generates following: 82 | *
104 | * 105 | * @param projectJarUrl URL of the project jar for which the class diagram is to be generated. 106 | * @param jarURLs dependent jars 107 | * @param packagesIncluded Are packages included? 108 | * @param fieldsIncluded Are fields included? 109 | * @param methodsIncluded Are methods included? 110 | * @param testIncluded Are tests included? 111 | * @param projectName name of the project 112 | * @param umlDirPath Output directory path 113 | * @throws Exception If anything goes wrong just raise it to the caller. 114 | */ 115 | public static void generateSpringClassDiagram(URL projectJarUrl, URL[] jarURLs, String projectName, String umlDirPath, UmlOptions options) throws IOException { 116 | ClassLoader loader = Thread.currentThread().getContextClassLoader(); 117 | try { 118 | // parse all the classes from the jars 119 | URLClassLoader classLoader = new URLClassLoader(jarURLs); 120 | Thread.currentThread().setContextClassLoader(classLoader); 121 | String uml = SpringDependencyDiagramGenerator.generateSpringDependencies(classLoader, projectJarUrl, options).replace("$", "_Inner"); 122 | 123 | // generate the UML and plant uml text files 124 | exportToPlantUMLFile(projectName, umlDirPath, uml, "_SpringDependencyDiagram"); 125 | exportToFile(projectName, umlDirPath, uml, "_SpringDependencyDiagram", options.getFileFormat()); 126 | } 127 | finally { 128 | Thread.currentThread().setContextClassLoader(loader); 129 | } 130 | } 131 | 132 | /** 133 | * Generates the component diagram for the given MAVEN project. The method generates the following: 134 | *
142 | *
143 | * Warning
144 | * If the component diagram is too complicated then the GraphViz may not generate the PNG file. Try opening the plantuml file in plantuml eclipse plugin.
145 | *
146 | * @param srcDir directory which contains the POM files.
147 | * @param projectName Name of the project for which the component diagram is to be generated.
148 | * @param includePatterns regular expression of included artifact id patterns
149 | * @param excludePatterns regular expression of excluded artifact id patterns
150 | * @param umlDirPath output directory to write UML
151 | * @throws Exception If anything goes wrong then raise it to the caller.
152 | */
153 | public static void generateComponentDiagram(String srcDir, String projectName, String umlDirPath, UmlOptions options) throws Exception {
154 | String uml = ComponentDiagramGenerator.generateComponentDiagram(srcDir, options);
155 | // generate the UML and plant uml text files
156 | exportToPlantUMLFile(projectName, umlDirPath, uml, "_ComponentDiagram");
157 | exportToFile(projectName, umlDirPath, uml, "_ComponentDiagram", options.getFileFormat());
158 | }
159 |
160 | /**
161 | * Generates the JPA mapping diagram for the given project. The method generates the following:
162 | *
45 | * Subclasses of this class can get the projects selected by the user by calling
46 | * {@link MultipleProjectAction#getSelectedProjects()}
47 | *
48 | */
49 | public abstract class MultipleProjectAction implements IObjectActionDelegate {
50 |
51 | private static final Logger LOGGER = Logger.getLogger("MultipleProjectAction");
52 |
53 | /**
54 | * Projects selected by the user.
55 | */
56 | private List