Using session level parameters
Use session level parameters when a report or dashboard uses a hidden required parameter. The user cannot set a hidden required parameter through the Parameters page in Information Console. Instead, the user must store the parameter in the session. Information Console then retrieves the parameter for processing.
Understanding the parameter value collection sequence
When a report that uses parameters is submitted for execution, parameter values are collected in the following sequence:
1 Parameter values passed in the URL
2 Values for session level parameters
3 Parameter values in the report executable
After parameter values are collected, the Parameters page may or may not appear. The Parameters page appears in the following cases:
*The user runs the report from Information Console.
*The user runs the report using a URL that does not include invokeSubmit=true.
The Parameters page does not appear if the user runs the report using a URL that includes invokeSubmit=true. In this case, no getReportParameter API call is made to retrieve parameter values, and the parameter values collected from the URL and from session level parameters are used for report execution.
Configuring the session level parameter
To retrieve the session level parameter, Information Console needs the following information:
*The id of the session level object. This is the id used to store the com.actuate.parameter.SessionLevelParameter into the session scope.
*The value of the session level parameter. You must set the session level parameter before any report execution or report parameter collection request is sent to Information Console.
This information is provided by way of the web.xml parameter SESSION_DEFAULT_PARAMETER_VALUE_ID:
<context-param>
<param-name>SESSION_DEFAULT_PARAMETER_VALUE_ID</param-name>
<param-value>SessionDefaultParameterValue</param-value>
</context-param>
web.xml is located in <context root>\WEB-INF.
You can modify the default behavior of session level parameters by extending the Java class com.actuate.parameter.SessionLevelParameter and deploying the JAR file to the WEB-INF\lib folder.
Understanding the SessionLevelParameter Java class
com.actuate.parameter.SessionLevelParameter is the class that contains the Java code that stores and retrieves the session level report parameter. The parameter name stored in the session level parameter Java object is case-insensitive by default. The getParameterValues( ) method is called with the http servlet request object so that additional logic can be implemented to return the list of parameter values. Other SessionLevelParameter methods are listed in Table 16‑4.
Table 16‑4 SessionLevelParameter methods
Method
Description
getParameterValues(HttpServletRequest request)
This method is called internally by Information Console to retrieve the session level parameter. Since the session level parameter object is stored in the http session, you can construct your own logic based on each unique request before returning the list of parameter values to Information Console.
Parameter:
request: HttpServletRequest object.
Returns the array of com.actuate.schemas.ParameterValue
Return com.actuate.schemas.ParameterValue[ ]
getParameterValue(HttpServletRequest request, String name)
Since the session level parameter object is stored in the http session, you can construct your own logic based on each unique request before returning the list of parameter values to Information Console.
Parameter:
request: HttpServletRequest object.
name: The name of the report parameter.
Return String
setParameterValue(String name, String value)
Sets the parameter value for this parameter name.
Parameter:
name: The name of the report parameter.
value: The value of the report parameter.
Return void
Setting the session level parameter using JSP
To set the parameter name-value pair, embed the following Java code in the JSP source in the Information Console root folder as follows:
<jsp:useBean id="SessionDefaultParameterValue" scope="session" class="com.actuate.parameter.SessionLevelParameter" />
<%-- Set the application level parameter --%>
<%
SessionDefaultParameterValue.setParameterValue("param1","value1");
SessionDefaultParameterValue.setParameterValue("param2","value2");
SessionDefaultParameterValue.setParameterValue("param3","value3");
SessionDefaultParameterValue.setParameterValue("param4","value4");
SessionDefaultParameterValue.setParameterValue("param5","value5");
%>
Getting the application level parameter using JSP
Once the session level parameter is set, call one of the get methods of SessionLevelParameter to retrieve the session level parameter as follows:
<jsp:useBean id="SessionDefaultParameterValue" scope="application" class="com.actuate.parameter.SessionLevelParameter " />
<%-- get the session level parameter --%>
<%= SessionDefaultParameterValue.getParameterValue(request, "param1")%>
<%-- get all the session level parameters --%>
<%
com.actuate.schemas.ParameterValue[ ] pvs = SessionDefaultParameterValue.getParameterValues(request);
// iterate through the list of parameter values
%>
Getting the session level parameter from HttpServletRequest
Once the session level parameter is set, call one of the get methods of SessionLevelParameter to retrieve the session level parameter as follows:
// Get the session level object from servlet context
com.actuate.parameter.SessionLevelParameter SessionDefaultParameterValue = (com.actuate.parameter.
SessionLevelParameter)request.getSession().getAttribute( "SessionDefaultParameterValue");
SessionDefaultParameterValue.getParameterValue(request, "param1");