Action Definitions & Operations

Modeling Actions with WebRatio Platform
2,169 views Published on Feb 17, 2014 | Time 17 min
Applies to: 7.2 or higher

When you are working on a new Web application, you will need to implement a set of common features. In the previous lessons you learned how to model these features in IFML, concentrating on the user interaction. These features cover how to publish and maintain information, as well as the login and the logout. Nevertheless, when working on a Web application we cannot consider only the user interaction but also the application behavior to be executed when an action is triggered by the user. WebRatio Platform allows you to model both these aspects of your Web application. This lesson shows in detail how you can work with action definitions and encapsulate them in the IFML model. Moreover, you will learn about the basic set of operations that WebRatio Platform provides for modeling the application behavior and how to work with them.

Transcript

Table of contents

Action vs Action Definition

In this lesson you will review the concept of Action already covered in the lesson about the IFML notation, and introduce a new concept, the Action Definition. An Action is something that is executed after an event is triggered. The action is a part of the user interaction model stating that some business logic will be executed, and after that the user will go on navigating the application. IFML does not address business logic, but WebRatio Platform allows you to specify business logic through the concept of Action Definition. An Action Definition allows you to define the behavior of an Action. Then, once you have this definition, you can reference it from an Action inside the IFML Model. For example, the chain of operations needed to create a new company is the Action Definition for the "Create new company" action.

Module Definitions View

So since an Action triggered by the IFML Model is just a reference of an Action Definition, to use an Action in WebRatio Platform you first need to define it. All the business logic to be used inside our Web application must be placed inside a particular view that defines the Action behavior. This particular container is the Module Definitions View, which is a container of Action Definitions and of reusable portions of an interaction flow model. In order to specify an Action Definition you need to create at least one Module Definitions View.

Adding a Module Definition View

To add a new Container View for actions to your project, open the "Project" tab in the main work area, right-click on the "Module Definitions" icon, and choose the "Add" command and then "Module Definitions" option from the Project View. The best practice is to give a meaningful name to each object in your project to make it easier to recall the element’s purpose. Click on "Finish".

Action Definition

An Action Definition is the specification of a piece of business logic. It can be triggered by an event in the IFML model. An Action Definition is built using operations that allow you to handle the Business Logic. To work properly, an Action Definition needs to communicate with the IFML model by means of entry and exit points. These points are called ports. A Port is an interaction point between an Action Definition and the environment from within it is called. A Port collects interaction flows and parameters.

Adding an Action Definition

To add an Action Definition, use the "Action Definition" icon from the toolbar or right-click the work area and choose "Add" and then "Action Definition" option. To start specifying an Action Definition, double-click on it.

Port

There are four available types of Ports. Input Port: An Input Port is an interaction point between an Action and the invoking environment. An Input Port collects interaction flows and parameters arriving at the Action. By default, each action definition contains an Input Port. Output Port: An Output Port is an interaction point between the Action and the invoking environment. An Output Port collects the interaction flows and parameters going out from the Action Definition. OK and KO Ports are particular types of Output Ports used to handle the Action Definition results, which can be success or failure. When specifying an Action Definition you can use as Output Ports only OK and KO Ports. OK Port: An OK Port is an Output Port of an Action Definition that represents the success of the action’s execution. KO Port: A KO Port is an Output Port of an Action Definition that represents the failure of the action’s execution.

Adding a Port

To add a port to an Action Definition, right-click on the canvas, select "Add", and then select the kind of port you want to add to the Action Definition.

Parameter

Input and Output ports are also used to collect the parameters that are consumed and produced by the execution of the business logic contained in the Action Definition. For example an Action that updates the values of a given object needs in input the primary key of that object to identify the object to update. To add parameters to ports, simply right-click the desired port and choose the option Add Input/Output Port Parameter.

Adding a Parameter

To add parameters to ports, simply right-click the desired port and choose the option "Add" and then "Input/Output Port Parameter".

How to Reference an Action Definition from an Action

Action Definitions must be referenced from the IFML model. In WebRatio Platform the IFML model is contained inside Site Views. So, when you want to use an Action Definition you need to add an Action in the Site View. To add an Action, choose the "Action" icon from the toolbar and place it in the work area, outside of any page. Select the Action you just added in the site view and move to the Properties View. Click on the "Browse" button next to the "Action" property and choose the desired Action Definition from the opening dialog. Remember that, to make it work, you have to connect the action to some IFML model elements, with Flows and parameters.