Getting started with the Parameter Collector Unit

From Wiki

Jump to: navigation, search


The Parameter Collector Unit is available starting from the WebRatio 5.1 version. It's an operation unit, which means that it can be placed in every View (SiteView, ModuleView, ServiceView).It permits to collect a set of parameters coming from multiple sources and to redistribute them to multiple targets. Its main purpose is to reduce the usage of passing parameters in order to transport parameters from multiple content units of a source page into one or more target units.


It's possible configure the unit by adding a variable number of Parameter Collector elements. There are two different ways to add the Parameter Collector elements to the unit.

  • Right click on the unit and choose the Add Parameter Collector command. Once added the parameter it's possible to give a custom name to it.
  • Use the Parameter Collector Wizard. To open the wizard right click on the unit and choose the Parameter Collector Wizard.. command. Note that in order to successfully use the wizard it's necessary that the Parameter Collector Unit has at least one normal incoming link. The tool checks this constraint and if it is not satisfied shows a warning dialog.
Image:ParameterCollectorWizard.png Image:ParameterCollectorDialog.png

Working with the Parameter Collector Unit

Suppose you want to model a page to manage the personal data of a customer. It's possible to create a new customer or to modify an existing customer. The resulting Web Model can be something like the image on the right. You can realize the example model following the WebRatio Tutorial "Creating a simple datacentric application". In particular you have to reach the end of the second task. Otherwise you can start a project from scratch achieving the same result.

Let's look carefully to the Web Model. There are four transport links outgoing from the page and bringing information to the operation chain. In particular there are:

  • a link for transporting the current editing customer to the Is Not Null unit.
  • a link for transporting the current editing customer to the Modify Unit in order to change the personal info of the customer the user is editing.
  • a link for transporting the new personal info of the customer to the Modify Unit.
  • a link for transporting the personal info of a new customer to the Create Unit.

Notice how these four transport links do not carry different information, but the same information to different units. It's possible to use the Parameter Collector Unit in order to simplify and make the model more readable.

Let's see how to change this simple Web Model in order to use few links.

  1. Add a Parameter Collector Unit outside the page.
  2. Draw a link connecting the Entry Unit and the Parameter Collector Unit. In the Properties View choose "Save" for the Name and "Normal" for the Type.
  3. Draw a link connecting the Selector Unit and the Parameter Collector Unit.
  4. Right click on the Parameter Collector Unit and choose the Parameter Collector Wizard command. In the opening dialog choose the parameters that you want that the unit collect for the operation chain and click on the Finish button. You can see an example on the right.
  5. Connect the Parameter Collector Unit to the Is Not Null Unit with an OK link. Opening the Coupling Dialog and couple the "Customer Details.oid" parameter with the "Input Value" parameter of the Is Not Null Unit.
  6. Delete the transport link connecting the Selector Unit with the Is Not Null Unit, the Modify Unit and the Create Unit.
  7. Connect the Parameter Collector Unit to the Modify Unit with a transport link. Open the Coupling Dialog and couple the Customer Data.name" and "Customer Data.surname" paramters with the attributes of the Modify Unit. Repeat the same operation with the Create Unit.

You can see the resulting Web Model in the following image.


Related articles:
Category Difficulty Refers
Context Parameters Web Model Beginner Get Unit
Set Unit
Reset 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
Getting started with Groovy Technical Reference Beginner Script Unit
Template
… further results