Reconnect Unit

by Mario Bruno
5,041 views Published on May 14, 2012
Applies to: All versions
Table of contents

Introduction

The Reconnect Unit
The Reconnect Unit

 

The Reconnect Unit is an Operation Unit used to modify the association between instances of two entities (the Source Entity and the Target Entity), connected by a predefined Relationship Role. The Reconnect Unit can manage single instances or sets of instances in order to connect or disconnect one instance of the Source Entity from a set of instances of the Target Entity (and vice-versa) or sets of instances of Target and Source Entities with the same cardinality (performing a pairwise connection or disconnection). The instances of the Source and the Target entities to be connected or disconnected are chosen applying Conditions.

The Reconnect Unit behaves as a Disconnect Unit and a Connect Unit executed straight afterwards. The Disconnect Unit will erase all the connections between all the Source Entity instances and all the Target Entity instances and the Connect Unit will subsequently connect the newly defined Source Entity instances with the newly defined Target Entity instances. Using Target Disconnect Conditions it is possible to explicitly choose the instances to be disconnected.

Properties

The Properties View of the Reconnect Unit
The Properties View of the Reconnect Unit

 

  • Id: The unique key automatically assigned by WebRatio to identify the Unit (e.g. rcnu1e).
  • Name: A meaningful name for the Unit, used as label (e.g. Reconnect Employee to Departments).
  • Relationship: The Data Model Relationship Role on which the Unit is based (e.g. EmployeeToDepartment).
  • Home: A flag stating that the Reconnect Unit must be executed as the first operation when the user enters in the related Site View.
  • Default: A flag stating that the Reconnect 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 Reconnect 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 Reconnect 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 Reconnect 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 Reconnect 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 Reconnect Unit
The Context Menu of the Reconnect 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 Unit performs its operation correctly and can be used to transport information. 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 Unit isn't able to perform its operation correctly and can be used to transport information. 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.
  • Add Source Key Condition: Adds a Key Condition to the Source Entity of the selected Relationship Role. This condition restricts the set of the available Source Entity instances through the primary key.
  • Add Source Attributes Conditions: Adds an Attributes Condition to the Source Entity of the selected Relationship Role. This condition restricts the set of the available Source Entity instances.
  • Add Source Relationship Condition: Adds a Relationship Role Condition to the Source Entity of the selected Relationship Role. This condition restricts the set of the available Source Entity instances.
  • Add Target Key Condition: Adds a Key Condition to the Target Entity of the selected Relationship Role. This condition restricts the set of the available Target Entity instances.
  • Add Target Attributes Condition: Adds an Attributes Condition to the Target Entity of the selected Relationship Role. This condition restricts the set of the available Target Entity instances.
  • Add Target Relationship Role Condition: Adds a Relationship Role Condition to the Target Entity of the selected Relationship Role. This condition restricts the set of the available Target Entity instances.
  • Add Disconnect Target Key Condition: Adds a Key Condition to the Target Entity of the Unit. This condition restricts the set of the available Target Entity instances that must be disconnected from the Source Entity instances through the primary key.
  • Add Disconnect Target Attributes Conditions: Adds an Attributes Condition to the Target Entity of the Unit. This condition restricts the set of the available Target Entity instances that must be disconnected from the Source Entity instances.
  • Add Disconnect Target Relationship Role Condition: Adds a Relationship Role Condition to the Target Entity of the Unit. This condition restricts the set of the available Target Entity instances that must be disconnected from the Source Entity instances.

 

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 Reconnect Unit with a relationship item
Input configuration of the Reconnect Unit with a relationship item

The input of the Reconnect Unit consists of all the Conditions defined on the Target and Source Entities of the Relationship Role on which the Unit is defined. To access the input parameters, open the Parameters Coupling dialog with a double click or by selecting the "Coupling" property on an incoming link to the Reconnect Unit. Here we can find the Conditions of the Target and Source Entities of the selected Relationship Role named with suffix [Target]{{{2}}} and [Source]

 

 

 

 

 

 

 

 

Output

 

Output configuration of the Reconnect Unit
Output configuration of the Reconnect Unit

The output of the Reconnect Unit consists of the Key Attributes of the Entities connected by the Relationship Role on which the Reconnect Unit is defined. The Entity to which the Key Attributes refers is specified in brackets. To access the Output Parameters, open the Parameters Coupling dialog with a double click or by selecting the "Coupling" property of an outgoing link from the Reconnect Unit.

 

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

 

 

 

 

 

 

 

 

 

 

 

 

Examples

The purpose of this section is to show the usage of the Reconnect Unit through examples. The "Department" entity has attributes such as "name" and "employee number", which is a Derived Attribute.

 

Example 1: Reconnect Departments to Employee

Our goal is to give to the user the possibility to select an Employee and to connect Departments without worring if they were previously connected or not. 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 "Reconnect Departments from 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" and "surname" 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 "surname" 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 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".
  8. 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.
  9. Choose which attributes of the selected Entity must be shown: click on the "Edit" button of the "Display Attributes" property. Then choose the all attributes from the opened dialog.
  10. Draw a normal link between the "Employee List" Index Unit and the "Employee Details" Data Unit: select the Link button from the palette and click on the "Employee List" Index Unit (the Source of the Link) and then on the "Employee Details" Data Unit (the Target of the Link). Set the Name property of the newly created Link to "Select" 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 key attribute of the Power Index Unit with the Key Condition of the Data Unit. This will allow the user to select a company and see its details.
    Nota
    When the Target and the Source Unit are based on the same entity or on entities connected through a Relationship, WebRatio is able to automatically set the coupling.
  12. 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 "Departments connected to the Employee".
  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 "Department" 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. Add the Condition for the connected Departments: 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="related Departments"
    • Role="EmployeeToDepartment"
    • Predicate="In"
    • Required="True"
  16. Draw a transport link between the "Employee Details" Data Unit and the "Departments not connected to the Employee" Index Unit: select the Link button from the palette and click on the "Employee Details" Data Unit (the Source of the Link) and then on the "Departments not connected to the Employee" Index Unit (the Target of the Link). Set the Name property of the newly created Link to "Selected Employee data passing to the not connected Departments list" and the Type property to "transport".
  17. 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 key attribute of the Data Unit with the Relationship Role Condition of the Selector Unit. This will allow the user to retrieve the list of departments related to the selected Employee.
    Nota
    When the Target and the Source Unit are based on the same entity or on entities connected through a Relationship, WebRatio is able to automatically set the coupling.
  18. 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 "Departments Available".
  19. Define the Entry Unit fields: right click on the Entry Unit and select the Field Wizard option. In the opened dialog, select the Employee Entity. In order to choose the Department to be connected to the employee belongs, select the "EmployeeToDepartment [N:N]" Relationship Role.
  20. Draw a transport link between the "Departments connected to the Employee" Selector Unit and the "Departments Available" Entry Unit: select the Link button from the palette and click on the "Departments connected to the Employee" Selector Unit (the Source of the Link) and then on the "Departments Available" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Connected Departments" and the Type property to "transport".
  21. 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 key attribute of the Selector Unit with the "Department - Preselection" MultiSelection Field Slot of the Entry Unit. This will allow the user to see the department connected to the employee already checked.
  22. 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 "All Departments".
  23. 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 "Department" Entity from the opened dialog pane.
  24. 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.
  25. Draw a transport link between the "All Departments" Selector Unit and the "Departments Available" Entry Unit: select the Link button from the palette and click on the "All Departments" Selector Unit (the Source of the Link) and then on the "Departments Available" Entry Unit (the Target of the Link). Set the Name property of the newly created Link to "Department List data passing to the "Department Available" Entry Unit" and the Type property to "transport".
  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.In the Parameters Coupling dialog, couple the key attribute of the "All Departments" Selector Unit with the "Department [output] MultiSelection Field slot of the "Departments Available" Entry Unit. Then couple the "name" attribute of the "All Departments" Selector Unit with the "Department [label] MultiSelection Field slot of the "Departments Available" Entry Unit}}
  27. Add a Reconnect Unit: select the Reconnect Unit icon from the palette and place it inside the Web Model. Change the "Name" property in "Reconnect Employee to Departments".
  28. Set the Relationship Role on which the Reconnect Unit is based: click on the "Edit" button next to the "Relationship" property in the Properties View. Then choose the "EmployeeToDepartments" Relationship Role from the opened dialog pane.
  29. Draw a normal link between the "Departments Available" Entry Unit and the "Reconnect Employee to Departments" Reconnect Unit: select the Link button from the palette and click on the "Departments Available" Entry Unit (the Source of the Link) and then on the "Reconnect Employee to Departments" Reconnect Unit (the Target of the Link). Set the Name property of the newly created Link to "Reconnect" and the Type property to "normal".
  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 "Departments" MultiSelection Field the Entry Unit with the automatically created Department Key Condition of the Connect Unit.
  31. Draw a transport link between the "Employee Details" Data Unit and the "Reconnect Employee to Departments" Reconnect Unit: select the Link button from the palette and click on the "Employee Details" Data Unit (the Source of the Link) and then on the "Reconnect Employee to Departments" Reconnect Unit (the Target of the Link). Set the Name property of the newly created Link to "Selected 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 Data Unit with the automatically created Employee Key Condition of the Reconnect Unit
  33. Draw an OK link between the "Reconnect Employee to Departments" Reconnect Unit and the "Employee Details" Data Unit: select the Link button from the palette and click on the "Reconnect Employee to Departments" Reconnect 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 "Department Connected".
  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 "Source oid [Employee]" Attribute of the Reconnect Unit with the automatically created Key Condition of the Data Unit
  35. 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 Web Model of the example
The Properties View of the Power Index Unit
The Properties View of the Power Index Unit
The Properties View of the Data Unit
The Properties View of the Data Unit
The Parameters Coupling window of the normal link
The Parameters Coupling window of the normal link
The Properties View of the SelectorUnit
The Properties View of the SelectorUnit
The Parameters Coupling window of the transport Link
The Parameters Coupling window of the transport Link
The Properties View of the Reconnect Unit
The Properties View of the Reconnect Unit
The Parameters Coupling window of the normal link
The Parameters Coupling window of the normal link
The Parameters Coupling window of the transport Link
The Parameters Coupling window of the transport Link
The Parameters Coupling window of the OK link
The Parameters Coupling window of the OK link

 

The generated Web application
The generated Web application