Create UserService
This page provides directions to create the
UserService
using ArgoUML.
The model is shown below for your reference.
We will create
UserService
in a package named org.andromda.timetracker.service.
When finished, the containment tree in ArgoUML will look like the screen shot
on the right.
- 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 Create DiagramNew Class Diagram. Select the new unnamed diagram
and type in Services as its name on the property panel.
The diagram is created and opened in a new window.
- 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. Double-click
on the operations compartment (the bottom one) of the
UserService
class
to create a new operation. A new operation is inserted with the specification
"+newOperation() : void". Write over this specification with this new one:
"+getAllUsers() : Collection<UserVO>".
- Similar to creating new attributes, you can also create new operations from
the property panel if that fits your work style better. Click on the
New Attribute Tool
and fill in the name, visibility, and return type on the Operation property panel
for the newly created operation. The property panel provides more explicit
guidance, but typing a specification on the diagram tends to be faster for
experienced users.
- Make sure your class diagram matches the one shown above.
- Make sure that the ArgoUML explorer pane matches the screen shot shown above.
- Save the model by selecting FileSave Project (or just type keyboard
accelerator Ctrl/S).
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.