Create UserService
This page provides directions to create the
UserService
using MagicDraw 16.5.
We will create
UserService
in a package named org.andromda.timetracker.service.
- In the
timetracker
model create a package called
service
under
org.andromda.timetracker.
- In the Containment Tree on the left, right-click on the
service
package
and select
New Diagram > Class Diagram. The diagram is created and opened in a new window. Type in
Services
as the name of this diagram
and press Enter.
- Add a new class to the diagram and name it UserService.
- Add the stereotype called
Service
to UserService.
- Let's add the
getAllUsers()
method to UserService. Right-click
on the
UserService
class and selectInsert New Operation. A new operation
is inserted with the specification unnamed1(). Change the operation specification
with this new one: getAllUsers() After typing the
operation name click outside the class exit the edit mode.
- Now double-click the operation to open the Operation Specification dialog box.
- Choose
UserVO
in the Return Type drop-down. Go to Parameters list, select the return parameter (the only parameter)
and set its Multiplicity to *. ClickClose.
- Make sure your class diagram matches the one shown on the right.
- Make sure that the MagicDraw containment tree matches the screen shot shown below.
- 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.
We are now ready to generate code for the UserService. Please go back
to the main tutorial page and continue from where you left off.