Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Introduction

This document explains techniques for controlling access to data used in action sequence, in the Pentaho BI Platform. It assumes familiarity with the Pentaho BI Platform, creating action sequences using the action sequence editor, and SQL database queries.  We recommend reading the Creating Pentaho Solutions guide and Getting Started with Design Studio prior to reading this document.

Motivation

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 Action

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 that exist in either global and/or session scope.

Info
titleWhat is session and global scope?

TODO

In addition, the output is available to portlets and/or Servlets/jsps. This behavior is configured in the pentaho.xml file.
(scope="global")
(scope="session").
(org.pentaho.ui.portlet.PentahoPortletSession)
(org.pentaho.core.session.PentahoHttpSession)

Configuring System Actions

(TODO: explain where the pentaho.xml file lives). System actions are configured by adding the appropriate child elements to the <system-action> element in the pentaho.xml file.

---------------------------- what to do with this junk? --------------

Info
titleWhat is session and global scope?

TODO

In addition, the output is available to portlets and/or Servlets/jsps.
(scope="global")
(scope="session").
(org.pentaho.ui.portlet.PentahoPortletSession)
(org.pentaho.core.session.PentahoHttpSession)
--------------------------------------------

Configuring System Actions

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 the your action sequence that is to be run as a system action 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:

...

and place it inside the <system-action> node in the pentaho.xml.

As another example, suppose your action sequence is called setCompanyName.xaction, it exists in the repository under samples/filters, you want the action sequence to run when the system starts up with the output placed in global scope, and you want the output of the action sequence to be available in a Servlet/jsp, you would write this xml element:

Code Block
<org.pentaho.core.session.PentahoHttpSession scope="global">
   samples/filters/setCompanyName.xaction
</org.pentaho.core.session.PentahoHttpSession>
Info
titleLet's Break it Down

Let's break it down a bit using the previous example. We make the output of the action sequence available to portlets by creating the XML element <org.pentaho.ui.portlet.PentahoHttpSession>. We make the output available in global scope by adding the scope="global" attribute to our element. And we identify the name and location of our action sequence by adding samples/filters/setCompanyName.xaction as a child text node of our xml element.

Your pentaho.xml file would look something like this:

...

This code was developed with the Pentaho Pre-configured Install, using the SampleData database that comes with the Pre-configured Install.

Developing an Action Sequence to Run As a System Action

In this example we'll develop an action sequence to generate an HTML report containing financial data for the current user's region. This suggests that when the user logs in, we need to identify the user's region, and store this information someplace that we can user later in our action sequence.
To identify the user's region, let's create a new action sequence in Eclipse using the action sequence editor.

...