We now have the the entities and value objects modeled and we need to add services that will operate on these objects. Here we will create theTimeTrackingService. For this tutorial we will create one method on the service called GetAllTimecards method which will return all the timecards in the system. The model for the TimeTrackingService looks like this:

  1. Create a new diagram by right clicking on the Service package and clicking New Diagram |Class Diagram. Set the name of the diagram to Service Diagram and clickOk.
  2. Click the Class tool in the toolbar and make a new class on the surface. Double click on the class, name itTimeTrackingService, and add the Service stereotype to it.
  3. Right click on the TimeTrackingService class and select Insert New Operation. Add a method called GetAllTimecards() that returns typeTimecardVO[].

    Note: Sometimes if you type TimecardVO[] on the diagram surface, MagicDraw will set the type to TimecardVO with a return type modifier of[]. This is incorrect, as you want the return type to be TimecardVO[] with no return type modifier set. This can be changed by double clicking on the method name and using the Operation Specification dialog.

  4. Drag the Timecard class onto the diagram. Click the Dependency tool and draw a dependency from the TimeTrackingService class to the Timecard class. Adding this dependency tells AndroMDA to make it easy to access the timecard data access class from methods inside in the TimeTrackingService class.
  5. Save your model by clicking the Save tool.