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.
Person
class.Timecard
class to the diagram and set its stereotype
to Entity.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.begDate
and comments
attributes to Timecard
.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.Timecard
end and uncheck Navigable. This will make the
association one-way from Timecard
to Person
.Person
end of the association and select the
multiplicity of 1. Similarly set the multiplicity of the Timecard
end to
many (*).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
.approver
association from Timecard
to
Person
. Move the associations up or down as appropriate so they do not overlap
each other.
We are now ready to generate code for Timecard
. Please go back to the main
tutorial page and continue from where you left off.