Oracle9iAS Portal Developer Kit

add_item function

Contained in package wwsbr_api.

Call this function to create a new item within a content area and return a master item ID.

function add_item
(
  p_caid number,
  p_folder_id number,
  p_display_name varchar2,
  p_type_id number,
  p_type_caid number,
  p_region_id number,
  p_display_option in varchar2 default FULL_SCREEN,
  p_category_id number default GENERAL_CATEGORY,
  p_category_caid number default SHARED_OBJECTS,
  p_perspectives g_perspectiveidarray  default g_perspectiveidemptyarray,
  p_perspectives_caid g_caid_array   default g_empty_caid_array,
  p_author varchar2 default wwctx_api.get_user,
  p_image_filename varchar2 default null,
  p_image_alignment varchar2 default ALIGN_BOTTOM,
  p_description varchar2 default null,
  p_keywords varchar2 default null,
  p_file_filename varchar2 default null,
  p_text varchar2 default null,
  p_url varchar2 default null,
  p_plsql varchar2 default null,
  p_plsql_execute_mode varchar2 default null,
  p_plsql_execute_user varchar2 default null,
  p_app_component varchar2 default null,
  p_app_param_screen number default NO,
  p_folderlink_id number default null,
  p_folderlink_caid number default null,
  p_jarfile_filename varchar2 default null,
  p_initial_page_name varchar2 default null,
  p_java_app_type varchar2 default APP_TYPE_JSP,
  p_publish_date varchar2 default null,
  p_expire_mode varchar2 default PERMANENT,
  p_expiration varchar2 default null,
  p_master_item_id number default null,
  p_hide_in_browse number default NO,
  p_checkable in number default NO,
  p_parent_item_id number default null,
  p_attribute_id wwsbr_type.array default wwsbr_type.empty,
  p_attribute_caid wwsbr_type.array
  default wwsbr_type.empty,
  p_attribute_data_type wwsbr_type.array
  default wwsbr_type.empty,
  p_attribute_value wwsbr_type.array default wwsbr_type.empty
  )
return number;

Version: Oracle Portal 3.0.8
(Not available Oracle9iAS Portal 9.0.2)

Parameters:

p_caid number

The content area ID into which this item is to be added.

Datatype: number

p_folder_id

The folder ID into which this item is to be added.

Datatype: number

p_display_name

The display name for the item. This name is displayed in many places, including in the content area navigator and content area map.

Datatype: varchar2

p_type_id

The item type ID corresponding to the type of item being created.

Note: Item type constants can be used.

Datatype: number

p_type_caid

The content area ID for the item type.

Datatype: number

p_region_id

The ID of a region within the folder into which this item should be added. This value can be found in WWSBR_ALL_FOLDER_REGIONS.ID

Datatype: number

p_display_option

The display option for the item. The default value is FULL_SCREEN.

Datatype: varchar2
Default: FULL_SCREEN

p_category_id number

The ID for the category to be assigned to the new item. The value can be found in WWSBR_ALL_CATEGORIES.ID.

The category selected must either belong to content area 0 (shared objects) or the same content area as the new item.

Datatype: number
Default: GENERAL_CATEGORY

p_category_caid

The content area ID for the category to be assigned to the item.

Note: This value must either be 0 (shared objects) or the same as the value of p_caid.

Datatype: number
Default: SHARED_OBJECTS

p_perspectives

An array of perspective IDs which correspond to the perspectives to be assigned to the item. Values or this can be found in WWSBR_ALL_PERSPECTIVES.ID.

Note: The perspectives selected must either belong to content area 0 (shared objects) or the same content area as the new item.

Datatype: g_perspectiveidarray
Default: g_perspectiveidemptyarray

p_perspectives_caid

An array of content area IDs for the perspectives in p_perspectives. Values can be found in WWSBR_ALL_PERSPECTIVES.CAID.

Note: The value must either be 0 (shared objects) or the same as the value of p_caid.

Datatype: g_caid_array
Default: g_empty_caid_array

p_author

The author of the item. If left null, the user who creates the item is listed as the author.

Datatype: varchar2
Default: wwctx_api.get_user

p_image_filename

The full directory and filename of an image to be uploaded for this item.

Note: The file to be uploaded must be visible to the database. You must also ensure that the directory and the filename specified have suitable permissions.

Datatype: varchar2
Default: null

p_image_alignment

Alignment options for the item's image, with relationship to the rest of the displayed attributes. Valid values for this parameter are:

ALIGN_LEFT, ALIGN_RIGHT, ALIGN_TOP, ALIGN_BOTTOM, ALIGN_ABSOLUTE_MIDDLE, ALIGN_ABSOLUTE_BOTTOM, ALIGN_TEXT_TOP, ALIGN_MIDDLE, ALIGN_BASELINE

Datatype: varchar2
Default: ALIGN_BOTTOM

p_description

Description of the item.

Datatype: varchar2
Default: null

p_keywords

Keywords for the item.

Datatype: varchar2
Default: null

p_file_filename

The full directory and filename of a file to be uploaded for a file item.

Ensure that the file to be uploaded is visible to the database and that the directory and the filename specified have suitable permissions.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_FILE, ITEM_TYPE_ZIP_FILE,or is a custom item type based on one of these two item types. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: in varchar2
Default: null

p_text

Text for the text item.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_TEXT,or is a custom item type based on this type. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_url

A URL for the item.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_URL is a custom item type based on this type. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_plsql

PL/SQL code for the PL/SQL item.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_PLSQL. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_plsql_execute_mode

The execution mode for PL/SQL items folders. Valid values are PUBLIC_SCHEMA, DB_USER, CREATOR_SCHEMA.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_PLSQL. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_plsql_execute_user

The user for DB_USER in PL/SQL execute mode.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_PLSQL. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_app_component

The PROVIDER_ID.PORTLET_ID identifier for the application component to be used for this application component item.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_COMP,or is a custom item type based on this type. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_app_param_screen

Specifies whether the application component item displays the component parameter screen. The default value is No.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_COMP,or is a custom item type based on this type. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: number
Default: NO

p_folderlink_id

The folder_id for the folder that this folder link item points to.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_FOLDER_LINK,or is a custom item type based on this type. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: number
Default: null

p_folderlink_caid

The content area ID for the folder that this folder link item points to.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_FOLDER_LINK. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: number
Default: null

p_jarfile_filename

The directory and filename for the JAR file to be uploaded for this Java application item.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_JAVA_APP. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_initial_page_name

The name of the initial page for the Java application item.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_JAVA_APP. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: null

p_java_app_type

The type of Java application. Currently, JSP only. See example below.

Note: This parameter is only applicable if the item type of the item (i.e. p_type_id) is ITEM_TYPE_JAVA_APP. Refer to the base_item_type column of WWSBR_ITEM_TYPES, to determine the item type.

Datatype: varchar2
Default: APP_TYPE_JSP

p_publish_date

The date to publish the item. If no value is specified, the item is published immediately.

Datatype: varchar2
Default: null

p_expire_mode

The expiration mode. Valid values are PERMANENT, EXP_NUMBER and EXP_DATE.

The value specified here determines what is passed to p_expiration.

Datatype: varchar2
Default: PERMANENT

p_expiration

If p_expire_mode is defined as:

  • PERMANENT, this should be null.

  • EXP_NUMBER, this value specifies the number of days.

  • EXP_DATE, this value specifies the expiration date.

Note: For dates, the format should match the NLS_DATE format. For example, for 'us' this is 'DD-MON-YYYY'.

Datatype: varchar2
Default: null

p_master_item_id

(Used when adding a new version for the item).
The master_item_id of the item. The value can be found in WWSBR_ALL_ITEMS.MASTERID.

Datatype: number
Default: null

p_hide_in_browse

Specifies whether the item is hidden in View or Browse mode.

Datatype: number
Default: NO

p_checkable

Specifies whether this item can be checked out by users with appropriate modify item privileges. Valid values for this parameter are YES or NO.

Datatype: number
Default: NO

p_parent_item_id

The ID for the parent item ID. When this parameter is used it implies that this item will become a child of the item whose ID is passed as the p_parent_item_id.

Datatype: number
Default: null

p_attribute_id

An array of attributes ids (for items based on custom types which has attributes).

Datatype: wwsbr_type.array
Default: wwsbr_type.empty

p_attribute_caid

An array of attribute content area IDs (for items based on custom types which has attributes).

Note: The values must either match p_caid or be 0.

Datatype: wwsbr_type.array
Default: wwsbr_type.empty

p_attribute_data_type

An array of attribute type values (such as 'url','text' etc.) Values for this can be found in WWSBR_ATTRIBUTES.DATA_TYPE

Datatype: wwsbr_type.array
Default: wwsbr_type.empty

p_attribute_value

An array of attribute values. All values are passed as varchar2.

Datatype: wwsbr_type.array
Default: wwsbr_type.empty

Returns:

This function returns a master item ID.

Exceptions:

  • If the specified combination of category ID and category content area ID does not exist, INVALID_CATEGORY exception is raised.

  • If p_type_id is not specified, MISSING_ITEM_TYPE exception is raised.

  • When an uploaded file exceeds quota, QUOTA_EXCEEDED exception is raised.

  • If the date format specified for the publish date is invalid, INVALID_PUBLISH_DATE_FORMAT exception is raised.

  • The publish date specified must be today's date or later. It must also be earlier than the expire date, otherwise INVALID_PUBLISH_DATE_VALUE exception is raised.

  • If the value for p_expire_mode is EXP_NUMBER but no value is specified for p_expiration, NULL_EXPIRE_NUMBER exception is raised.

  • If an invalid number is specified for p_expiration, INVALID_EXPIRE_NUMBER exception is raised. (Only applicable when p_expire_mode = EXP_NUMBER).

  • If the value for p_expire_mode is EXP_DATE but no value is specified for p_expiration, NULL_EXPIRE_DATE exception is raised

  • If some other error occurs while attempting to create an item, ITEM_CREATION_ERROR exception is raised

Example:

New_Master_Item_Id := wwsbr_api.add_item
(
  p_caid => 33,
  p_folder_id => 45,
  p_display_name => 'Movie Review',
  p_type_id => wwsbr_api.ITEM_TYPE_TEXT,
  p_type_caid => wwsbr_api.SHARED_OBJECTS,
  p_region_id => 5,
  p_text => 'This is the text of the review.'
);

Example:Java application item

When you add a Java application item, you must set certain environment variables, i.e. SCRIPT_PREFIX, DAD_NAME and DOC_ACCESS_PATH in the example below:

declare
   New_Java_App_Item_Id number;
   num_params number;
   empty_vc_arr owa.vc_arr;
   param_name owa.vc_arr default empty_vc_arr;
   param_val owa.vc_arr default empty_vc_arr;
begin
   num_params := 3;

   param_name(1) := 'SCRIPT_PREFIX';
   param_val(1) := '/pls';

   param_name(2) := 'DAD_NAME';
   param_val(2) := 'portal30';

   param_name(3) := 'DOC_ACCESS_PATH';
   param_val(3) := 'docs';

   owa.init_cgi_env(num_params,param_name,param_val);

   New_Java_App_Item_Id := wwsbr_api.add_item(
      p_caid => 1,
      p_folder_id => 1,
      p_display_name => 'Java Application Item',
      p_type_id => wwsbr_api.ITEM_TYPE_JAVA_APP,
      p_type_caid => wwsbr_api.SHARED_OBJECTS,
      p_region_id => 5,
      p_jarfile_filename => '/home/javaapp.jar',
      p_initial_page_name => 'javaapp.jsp',
      p_java_app_type => WWSBR_API.APP_TYPE_JSP
);
   commit;
end;

Example (using custom attributes):

This example assumes that the perspectives, attributes and custom item type which uses the attributes have all been created.

declare
  l_perspectives wwsbr_api.g_perspectiveidarray
  := wwsbr_api.g_perspectiveidemptyarray;
  l_perspectives_caid wwsbr_api.g_caid_array :=
wsbr_api.g_empty_caid_array;

  l_item_id number;
  l_attribute_id wwsbr_type.array := wwsbr_type.empty;
  l_attribute_caid wwsbr_type.array := wwsbr_type.empty;
  l_attribute_data_type wwsbr_type.array := wwsbr_type.empty;
  l_attribute_value wwsbr_type.array := wwsbr_type.empty;
begin
  -- add perspectives
  l_perspectives := wwsbr_api.g_perspectiveidemptyarray;
  l_perspectives_caid := wwsbr_api.g_empty_caid_array;
  l_perspectives(1) := 50;
  l_perspectives_caid(1) := 0;
  l_perspectives(2) := 2039;
  l_perspectives_caid(2) := 33;
  -- build array of attributes for custom type
  l_attribute_id(1) := 2953;
  l_attribute_caid(1) := wwsbr_api.SHARED_OBJECTS;
  l_attribute_data_type(1) := 'file';
  l_attribute_value(1) := '/export/home/misc/purple_circle.jpg';
  l_attribute_id(2) := 2954;
  l_attribute_caid(2) := wwsbr_api.SHARED_OBJECTS;
  l_attribute_data_type(2) := 'number';
  l_attribute_value(2) := '999';
  l_item_id := wwsbr_api.add_item(
  p_caid => 33,
  p_folder_id => 45,
  p_display_name => 'Example Custom Type Item',
  p_region_id => 5,
  p_type_id => 2955,
  p_type_caid => wwsbr_api.SHARED_OBJECTS,
  p_perspectives => l_perspectives,
  p_perspectives_caid => l_perspectives_caid,
  p_attribute_id => l_attribute_id,
  p_attribute_caid => l_attribute_caid,
  p_attribute_data_type => l_attribute_data_type,
  p_attribute_value => l_attribute_value);
  commit;
end;

Related topics

The PL/SQL API Reference is part of the Portal Developer Kit on Portal Studio