This page provides directions to create the Person entity using ArgoUML. The model is shown below for your reference.
maven.andromda.model.uri=file:${maven.src.dir}/uml/TimeTrackerModel.xmi
to
maven.andromda.model.uri=jar:file:${maven.src.dir}/uml/TimeTrackerModel.zargo!/TimeTrackerModel.xmi
org.andromda.timetracker
as the name of the package. AndroMDA
will map this package to a Java package with the same name. Note: Make sure the package name is
exactly org.andromda.timetracker
, with no leading or trailing spaces. We
have found that some browsers introduce a leading space in the package name if you copy
it from this page!domain
under org.andromda.timetracker
.
We will create our entities and supporting classes in this package. Note that AndroMDA
does not require this package structure. We are doing it simply to separate our business
domain classes from other classes such as value objects etc.domain
package still selected go to the menu bar and
choose Create -> New Class Diagram. Go to the property panel at the bottom
and give it the name Domain Objects
.Person
class. It is always a good
idea to document your model. Documentation added to model elements such as classes,
attributes and methods is carried over to the code as comments. Click on the
Documentation tab in the property panel. Add the following
sentence in the Documentation field:
"This class represents any person whose time needs to be tracked."Entity
to class Person
. There are two
ways to do this which you can choose from depending on your work style.
Person
class will now have the Entity
stereotype.username
as an attribute of Person
.
Right-click on the Person class and select Add -> New Attribute. A new attribute is
inserted with the specification "+newAttr : int". Double click on the new attribute to
select the old specification and write over this specification with
this new one: "+username : String" and press Enter. Note that
attributes are always generated as private members of a class. However the visibilities
of the associated getter and setter are determined by the visibility of the attribute
specification. In this case we have specified public visibility (by using the plus sign)
and hence the username
getter and setter will be public.firstName
and lastName
to the Person
class. Make them String
type. If you prefer
a point and click interface rather than typing the specification, you can work from
the property panel and set the visibility, type, etc individual using that dialog.TimeTracker
model by selecting File > Save Project.
Congratulations! You have now specified the Person
entity of the TimeTracker
application. We are now ready to generate some code. Please go back to the main tutorial page and
continue from where you left off.