Create Timecard Entity
This page provides directions to create the
Timecard
entity using MagicDraw 16.5.
Follow the steps below to create the
Timecard
entity along with the
two associations.
- Open the diagram called "Domain Objects" and create a class called
Timecard
in it. Make sure the class is created in the
org.andromda.timetracker.domain
package by inspecting the containment tree.
- Set the stereotype of the
Timecard
class to Entity.
- Add the 3 attributes as shown above. Remember to uncheck the Is Unique box.
- Add the
findByCriteria()
method as shown above. By default the method
is created at instance scope. Double-click on the method to open the Operation Specification
dialog box and check the
Is Static box.
- Select the association relationship from the toolbar. Use the tool tips and the
status bar to identify the association tool. Create an asociation from
Timecard
to User.
- Right-click on the
Timecard
end of the association and uncheck Navigable. This will make
the association one-way from
Timecard
to Person.
- Right-click on the
User
end of the association and select the multiplicity
of 1. Similarly set the multiplicity of the
Timecard
end to many (*).
- Right-click on the
User
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 User.
- Similarly add an
approver
association from
Timecard
to
User. Move the associations up or down as appropriate so they do not
overlap each other. This can be made easier by right-clicking on the association
and choosing Path Style > Rectilinear.
- Save your
timetracker
model by selectingFile > Save Project.
- 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.