Is Not Null Unit

From WebRatio WebML Wiki

Jump to: navigation, search



Contents

Introduction

The Is Not Null Unit

The Is Not Null Unit is an Operation Unit and it's used to check whether the value passed to the unit through the parameter is null or not. The unit can follow only two different paths, depending on the result of the unit.

Properties

The Properties View of the Is Not Null Unit
  • Id: The unique key automatically assigned by WebRatio to identify the Unit (e.g. inn1).
  • Name: A meaningful name for the Unit, used as label (e.g. "Employee oid exists?").
  • Empty String As Null: A flag stating whether empty string must be treated as null value in order to decide which outgoing link must be followed.
  • Home: A flag stating that the Is Not Null Unit must be executed as the first operation when the user enters in the related Site View.
  • Default: A flag stating that the Is Not Null 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 Is Not Null 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 Is Not NullUnit 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 Is Not NullUnit, 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

An Is Not Null 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 Is Not Null Unit
  • Add Link: Adds an outgoing link (of Transport type) to the Unit, which can be used to transport information to other elements.
  • Add OK Link: Adds an outgoing OK Link to the Unit. The OK Link is activated when the input parameter has not a null value. Moreover, the OK Link will cause the execution of its target element (opens a target page or activates other Operation Units).
  • Add KO Link: Adds an outgoing KO Link to the Unit. The KO Link is activated when the input parameter has a null value. Moreover, the KO Link will cause the execution of its target element (opens a target page or activates other Operation Units).
  • 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 Is Not Null Unit

The input of the Is Not Null Unit consists of a unique Input parameter that the Unit will evaluate. To access the input parameter, open the Parameters Coupling dialog with a double click or by selecting the "Coupling" property on an incoming link to the Is Not Null Unit.



Output

Output configuration of the Is Not Null Unit

The output of the Is Not Null Unit consists of a unique Output parameter corresponding to the unique Input Parameter the Unit evaluated. To access the output parameter, open the Parameters Coupling dialog with a double click or by selecting the "Coupling" property on an outgoing OK/KO links from the Is Not Null Unit.

Here the Output Parameter can be coupled with the Input Parameter of the target element.


Examples

The purpose of this section is to show the usage of the Is Not Null Unit through examples. This example is based on the Data Model shown in the following image.

The Data Model used in the example
This Data Model consists of two Entities : "Company" and "Employee".

The "Company" entity has many attributes, such as "Name", "E-mail", "Nationality", and so on.

The "Employee" entity has attributes such as "Name", "Surname", "Email", "Role" and so on.

An Employee belongs to one Company while, obviously, a Company has many Employees. This is represented with the 1:N Relationship "Company_Employee".

Example 1: Insert Or Modify Employee

Our goal is to give the possibility to the user to create a new employee or to edit information about the present employees from the Web application. The user will be able to define all the new employee data or select an employee from the list and modify it, and then save it in the Data Model. 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 "Insert or Modify an Employee") and other properties in the Properties View (such as "Home" or "Landmark" properties) to make the page accessible.
  2. Add a Power Index Unit to the page: select the Power Index Unit icon from the palette and place it inside the page. Change the "Name" property in "Employee List".
  3. Set the Entity on which the Power Index Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  4. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the "name", "surname", "hire date" and "company" attributes from the opened dialog.
  5. Define the sort criteria of the Power Index Unit: click on the "Edit" button next to the "Default Sort Attributes" property, then choose the "name" attribute and the "ascending" sort criteria. Since the Power Index Unit is dinamically sortable, set the "Sortable" property to true and the "Sort History Size" property to 1.
  6. Define the division of the Employee List in pages: select the Power Index Unit, set the "Block Factor" property to "10" and the "Block Window" property to "10".
  7. Add an Entry Unit to the page: select the Entry Unit icon from the palette and place it inside the page. Change the "Name" property in "Employee Data".
  8. Define the Entry Unit fields:right click on the Entry Unit and select the Field Wizard option. In the opened dialog pane, select the Employee Entity. In the next pane, select the "oid", "name", "surname", "email", "birth date", "hire date" and "role" attributes. In order to modify the Company the employee belongs to, select the "EmployeeToCompany [1:N]" Relationship Role. Since all the Fields will be preloaded with the information of the selected employee, select the "Mark new fields as preloaded" checkbox.
  9. Hide the "oid" Field: expand the Entry Unit in the Outline View and select the Oid Field. In the Property View, select the "Hidden" property and deselect the "Modifiable" property.
  10. Draw a normal link between the "Employee List" Power Index Unit and the "Employee Data" Entry Unit: select the Link button from the palette and click on the "Employee List" Power Index Unit (the Source of the Link) and then on the "Employee Data" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Modify" and the Type property to "normal".
  11. 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 "oid" Attribute of the Power Index Unit with the "oid" Field of the Entry Unit,the "name" Attribute of the Power Index Unit with the "name" Field of the Entry Unit,the "surname" Attribute of the Power Index Unit with the "surname" Field of the Entry Unit,the "hire date" Attribute of the Power Index Unit with the "hire date" Field of the Entry Unit and the EmployeeToCompany.oid parameter (the primary key of the Companty the Employee is connected to) with the "Company - Preselection" Selection Field Slot.
  12. Add a Selector Unit to the page: select the Selector Unit icon from the palette and place it inside the page. Change the "Name" property in "All Companies".
  13. 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 "Company" Entity from the opened dialog pane.
  14. Define the sort criteria of the Selector Unit: click on the "Edit" button next to the "Sort Attributes" property, then choose the "name" attribute and the "ascending" sort criteria.
  15. Draw a transport link between the "All Companies" Selector Unit and the "Employee Data" Entry Unit: select the Link button from the palette and click on the "All Companies" Selector Unit (the Source of the Link) and then on the "Employee Data" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Companies data passing" and the Type property to "transport".
  16. 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 "oid" Attribute of the Selector Unit with the "Company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "Company [label]" Selection Field Slot of the Entry Unit.
  17. 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 "Employee Details".
  18. 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 "Employee" Entity from the opened dialog pane.
  19. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the Data Unit attributes from the opened dialog.
  20. Add a Modify Unit: select the Modify Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Modify selected Employee".
  21. Set the Entity on which the Modify Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  22. Add a Create Unit: select the Create Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Create a new Employee".
  23. Set the Entity on which the Create Unit is based: click on the "Edit" button next to the "Entity" property in the Properties View. Then choose the "Employee" Entity from the opened dialog pane.
  24. Add an Is Not Null Unit: select the Is Not Null Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Employee oid exists".
  25. Draw a normal link between the "Employee Data" Entry Unit and the "Employee oid exists?" Is Not Null Unit: select the Link button from the palette and click on the "Employee Data" Entry Unit (the Source of the Link) and then on the "Employee oid exists?" Is Not Null Unit (the Target of the Link). Set the Name property of the newly created Link to "Save" and the Type property to "normal".
  26. 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. Then couple the "oid" Field of the Entry Unit with the Input parameter of the Is Not Null Unit
  27. Draw an OK link between the "Employee oid exists?" Is Not Null Unit and the "Modify selected Employee" Modify Unit: select the Link button from the palette and click on the "Employee oid exists?" Is Not Null Unit (the Source of the OK Link) and then on the "Modify selected Employee" Modify Unit (the Target of the OK Link). Set the Name property of the newly created OK Link to "Employee modified".
  28. Draw an KO link between the "Employee oid exists?" Is Not Null Unit and the "Create a new Employee" Create Unit: select the Link button from the palette and click on the "Employee oid exists?" Is Not Null Unit (the Source of the OK Link) and then on the "Create a new Employee" Create Unit (the Target of the OK Link). Set the Name property of the newly created KO Link to "Employee created".
  29. Draw a transport link between the "Employee Data" Entry Unit and the "Modify selected Employee" Modify Unit: select the Link button from the palette and click on the "Employee Data" Entry Unit (the Source of the Link) and then on the "Modify selected Employee" Modify Unit (the Target of the Link). Set the Name property of the newly created Link to "Employee data passing" and the Type property to "transport".
  30. 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 "oid" Attribute of the Selector Unit with the "Company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "Company [label]" Selection Field Slot of the Entry Unit.
  31. Draw a transport link between the "Employee Data" Entry Unit and the "Create a new Employee" Create Unit: select the Link button from the palette and click on the "Employee Data" Entry Unit (the Source of the Link) and then on the "Create a new Employee" Create Unit (the Target of the Link). Set the Name property of the newly created Link to "Employee data passing" and the Type property to "transport".
  32. 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 "oid" Attribute of the Selector Unit with the "Company [output]" Selection Field Slot of the Entry Unit and the "name" Attribute of the Selector Unit with the "Company [label]" Selection Field Slot of the Entry Unit.
  33. Draw an OK link between the "Modify selected Employee" Modify Unit and the "Employee Details" Data Unit: select the Link button from the palette and click on the "Modify selected Employee" Modify Unit (the Source of the OK Link) and then on the "Employee Details" Data Unit (the Target of the OK Link). Set the Name property of the newly created OK Link to "Employee modified".
  34. 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 "oid" Attribute of the Modify Unit with the automatically created Key Condition of the Data Unit
  35. Draw an OK link between the "Create new Employee" Create Unit and the "Employee Details" Data Unit: select the Link button from the palette and click on the "Create new Employee" Create Unit (the Source of the OK Link) and then on the "Employee Details" Data Unit (the Target of the OK Link). Set the Name property of the newly created OK Link to "Employee Created".
  36. 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 "oid" Attribute of the Modify Unit with the automatically created Key Condition of the Data Unit
  37. 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 Power Index Unit
The Properties View of the Entry Unit
The "Modify" Link Parameters Coupling window
The Properties View of the Selector Unit
The "Companies data passing" Link Parameters Coupling window
The Properties View of the Data Unit
The Properties View of the Modify Unit


The Properties View of the Create Unit
The Properties View of the Is Not Null Unit
]
The "Save" Link Parameters Coupling window
The OK Link outgoing from the Is Not Null Unit Parameters Coupling window


The generated Web application


Related articles:
Category Difficulty Refers
Context Parameters Web Model Beginner Get Unit
Set Unit
Reset Unit
Create Unit Web Model Beginner Create Unit
Create a "Hello world" application Web Model Beginner Site View
WebML
WebRatio
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: 5.0/5 (1 vote cast)

Personal tools