...
When developing an action sequence, you may need to restrict a user's view of the available data based on some criteria. For instance, you may develop an action sequence that queries a database for financial information, and displays the financial information in a web page. However you may want to restrict a user's view of the financial data to the data from the user's region (e.g. Eastern, Southern, Western, Northern). You can use a system action to assist in filtering the data provided to the user.
System
...
Actions
A system action is simply an action sequence that is configured to run either at system start time (i.e. when the application server starts) or session start time (i.e. when the user logs in). The output of a system action is available to other action sequences as input parameters. These input parameters are available in either session or global scope (depending on how the System Action is configured). System actions are configured by adding the appropriate child elements to the <system-action>
element in the pentaho.xml file.
...
Note |
---|
...
|
...
|
...
The first step in configuring a system action is to locate and edit the pentaho.xml. In the Pentaho Preconfigured Install, the pentaho.xml file is located in the pentaho-demo/system
folder.
...
| |
In order to reduce the amount of time it takes to start the platform, System Actions configured to run at global scope are run in a lazy manner. The platform postpones running the global System Actions until it absolutely has to run them. It has to run them when the first user session is initiated. When the first user session is initiated, all of the global System Actions run, and then all of the session System Actions run. When the second and following user sessions are initiated, only the session System Actions run. |
Configuring System Actions
Anchor | ||||
---|---|---|---|---|
|
The first step in configuring a system action is to locate and edit the pentaho.xml. In the Pentaho Preconfigured Install, the pentaho.xml file is located in the pentaho-demo/system
folder.
You configure a system action by adding information about your action sequence to the <system-action>
node of the pentaho.xml file. For instance, if your action sequence is called usernameToRegion.xaction
, it exists in the repository under samples/filters
, you want the action sequence to run when the user logs in, with the output placed in session scope, and you want the output of the action sequence to be available in a portlet, you would write this xml element:
...
We want to make the variable strRegion
available to action sequences that the user may execute later in their session. So we need to place strRegion
into the user's session. To do this, add the variable strRegion
to the Script Outputs, and identify its type as string
. Once we've done this, you'll notice that in the Process Actions tree control, the script output shows up under our JavaScript action. This identifies strRegion
as an output of the JavaScript action, but we need it to be an output of our action sequence. Actions tree control, the script output shows up under our JavaScript action. This identifies strRegion
as an output of the JavaScript action, but we need it to be an output of our action sequence.
Info | ||
---|---|---|
| ||
In general, action sequences configured to run at global scope should place their output in global scope. |
To make strRegion
an output of our action sequence, in the Process Actions tree control, drag and drop strRegion
onto the outputs in the Process Outputs tree control. You'll notice that this will open the Process Output editor in the right pane. In the Process Output editor, click in the first cell of the table, this will display a combo box with a list of scopes (e.g. request, session, global, etc.) We want to place strRegion
into the session scope, so select session from the combo box. At the conclusion of the action sequence, strRegion
will be in the user's session, available to any action sequence executed by the user.
...