Using GenMyModel with Codenvy

UML (United Modeling Language) is quite popular in the field of engineering. UML models are easy to create, and they perfectly visualize project structure and logic. Just a few mouse clicks will get you a comprehensive project model which can be then exported in various extensions. GenMyModel.com can generate models as Java projects and push the result code to GitHub. This is where Codenvy comes into play. Below is a brief tutorial on how to create a simple diagram in GenMyModel, push code to GitHub, clone it to Codenvy, edit the code and push changes back to GitHub.

Create a new model

There are two options to get started with GenMyModel.com: create own model or use existing templates. We’ve created a new simple model with one class and 3 attributes:

genmymodel

Generate code and push to GitHub

GenMyModel lets users generate code and download a zipped archive or push the code directly to GitHub at Tools > Generation > Generation Configuration. We chose the second option:

push_genmymodel

There are two things to remember:

  • GenMyModel can push to your repository only if it has been initialized
  • GenMyModel user should be added as a collaborator in the repository settings

Clone project to Codenvy and edit code

You can use either https or SSH Git URLs to clone a repository to Codenvy either at Git > Clone repository or from the Welcome Screen – Import From GitHub. Inviting GenMyModel as a collaborator in Codenvy is optional. The project is cloned as Java library (JAR).

jar_project

Employee.java will look like:

package sample;
import java.util.Date;

/**
 * <!-- begin-user-doc -->
 * <!--  end-user-doc  -->
 * @generated
 */

public class Employee
{
	/**
	 * <!-- begin-user-doc -->
	 * <!--  end-user-doc  -->
	 * @generated
	 * @ordered
	 */

	public String name;
	/**
	 * <!-- begin-user-doc -->
	 * <!--  end-user-doc  -->
	 * @generated
	 * @ordered
	 */

	public String department;
	/**
	 * <!-- begin-user-doc -->
	 * <!--  end-user-doc  -->
	 * @generated
	 * @ordered
	 */

	public Date hiredate;
	/**
	 * <!-- begin-user-doc -->
	 * <!--  end-user-doc  -->
	 * @generated
	 */
	public Employee(){
	}
}

With a ready to use project and a class file structure it’s easy to keep working on your project. When you are done with editing, changes can be pushed back to GitHub.

Push changes back to GitHub

  • add files to index at Git > Add
  • commit changes at Git > Commit
  • push to GitHub at Remotes > Push

Below is a video tutorial demonstrating interaction of GenMyModel.com and Codenvy through GitHub: