Set Unit

From WebRatio WebML Wiki

Jump to: navigation, search



Contents

Introduction

The Set Unit

The Set Unit is a Session Unit and it's used to store values into Global Parameters. It is also an Operation Unit. For more information about Context Parameters you can find further information in the Context Parameters article.


Properties

These are the available properties of a Set Unit

The Properties window of the Set Unit
  • Id: The unique key automatically assigned by WebRatio to identify the Unit (e.g. gtu1e).
  • Name: A meaningful name for the Unit, used as label (e.g. Get Oid User Logged).
  • Context Parameters: The list of Context Parameters whose values must be retrieved by the Unit.
  • Home: A flag stating that the Set Unit must be executed as the first operation when the user enters in the related Site View.
  • Default: A flag stating that the Set Unit must be executed as the first operation when the user enters the Area containing the Unit.
  • Landmark: A flag stating that the link shown in the corresponding Landmark menu that will activate the Unit. If the operation or the operation chain has no outgoing link, the final target page will be the last page visited.
  • Protected: A flag stating that the access to the Set Unit is granted only to users belonging to groups entitled to access to it.
  • Secure: A flag stating that all the links that can activate the Set Unit are implemented using the Secure HTTP protocol, instead of the HTTP protocol.
  • Custom Descriptor: A flag stating that the Unit uses a Custom Descriptor.
  • Custom URL Name: The Custom URL Name of the Unit. It is possible to define a custom name that will be used as URL to reach the Set Unit, instead of the standard Id (used by default). The custom URL name must not contain whitespaces, non-ascii characters or other special characters like /, ?.


Configuration

A Set Unit can be configured through a context menu that can be reached right clicking on the Unit either in the Work Area or in the Outline View. The context menu contains the following options:

The Context Menu of the Set Unit
  • Add Property: Adds a custom property to the Unit. A Property is composed by Name and Value and permits to mark the element for different purposes.


Input and Output

The Input and the Output of the Unit are accessible through the Parameters Coupling window of incoming and outgoing Links respectively.

Input

Input configuration of the Set Unit

The input of the Set Unit consists of all the Context Parameters defined in the "Context Parameters" property of the Unit. To access Output Parameters, open the Parameters Coupling dialog with a double click or by selecting the "Coupling" property on an outgoing link from the Set Unit.

Here all the Context Parameters accessed by the Unit are listed.


Output

The Set Unit doesn't support outgoing links.

Example

Example 1 Set User Language

Our goal is to give to the user the possibility to set the language used to browse the Web application. In order to accomplish this example, it is necessary to go through the following steps:

  1. Add a Page to the Site View: select the "Page" icon from the palette, and place it on the Site View. Change the page name (setting "User Details") and other properties in the Properties View (such as "Home" or "Landmark" properties) to make the page accessible.
  2. Add a Get Unit to the page: select the Get Unit icon from the palette and place it inside the page. Change the "Name" property in "Current User".
  3. Set the Context Parameter on which the Get Unit is based: click on the "Edit" button next to the "Context Parameter" property in the Properties View. Then choose the "UserCtxParam" Context Parameter from the opened dialog pane.
  4. Add a Data Unit to the page: select the Data Unit icon from the palette and place it inside the page. Change the "Name" property in "User Details".
  5. Set the Entity on which the Data Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "User" Entity from the opened dialog pane.
  6. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the "username" and "email" attributes from the opened dialog.
  7. Draw a transport link between the "Current User" Get Unit and the "User Details" Data Unit: select the Link button from the palette and click on the "Current User" Get Unit (the Source of the Link) and then on the "User Details" Data Unit (the Target of the Link). Set the Name property of the newly created Link to "retrieve current user" and the Type property to "transport".
  8. Add an Selector Unit to the page: select the Selector Unit icon from the palette and place it inside the page. Change the "Name" property in "User's Language".
  9. Set the Entity on which the Selector Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Language" Entity from the opened dialog pane.
  10. Add the Condition for the user language: right click on the Selector Unit and choose "Add Relationship Role Condition" from the Context Menu. Select the newly added Condition from the Outline View and configure the properties as follow:
    • Name="user"
    • Role="UserToLanguage"
    • Predicate="In"
    • Required="True"
  11. Draw a transport link between the "User Details" Data Unit and the "User's Language" Selector Unit: select the Link button from the palette and click on the "User Details" Data Unit (the Source of the Link) and then on the "User's Language" Selector Unit (the Target of the Link). Set the Name property of the newly created Link to "retrieve user language" and the Type property to "transport".
  12. Add a Set Unit to the page: select the Set Unit icon from the palette and place it outside the page. Change the "Name" property in "Set Language".
  13. Set the Context Parameter on which the Set Unit is based: click on the "Edit" button next to the "Context Parameter" property in the Properties View. Then choose the "LanguageISOCtxParam and CountryISOCtxParam" Context Parameter from the opened dialog pane.
  14. Draw a transport link between the "User's Language" Selector Unit and the "Set Language" Set Unit : select the Link button from the palette and click on the "User's Language" Selector Unit (the Source of the Link) and then on the "Set Language" Set Unit (the Target of the Link). Set the Name property of the newly created Link to "set language" and the Type property to "transport".
  15. Define the parameters coupling: open the Parameters Coupling window of the newly created link in order to define the coupling between the output parameters of the source Unit and the input parameters of the target Unit.In the Parameters Coupling dialog, couple the "languageISOCode" Attribute of the Selector Unit with the "LanguageISOCtxParam" Context Parameter of the Set Unit and the "countryISOCode" Attribute of the Selector Unit with the "CountryISOCtxParam" Context Parameter of the Set Unit.
  16. Generate the Web application: click on "Generate Full Web Project" on the WebRatio Menu Bar. Once the generation process has completed, it is possible to start the application server and test the Web application.
The Web Model of the example
The Properties View of the Get Unit
The Properties View of the Data Unit
The Properties View of the Selector Unit
The Properties View of the Set Unit
The coupling of the "Set language" transport link


Related articles:
Category Difficulty Refers
Connect Unit Web Model Beginner Connect Unit
Context Parameters Web Model Beginner Get Unit
Set Unit
Reset Unit
Create Unit Web Model Beginner Create Unit
Create a "Simple data centric" web application Web Model Beginner Site View
WebML
WebRatio
Custom Locations and Master pages Web Model Beginner Master Page
Custom Location
… further results












Did you find this article useful? Please rate it!

Rating: 0.0/5 (0 votes cast)

Personal tools