|
4.9 How to Model Services and Operations A service (or session) is a collections of defined functions (or business methods). Each method can be called separately and linked methods are collected into a service, so that they can be found easily, and to stop possible naming conflicts. Most dataviews have a session object as a facade. These session objects provide the services to the presentation layer through a remote delegate. This way all access to the service layer operations, whether ultimately provided by a dataview, handcrafted or a call out to functionality external to the system goes through a single type of interface. The business methods wrap up transactions when it comes to altering the database. A first call into any business method on a service starts the transaction and when it returns its value the transaction is ended. Any failure should roll back all the previous changes to the database that are made using standard dataview functionality. This will not be the case for callouts to external operations. You model services as stereotyped classes. You can do this by selecting a stereotyped class from the pallet by clicking on the Class Diagram Drawer in the palette to open it, finding the class creation section, clicking on the arrow on the right, which will bring up a menu allowing you to select a stereotyped component. Then pick "Create new session class" when placing it on the diagram.
Alternatively you can create a standard class from the same place in the palette and add a session stereotype using the Add Stereotype button in the stereotype tab of the properties view. There are very few properties available for changing, userNameBase and style. You probably will not need to set these as they currently have no effect on the standard transform, but if you do because your architect has implemented functionality, they will be available on the stereotype tab of the properties view. The name may be changed on the general tab. Business methods are the name for the individual operations on the entity. The may take one or more parameters, execute some functionality and return a value. As a standard all business methods are stateless. That is they do not depend on other methods that have been called or what you last called the method with. To add a business method to a service right-click on the session object, either in the diagram editor or the model explorer, add UML, operation. Alternatively, select the entity, go to the attributes tab on the properties view and press the small circle to the right hand side. You will need to fill in a name, and stereotype the operation as a business method. By selecting the method on the diagram or in the model explorer you can add the stereotype in the stereotype tab of the properties view. This will also make the JeeWiz business method properties available. There are two ways of handling input and output. The first is using return types and parameters. This is pretty much standard. The return type is filled in on the general tab of the business method and parameters are filled in the parameter tab of the business method. Both the return type and the parameter type primitives (including String and Date) should be selected from the JeeWizScreenMMLibrary section of possible types. You can create a new parameter by pressing the red circle to the right of the parameter tab window of the properties view. There are no properties associated with parameters in version 3.9.0 and so there is no need to add a parameter stereotype. If you want to pass in or return a class of object that is generated, such as a value object, RSA will not let you just type it in, so you can model a dummy unstereotyped class of the relevant name. You should never try to pass dataview objects directly and it is expected that in future releases dataview names and entity names will be handled as value objects by default. The second way of specifying input and output is by setting the inputDataView and resultDataView properties of the businessMethod. This is normally only used on a method slaved directly into an event. What actually are passed in and returned are the value objects and change objects associated with the named dataviews. Links:
Copyright © 2001-2006 New Technology / enterprise Ltd. | |||||||||||||||||||||