Create Timecard Entity using MagicDraw

This page provides directions to create the Timecard entity using MagicDraw along with its associations to the Person entity. The model is shown below for your reference.

  1. In the TimeTracker model open the Domain Objects diagram. This diagram already contains the Person class.
  2. Now add the Timecard class to the diagram and set its stereotype to Entity.
  3. Next we need to add the status attribute to Timecard. However note that status is of type TimecardStatus which is an enumeration. We must define TimecardStatus first. So create a class called TimecardStatus. Give it a stereotype of Enumeration. Add four attributes to it representing the enumeration values. Now that we have defined TimecardStatus, we can add the status attribute to Timecard as shown above.
  4. Next add the begDate and comments attributes to Timecard.
  5. Now we must add the association between Timecard and Person. To do this, click on the Association icon in the toolbar (13th icon from top). Click on the Timecard class, drag your mouse to the Person class and release the mouse. A new association will be created.
  6. Right-click on the Timecard end and uncheck Navigable. This will make the association one-way from Timecard to Person.
  7. Right-click on the Person end of the association and select the multiplicity of 1. Similarly set the multiplicity of the Timecard end to many (*).
  8. Right-click on the Person end of the association and select Edit Name. Type the following specification for this association end: "+submitter". The Timecard end does not have to be named because it is not navigable. This completes the submitter association from Timecard to Person.
  9. Similarly add an approver association from Timecard to Person. Move the associations up or down as appropriate so they do not overlap each other.
  10. Make sure your class diagram matches the one shown above.
  11. Save the model by selecting File > Save Project.

We are now ready to generate code for Timecard. Please go back to the main tutorial page and continue from where you left off.