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.

  1. In the timetracker model create a package called service under org.andromda.timetracker.
  2. 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.
  3. Add a new class to the diagram and name it UserService.
  4. Add the stereotype called Service to UserService.
  5. 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.
  6. Now double-click the operation to open the Operation Specification dialog box.
  7. 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.
  8. Make sure your class diagram matches the one shown on the right.
  9. Make sure that the MagicDraw containment tree matches the screen shot shown below.
  10. Save your timetracker model by selectingFile > Save Project.
  11. 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.