Create Person Entity using ArgoUML

This page provides directions to create the Person entity using ArgoUML. The model is shown below for your reference.

  1. Download an ArgoUML compatible version of the AndroMDA profile from the ArgoUML CVS .
  2. Start ArgoUML.
  3. Select File > Open Project... open the AndroMDA 3.1 profile and save as C:/TimeTracker/mda/src/uml/TimeTrackerModel.zargo.
  4. Edit timetracker/mda/project.properties and change maven.andromda.model.uri=file:${maven.src.dir}/uml/TimeTrackerModel.xmi to maven.andromda.model.uri=jar:file:${maven.src.dir}/uml/TimeTrackerModel.zargo!/TimeTrackerModel.xmi
  5. The TimeTracker model will now open showing the two default diagrams (an empty Class Diagram and an empty Use Case Diagram) and the contents of the AndroMDA profile.
  6. In the Explorer pane, click on the root model to select it. Now go to the Properties panel at the bottom of the screen and rename the model to TimeTracker by typing the new name in the Name: field.
  7. Now click the Package icon (looks like a tabbed folder) immediately above the name field on property panel. A new package will be created under the TimeTracker model and the keyboard focus will be in its name field on the property pane. Type in org.andromda.timetracker as the name of the package. AndroMDA will map this package to a Java package with the same name. Note: Make sure the package name is exactly org.andromda.timetracker, with no leading or trailing spaces. We have found that some browsers introduce a leading space in the package name if you copy it from this page!
  8. Now create a package called domain under org.andromda.timetracker. We will create our entities and supporting classes in this package. Note that AndroMDA does not require this package structure. We are doing it simply to separate our business domain classes from other classes such as value objects etc.
  9. With the domain package still selected go to the menu bar and choose Create -> New Class Diagram. Go to the property panel at the bottom and give it the name Domain Objects.
  10. In the toolbar immediately above the diagram's drawing area click on the Class icon (4th icon from the left). Now click anywhere inside the diagram. A new class will be created. The class will be automatically selected as indicated by the 4 knobs around it. (If you somehow deselected the class, then select it again by clicking on it.) Now type the word "Person". This word will be entered as the name of the class.
  11. Let's add some documentation for the Person class. It is always a good idea to document your model. Documentation added to model elements such as classes, attributes and methods is carried over to the code as comments. Click on the Documentation tab in the property panel. Add the following sentence in the Documentation field: "This class represents any person whose time needs to be tracked."
  12. Now add the stereotype Entity to class Person. There are two ways to do this which you can choose from depending on your work style.
  13. You can right-click on the class and select Apply Stereotypes. In the next level menu, check the box next to Entity.
  14. You can go to the Stereotypes tab on the property panel and select Entity in the left hand Available Stereotypes column and click the arrows to move it right to the Applied Stereotypes column.
  15. The Person class will now have the Entity stereotype.
  16. Let's add username as an attribute of Person. Right-click on the Person class and select Add -> New Attribute. A new attribute is inserted with the specification "+newAttr : int". Double click on the new attribute to select the old specification and write over this specification with this new one: "+username : String" and press Enter. Note that attributes are always generated as private members of a class. However the visibilities of the associated getter and setter are determined by the visibility of the attribute specification. In this case we have specified public visibility (by using the plus sign) and hence the username getter and setter will be public.
  17. Now add two more public attributes called firstName and lastName to the Person class. Make them String type. If you prefer a point and click interface rather than typing the specification, you can work from the property panel and set the visibility, type, etc individual using that dialog.
  18. Make sure your class diagram matches the one shown above exactly. (It is okay if your class shows an empty operation compartment. This can be hidden very easily).
  19. Save your TimeTracker model by selecting File > Save Project.

Congratulations! You have now specified the Person entity of the TimeTracker application. We are now ready to generate some code. Please go back to the main tutorial page and continue from where you left off.