Create User Entity

This page provides directions to create the User entity using MagicDraw 16.5.

We will create User in a package named org.andromda.timetracker.domain.

  1. In the TimeTracker model create a package called domain under org.andromda.timetracker.
  2. In the Containment Tree on the left, right-click on the domain package and selectNew Diagram > Class Diagram. The diagram is created and opened in a new window. Type in Domain Objects as the name of this diagram and press Enter.
  3. Add a new class to the diagram and name it User.
  4. Add the stereotype called Entity (The one from AndroMDA Profile, starting with an 'E' and not the one from UML2 Standard Profile, starting with an 'e') to User.
  5. Add the 3 attributes to User. Uncheck the Unique in firstName and lastName.
  6. Double click on the class to open the class specification.
  7. Click on the Tagged Values tab and then click on the tagged value named andromda_persistence_table. This tagged value allows you to override the default table name for the entity. Click the Add Value button. Enter the value USERS in the right panel. Click OK to add this tagged value to the User entity.
  8. Note: In our UML2 profile, each tag value has it own stereotype. Having such a stereotype applied on an element will make AndroMDA consider this element tagged by the corresponding tag value. If there is no specified value (but the stereotype is applied) AndroMDA will use the default value, defined in the profile. Keep this in mind, when removing a tag value: unapply the stereotype as well.
  9. Note that the tagged value shows up in the diagram and its owning stereotype andromda_persistence_table. You can make MagicDraw 16.5 hide the tagged values, but you can't select which stereotypes you want to be displayed. If you want to hide the tag value, right-click on the entity and choosePresentation Options, then deselectShow Tagged Values. You may want to hide stereotypes as well: Entity stereotype has an icon which will remain displayed.
  10. Make sure your class diagram matches the one shown on the right (depending on the choice you made just before).
  11. Make sure that the MagicDraw containment tree matches the screen shot shown below.
  12. Save your timetracker model by selectingFile > Save Project.
  13. Export it in EMF/UML2 format by selectingFile > Export > EMF UML2 (v2.x) XMI File. Choose C:/timetracker/mda/src/main/uml as export directory and clickExport.

Now go back to the main tutorial page and continue from where you left off.