Creating Pages Oracle Fusion Middleware Online Documentation Library

Extending Your Portal 12-5 ■ p_display_name is the display name title of the new item. ■ p_type_id is the ID of the item type on which the item is based. Use the constants defined in the WWSBR_API package. Example are as follows: – wwsbr_api.ITEM_TYPE_FILE – wwsbr_api.ITEM_TYPE_TEXT – wwsbr_api.ITEM_TYPE_URL For a full list of constants for the seeded item types, refer to the Oracle Portal PLSQL API Reference on Portal Center: http:portalcenter.oracle.com In the Portal Focus Areas section, click Portlet Development, then in the APIs and References section, click PLSQL API Reference. You can find the IDs for custom item types by querying the ID column of the WWSBR_ITEM_TYPES view. The item type must be available in the page group on which you are creating the item, and therefore listed in the WWSBR_CONTENT_AREA_ITEM_TYPES view. ■ p_type_caid is the ID of the page group to which the item type used for the item belongs. This value must be the same as the page group to which you are adding the item p_caid, or the Shared Objects page group use the wwsbr_api.SHARED_ OBJECTS constant. ■ p_region_id is the ID of the region in which you want to create the item. If you do not specify a region, or if the region ID is invalid, the item is placed in the default item region for the page. Use the WWSBR_ALL_FOLDER_REGIONS view to look up the region ID. ■ p_text is the text for a text item. Creating File Items If an object is associated with one or more files for example, images, file items, and so on, its APIs allow you to upload these files when creating or modifying the object. You can pass a file location consisting of a directory path and file name to the file and image parameters for these APIs. The directory in which you place the files must be visible to your database that is, local to the database server and the files themselves must have proper permissions. If you see strange exceptions resulting from API calls in which you are trying to upload files, double check the permissions on the directories and files. When the file that you want to upload resides on the same server as the database in which Oracle Portal is installed, you can upload the file at the same time as you create or update the item. Example 12–6 shows how you might do this. Example 12–6 Creating a File Item add_item API declare l_item_masterthing_id number; begin -- Add an item that resides on the same server as the OracleAS Portal -- content repository database. l_item_masterthing_id := wwsbr_api.add_item p_caid = 53, -- A known page group ID. p_folder_id = 1, -- A known page ID. p_display_name = My File, 12-6 Oracle Fusion Middleware Developers Guide for Oracle Portal p_type_id = wwsbr_api.ITEM_TYPE_FILE, p_type_caid = wwsbr_api.SHARED_OBJECTS, p_region_id = 513, -- A known region on the page. p_description = Description of my file, p_file_filename = tmpmyfile.txt ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; ■ p_caid is the ID of the page group that owns the page in which you want to create the item. ■ p_folder_id is the ID of the page in which you want to create the item. ■ p_display_name is the display name title of the new item. ■ p_type_id is the ID of the item type on which the item is based. ■ p_type_caid is the ID of the page group to which the item type used for the item belongs. This value must be the same as the page group to which you are adding the item p_caid, or the Shared Objects page group use the wwsbr_api.SHARED_ OBJECTS constant. ■ p_region_id is the ID of the region in which you want to create the item. If you do not specify a region, or if the region ID is invalid, the item is placed in the default item region for the page. Use the WWSBR_ALL_FOLDER_REGIONS view to look up the region ID. ■ p_description is a description of the item. ■ p_file_filename is the directory path and file name of the file associated with this item. The file must be located on the same server as database in which Oracle Portal is installed. If the file does not reside on the same server as the database in which Oracle Portal is installed, you must first load the file into the content repository document tables using the upload_blob API Example 12–7 . The upload_blob API returns a unique document name. Use the add_item_post_upload API to create a new item that claims the file specified by the returned document name. Example 12–7 Uploading a File to the Content Repository and Creating a File Item Using the Uploaded File upload_blob API and add_item_post_upload API declare l_blob blob; l_blob_filename varchar2250; l_mime_type varchar2100 := texthtml; l_doc_name varchar2500; l_display_name varchar2250; l_region_id number := 2013; l_file_name varchar2100; Note: Your calling application must declare a BLOB and assign it to an object compatible with the database BLOB data type refer to Application Developers Guide - Large Objects in your Oracle Database documentation set. You can then pass the BLOB to the p_blob parameter of the upload_blob API.