Create Timecard Entity
This page provides directions to create the
Timecard
entity using RSM.
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 model explorer.
- Set the stereotype of the
Timecard
class to Entity.
- Add the 3 attributes as shown above.
- Add the
findByCriteria()
method as shown above. By default the method
is created at instance scope. Select the method and open the
General
property tab and check the
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.
- In the
General
property tab uncheck
Navigable
for the Timecard's association end. This will make
the association one-way from
Timecard
to Person.
- On the User's end of the association set the multiplicity
to 1. Similarly set the multiplicity of the
Timecard
end to many *.
- On the User's end of the association type
submitter
in the
role
box.
The Timecard's end does not have to be named because it is not navigable.
- Select the
- submitter
label in the diagram, and in the
General
property tab
make this property public. 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 choosingFormat > Path Style > Rectilinear.
- Save your
timetracker
model by double-clicking on
timetracker.emx
and clicking on
File > Save
(Ctrl + S).
-
SelectFile > Export.... Choose
UML2 Model
and then click onNext.
As
source
select
/TimeTracker/timetracker.emx
and as
destination
browse to C:\timetracker\mda\src\main\uml.
Now go back to the main tutorial page and continue from where you left off.