Analysis › Detailing the Business Rules › Lesson Activity › Add the Process Logic to CALCULATE GOLFER HANDICAP INDEX › Match Views
Match Views
There are several changes that need to be made to the synthesized action diagram, the most important of which is reading the golfer's scoring records and passing them to the component to calculate the handicap index. To pass information from one action diagram to another, you have to match the views in one diagram to the desired views in the other diagram.
The called action diagram always receives the information being passed to it in one or more of its import views. The calling action diagram can match views in its imports, locals, or entity actions to the imports of the called action diagram.
Once called, the called action diagram does whatever it is that it is supposed to do and puts any information that it needs to pass back to the calling action diagram in its export views.
The export views of the called action diagram can then be matched to the export views of the calling action diagram or a local view of the calling action diagram.
The following picture illustrates these options. Keep in mind that these are the standard view matching rules or guidelines. There can be exceptions to these rules.
In addition, only like views can be matched. In other words, a CUSTOMER can be matched to a CUSTOMER, an ORDER to an ORDER, and a PRODUCT to a PRODUCT, but you cannot match a CUSTOMER to a PRODUCT.
In our action diagram, we want to add the call to the component operation iglf1011_golfer_computeindex_s. The statement you use to call another action diagram is the USE statement.
Follow these steps:
- Select the WHEN successful clause of the READ golfer statement. From the Menu Bar, then select Edit, Add Statement, and then Useā¦. In the Add Statement dialog, the Public Operation has already been selected for us. That is because it is the only action diagram available to be called. So far, the only other action diagrams in our model are the elementary process action diagrams and, by definition, an elementary process cannot call another elementary process when doing action diagramming during analysis (when doing action diagramming during design, this restriction is lifted). However, elementary processes can call common action blocks.
- When we select the Add push button, the Toolset is going to take us through a dialogue in which we are prompted to match the views. It will first prompt for the import views, and then for the export views. Since only like views can be matched, we will copy the views from the import and export views of the called action diagram into our calling action diagrams local views and match them at the same time. Select the Add push button.
- To the left side of the dotted line in the following picture of the Import View Matching dialog, it shows the import views of the called action diagram; in this case, the import views of the iglf1001_golfer_computeindex_s Public Operation. To the right side of the dotted line is the view from the calling action diagram that has been matched to the import view shown on the left side. Presently there are none matched. As you select an import view of the called action block on the left side to match to some view from the calling action block, you will be presented with a list of possible supplying views from the calling action block to choose from in the bottom panel.
This is the general outline for performing this process:
- Choose one import view from the called action block shown to the left side of the top panel.
- Choose the appropriate view from the calling action block that you want to match to the selected import view from the choices given in the bottom panel.
- Select the Match push button to match them together.
When matched, you would see the two views side by side in the top panel. You would then repeat this process for all of the required import views in the called action block. Once you have completed matching all of the import views that are necessary, you would select the Close push button and then go through the same process for the export views of the called action diagram.
- In the top panel, select the import view group (r) IMPORT_GROUP_OF_SCORING_RECORDS.
Note: In the bottom panel we are shown all of the views in the calling action diagram that can be matched to the selected import view of the called action diagram.
Right now, there are none. All we see are the place holders for the Import Views, Export Views, Local Views, and Entity Action Views. Therefore, we want to create appropriate views and match them to this import view.
By selecting the Match push button without selecting anything in the lower panel, the Toolset knows that we want to copy the selected view into the calling action diagram and match the two views together. Select the Match push button. In the View Match and Copy dialog, it assumes we want to copy this view into the import view. Most of the time that is a good assumption, but in this case we actually want to copy the view into the Local views. Select the Local radio button and then select the Copy push button.
- When copying views, the Toolset shows you the name of the view that you are copying and asks you for the name you want to use for the new view. In the Copy Local Group View dialog, enter local group of scoring records and select the OK push button. In the Copy Import Work View dialogs, enter local group twice (once for each of two dialogs)p and select the OK push button.
- Now we can see that the import group view in iglf1001_golfer_computeindex_s has been copied into and matched to a local view in calculate_golfer_handicap_index. To see the previously shown expanded views, select IMPORT_GROUP_OF_SCORING_RECORDS and then select the Expand push button. We have no other import views that need to be matched, so we can select the Close push button.
- In the Export View Matching dialog, we have two exports of the called action block that need to be matched. Select the first view of EXPORT in the top panel. Then, without selecting anything in the bottom panel, select the Match push button. This indicates to the Toolset that we want to copy this view into the calling action diagram and match the two together. It assumes that we want to copy the view into the calling action diagram's export view. Most of the time that can be correct but in this particular case we want to copy it into a local view. Select the Local radio button and then select the Copy push button. When prompted for a view name, enter local and then select the OK push button. Do the exact same thing for the EXPORT ERROR HANDLING view. Expand the two views and review them if desired, then select the Close push button.
- Save your model. At this point, the action diagram should look like the following example:
In our action diagram, we can see the new USE statement that invokes the iglf1011_golfer_computeindex_s public operation. We can also see that the public operation imports from our local group of scoring records and exports to our local views of iglf1011 golf scoring record and error handling, all of which were copied from the public operation's import and export views.
Copyright © 2013 CA.
All rights reserved.
|
|