Passing Private Parameters Passing Page Parameters and Mapping Public Portlet Parameters

Creating PLSQL Portlets 8-25 ■ wwpro_api_parameters.get_names returns the names of the parameters that are passed on to a specified portlet that is identified by the reference path. The returned list is a PLSQL table of the owa.vc_ar type that is defined as follows: type vc_arr is table of varchar232000 index by binary_integer; For example: l_names owa.vc_arr; ... l_names := wwpro_api_parameters.get_names p_reference_path = p_portlet_record.reference_path; ■ wwpro_api_parameters.retrieve returns the names and values of all of the portlets parameters. For example: procedure show_portlet p_portlet_record in out wwpro_api_provider.portlet_runtime_record is l_names owa.vc_arr; l_values owa.vc_arr; ... begin ... wwpro_api_parameters.retrieve l_names, l_values; for i in 1..l_names.count loop htp.pParameter Name: ||l_namesi; htp.pParameter Value: ||l_valuesi; htp.br; end loop; ... end show_portlet;

8.6 Accessing Context Information

Whenever a user accesses a page in Oracle Portal, a public session is established. When the user logs in to Oracle Portal, the public session becomes an authenticated session. This session contains several pieces of context information about the user, such as user name, current session ID, IP address, and language preference. It also includes supporting information such as the Oracle Portal schema currently in use. Session context services return information about a users session and are available through the wwctx_api package.

8.6.1 Using Context Information

The general model for working with the session context is as follows:

1. Identify the piece of information you require for your functionality.

2. Use the appropriate method from wwctx_api to get and optionally set this value.

Table 8–5 lists the function calls used to obtain the various pieces of session information. Note: Portlet parameter names should not start with an underscore _ because those parameters are reserved for internal use by Oracle Portal and are not passed to the portlet. 8-26 Oracle Fusion Middleware Developers Guide for Oracle Portal

8.6.2 Using wwctx_api to Obtain Context Information

The services example, located in ..\pdkplsql\pdk\plsql\svcex in PDK-PLSQL pdkplsql.zip, illustrates how you can obtain session information using the wwwctx_api package. You can browse through this example as follows to see how the function calls are implemented in a portlet:

1. Open the services_portlet.pkb file in an editor.

2. Find the get_portlet_info function.

3. Notice the usage of wwctx_api.get_user to derive the user information and set

that value in the portlet information record: ... l_portlet.timeout := null; l_portlet.timeout_msg := null; l_portlet.created_on := to_date10192000, MMDDYYYY; l_portlet.created_by := wwctx_api.get_user; l_portlet.last_updated_on := to_date10192000, MMDDYYYY; l_portlet.last_updated_by := wwctx_api.get_user; l_portlet.has_show_edit_defaults := true; l_portlet.has_show_preview := true; l_portlet.preference_store_path := PORTLET_PATH; ...

4. wwctx_api.get_user is used similarly in various places throughout

services_portlet.pkb. Search the code for other occurrences of wwctx_ api.get_user.

5. Another example of getting context information occurs in the is_runnable

function: function is_runnable p_provider_id in integer ,p_reference_path in varchar2 Note: For more information on the context APIs, see the PLSQL API Reference. The API Reference can be found on Portal Center http:portalcenter.oracle.com or, if you downloaded PDK-PLSQL pdkplsql.zip, in ..\pdkplsql\pdk\plsql\doc. Table 8–5 Context Information Function Calls Session Information Function Call Current user wwctx_api.get_user Login status of user wwctx_api.is_logged_on Login time wwctx_api.get_login_time Language wwctx_api.get_nls_language Current session id wwctx_api.get_sessionid IP address of user client wwctx_api.get_ip_address User schema wwctx_api.get_db_user Oracle Portal schema wwctx_api.get_product_schema Oracle Portal version wwctx_api.get_product_version