| Oracle Application Server Portal PL/SQL API Reference - 904 | |||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||
| SUMMARY: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | DETAIL: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | |||||||
This package contains procedures and functions to set, get, and delete preference values.
The procedures and functions are used to store and retrieve the
following items:
Preference storage settings are unique to each portlet instance, based on a hierarchical name space and persistence. Different procedures and functions provide access to preference values according to the implementation type: varchar2, date, number, or string.
Preference values associated with preference names are stored in native form. That is, the attribute might have been defined to use the logical type COLOR, which has a native implementation type of varchar2. So the value for this attribute is stored as type COLOR in varchar2.
For a given preference name, values can be set (and scoped) at different levels: user, group, or system-wide. For a user-level or a group-level setting, a valid user name, user ID, group name, or group ID must be specified. For example:
wwpre_api_value.set_value_as_string ( 'ORACLE.TOOLS.PORTAL.STYLE', -- preference path 'BGCOLOR', -- preference name wwpre_api_value.USER_LEVEL_TYPE, -- level name wwctx_api.get_user, -- level type constant wwnls_api.AMERICAN, -- language constant used to load the type '#FFCCFF' -- the actual value to be stored );
| Exception Summary | |
GENERAL_PREFERENCE_EXCEPTION | |
| Constant Summary | |
GROUP_LEVEL_TYPE | varchar2(4) |
INHERIT_LEVEL_TYPE | varchar2(4) |
SYSTEM_LEVEL_ID | integer |
SYSTEM_LEVEL_TYPE | varchar2(4) |
USER_LEVEL_TYPE | varchar2(4) |
| Function/Procedure Summary | |
delete_value | |
delete_value_by_id | |
get_value_as_date | date |
get_value_as_date_by_id | date |
get_value_as_number | number |
get_value_as_number_by_id | number |
get_value_as_string | varchar2 |
get_value_as_string_by_id | varchar2 |
get_value_as_varchar2 | varchar2 |
get_value_as_varchar2_by_id | varchar2 |
set_value_as_date | |
set_value_as_date_by_id | |
set_value_as_number | |
set_value_as_number_by_id | |
set_value_as_string | |
set_value_as_string_by_id | |
set_value_as_varchar2 | |
set_value_as_varchar2_by_id | |
| Exception Detail |
GENERAL_PREFERENCE_EXCEPTION exception
| Constant Detail |
GROUP_LEVEL_TYPE constant varchar2(4) := 'G'
INHERIT_LEVEL_TYPE constant varchar2(4) := 'I'
SYSTEM_LEVEL_ID constant integer := 0
SYSTEM_LEVEL_TYPE constant varchar2(4) := 'S'
USER_LEVEL_TYPE constant varchar2(4) := 'U'
| Function/Procedure Detail |
procedure delete_value(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_name in varchar2
) Example:
wwpre_api_value.delete_value
(
p_path => 'ORACLE.TOOLS.PORTAL.STYLE',
p_name => 'BGCOLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_name => wwctx_api.get_user
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value needs to be deleted.p_level_name - The user name or group name of the value to
be deleted. Note that if the level type is SYSTEM,
then level name must be NULL.GENERAL_PREFERENCE_EXCEPTION - if the value has not been
deleted
procedure delete_value_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_id in integer
) Example:
wwpre_api_value.delete_value_by_id
(
p_path => 'ORACLE.TOOLS.PORTAL.STYLE',
p_name => 'BGCOLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.get_user_id
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value needs to be deletedp_level_id - the user ID or group ID for the value
to be deleted. If not specified, this procedure
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.GENERAL_PREFERENCE_EXCEPTION - if the value has not been
deleted
function get_value_as_date(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_name in varchar2 default null
) return dateIf a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_modified_date := wwpre_api_value.get_value_as_date
(
p_path => 'company.portal.portlet.'||l_portlet_id',
p_name => 'modified_date',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_name => wwctx_api.get_user
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrieved.p_level_name - the user name or group name for which the
value will be retrieved. If not specified,
this function searches for a valid value based on
path, name, and level type. For user-level or
group-level type, the level name or level
ID must be specified.
function get_value_as_date_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_id in integer default null
) return dateIf a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_modified_date := wwpre_api_value.get_value_as_date_by_id
(
p_path => 'company.portal.portlet.'||l_portlet_id',
p_name => 'modified_date',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.get_user_id
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be retrieved. If not specified, this function
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.
function get_value_as_number(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_name in varchar2 default null
) return numberIf a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_number_value := wwpre_api_value.get_value_as_number
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_SIZE',
p_level_type => wwpre_api_value.GROUP_LEVEL_TYPE,
p_level_name => 'TEST_GROUP'
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_name - the user name or group name for which the
value will be retrieved. If not specified,
this function searches for a valid value based on
path, name, and level type. For user-level or
group-level type, the level name or level ID
must be specified.
function get_value_as_number_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_id in integer default null
) return numberIf a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_number_value := wwpre_api_value.get_value_as_number_by_id
(
p_path => 'ORACLE.TOOLS.PORTAL.STYLE',
p_name => 'BGCOLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.get_user_id
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be retrieved. If not specified, this function
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.
function get_value_as_string(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_name in varchar2 default null,
p_language in varchar2
) return varchar2This function returns the value of the preference as a text string. It gets the text string by calling the preference's type handling object to convert the value from its native form into string form.
If a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_varchar2_value := wwpre_api_value.get_value_as_string
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_COLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_name => 'TEST_GROUP',
p_language => wwctx_api.get_nls_language,
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_name - the user name or group name for which the
value will be retrieved. If not specified,
this function searches for a valid value based on
path, name, and level type. For user-level or
group-level type, the level name or level
ID must be specified.p_language - the language to load the type for the preference
valueVALUE_ERROR - if the type specified for the value is invalid.
function get_value_as_string_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_id in integer default null,
p_language in varchar2
) return varchar2This function returns the value of the preference as a text string. It gets the text string by calling the preference's type handling object to convert the value from its native form into string form.
If a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_varchar2_value := wwpre_api_value.get_value_as_string_by_id
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_COLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.get_user_id,
p_language => wwctx_api.get_nls_language,
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be retrieved. If not specified, this function
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.p_language - the language to load the type for the preference
valueVALUE_ERROR - if the type specified for the value is invalid.
function get_value_as_varchar2(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_name in varchar2 default null
) return varchar2If a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_varchar2_value := wwpre_api_value.get_value_as_varchar2
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_NAME',
p_level_type => wwpre_api_value.GROUP_LEVEL_TYPE,
p_level_name => 'TEST_GROUP'
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_name - the user name or group name for which the
value will be retrieved. If not specified,
this function searches for a valid value based on
path, name, and level type. For user-level or group
-level type, the level name or ID must be specified.
function get_value_as_varchar2_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2 default inherit_level_type,
p_level_id in integer default null
) return varchar2If a value is not specified for p_level_type, this function
attempts to inherit the value, moving to each step if a value
is not found:
Example:
l_varchar2_value := wwpre_api_value.get_value_as_varchar2_by_id
(
p_path => 'ORACLE.TOOLS.PORTAL.STYLE',
p_name => 'BGCOLOR';
level_type =>wwpre_api_value.USER_LEVEL_TYPE,
level_id => wwctx_api.get_user_id
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be retrieved. If not specified, this function
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.
procedure set_value_as_date(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_name in varchar2,
p_value in date,
p_commit in boolean default false
) Example:
This example sets the default expiry date to 1st Jan 2002
at the user level.
declare
l_varchar2_value varchar2(4000) := null;
l_number_value number := null;
begin
wwpre_api_value.set_value_as_date(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'EXPIRE_DATE',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_name => 'JDOE',
p_value => to_date('01-JAN-2002')
);
exception
when VALUE_ERROR then
dbms_output.put_line(
'Invalid date'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is storedp_level_name - the user name or group name for the value to
be stored. Note that if the level type is SYSTEM,
then level name must be NULL.p_value - the date value to be storedp_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the value specified is not a dateGENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
procedure set_value_as_date_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_id in integer,
p_value in date,
p_commit in boolean default false
) Example:
This example sets the default expiry date to 1st Jan 2002 at the user
level.
declare
l_varchar2_value varchar2(4000) := null;
l_number_value number := null;
begin
wwpre_api_value.set_value_as_date_by_id(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'EXPIRE_DATE',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.get_user_id,
p_value => to_date('01-JAN-2002')
);
exception
when VALUE_ERROR then
dbms_output.put_line(
'Invalid date'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be set. If not specified, this procedure
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.p_value - the date value to be storedp_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the value specified is not a dateGENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
procedure set_value_as_number(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_name in varchar2,
p_value in number,
p_commit in boolean default false
) Example:
This example sets the font size to 10 at the system level.
wwpre_api_value.set_value_as_number
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_SIZE',
p_level_type => wwpre_api_value.SYSTEM_LEVEL_TYPE,
p_level_name => null,
p_value => 10
);
exception
when VALUE_ERROR then
dbms_output.put_line
(
'Trying to set invalid value'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is storedp_level_name - the user name or group name for the value to
be stored. Note that if the level type is SYSTEM,
then level name must be NULL.p_value - the number value to be storedp_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the value specified is not a numberGENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
procedure set_value_as_number_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_id in integer,
p_value in number,
p_commit in boolean default false
) Example:
This example sets the default font size to 3, at the system level.
declare
l_varchar2_value varchar2(4000) := null;
l_number_value number := null;
begin
wwpre_api_value.set_value_as_number_by_id
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_SIZE',
p_level_type => wwpre_api_value.SYSTEM_LEVEL_TYPE,
p_level_id => wwpre_api_value.SYSTEM_LEVEL_ID,
p_value => 3
);
exception
when VALUE_ERROR then
dbms_output.put_line
(
'Trying to set invalid value'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrieved.p_level_id - the user ID or group ID for which the value
is to be set. If not specified, this procedure
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.p_value - the number value to be storedp_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the value specified is not a numberGENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
procedure set_value_as_string(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_name in varchar2,
p_value in varchar2,
p_language in varchar2,
p_commit in boolean default false
) Example:
This example sets the default font color for the current user
to #FF0000.
wwpre_api_value.set_value_as_string
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_COLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_name => wwctx_api.get_user,
p_value => '#FF0000',
p_language => wwctx_api.get_nls_language
);
exception
when VALUE_ERROR then
dbms_output.put_line
(
'Invalid value for font_color at user level'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is storedp_level_name - the user name or group name for the value to
be stored. Note that if the level type is SYSTEM,
then level name must be NULL.p_value - the string value to be storedp_language - The language to load the type for the preference
valuep_commit - this parameter is now obsolete
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the string value does not conform to its typeGENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
procedure set_value_as_string_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_id in integer,
p_value in varchar2,
p_language in varchar2,
p_commit in boolean default false
) Example:
This example sets the page color to #FF0000 for user SCOTT, at
the user level.
wwpre_api_value.set_value_as_string_by_id
(
p_path => 'ORACLE.PORTAL.TEST.STYLE',
p_name => 'PAGECOLOR',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.id('SCOTT'),
p_value => '#FF0000',
p_language => wwctx_api.get_nls_language
);
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be set. If not specified, this procedure
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.p_value - the string value to be storedp_language - the language to load the type for the preference
valuep_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the string value does not conform to its typeGENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
procedure set_value_as_varchar2(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_name in varchar2,
p_value in varchar2,
p_commit in boolean default false
) Example:
This example sets 'Tahoma' as the value for the font_name
parameter at the user level.
begin
wwpre_api_value.set_value_as_varchar2
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_NAME',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_name => wwctx_api.get_user,
p_value => 'Tahoma'
);
exception
when VALUE_ERROR then
dbms_output.put_line
(
'Invalid value for font_name at user level'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is storedp_level_name - the user name or group name for the value to
be stored. Note that if the level type is SYSTEM,
then level name must be NULL.p_value - the varchar2 value to be storedp_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the value specified is not varchar2GENERAL_PREFERENCE_EXCEPTION - if the value has not been
stored
procedure set_value_as_varchar2_by_id(
p_path in varchar2,
p_name in varchar2,
p_level_type in varchar2,
p_level_id in integer,
p_value in varchar2,
p_commit in boolean default false
) Example:
This example sets the default Font_Name to 'Tahoma' at the user level.
declare
l_varchar2_value varchar2(4000) := null;
l_number_value number := null;
begin
wwpre_api_value.set_value_as_varchar2_by_id
(
p_path => 'ORACLE.PORTAL.TEST.STYLE.DEFAULT',
p_name => 'FONT_NAME',
p_level_type => wwpre_api_value.USER_LEVEL_TYPE,
p_level_id => wwctx_api.get_user_id,
p_value => 'Tahoma'
);
exception
when VALUE_ERROR then
dbms_output.put_line
(
'Invalid value for font_name at user level'
);
end;
p_path - the path for the preference namep_name - the preference namep_level_type - the level at which the value is retrievedp_level_id - the user ID or group ID for which the value
is to be set. If not specified, this procedure
searches for a valid value based on path, name, and
level type. For user-level or group-level type, the
level ID must be specified. For the system level
type, the level ID is wwpre_api_value.SYSTEM_LEVEL_ID.p_value - the varchar2 value to be storedp_commit - this parameter is now obsolete.
It is left here only to ensure that when older code
is used, it still compiles.VALUE_ERROR - if the value specified is not varchar2GENERAL_PREFERENCE_EXCEPTION - if the value has not been stored
| Oracle Application Server Portal PL/SQL API Reference - 904 | |||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | |||||||
| SUMMARY: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | DETAIL: EXCEPTION | TYPE | CONSTANT | VARIABLE | FUNCTION/PROCEDURE | |||||||