Creating Categories and Perspectives

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. Extending Your Portal 12-7 l_image_name varchar2100; l_site_id number := 73; l_page_id number := 1; l_item_type_id number := wwsbr_api.ITEM_FILE_TYPE; l_item_type_siteid number := wwsbr_api.SHARED_OBJECTS; l_description varchar21000; l_item_masterthing_id number; begin -- Your calling application must define the my_get_blob function and retrieve -- your document into a blob so that it can be uploaded in the subsequent step. l_blob := my_get_blob8001.HTML; -- Upload the BLOB to the Oracle Portal document table. l_blob_filename := index2.html; l_doc_name := wwsbr_api.upload_blob p_file_name = l_blob_filename, p_blob = l_blob, p_mime_type = l_mime_type ; l_display_name := l_blob_filename; l_file_name := l_doc_name; l_description := File uploaded to portal = || l_doc_name; -- Use add_item_post_upload to claim the document and add the item to a page. l_item_masterthing_id := wwsbr_api.add_item_post_upload p_caid = l_site_id, p_folder_id = l_page_id, p_display_name = l_display_name, p_file_name = l_file_name, p_type_id = l_item_type_id, p_type_caid = l_item_type_siteid, p_region_id = l_region_id, p_description = l_description, p_display_option = wwsbr_api.FULL_SCREEN ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; The following are parameters for upload_blob: ■ p_file_name is the file name that you want to assign to the BLOB. This is not the value returned by the function. Usually this is the file name by which the file is known on the source file system. ■ p_blob is the BLOB containing the content. ■ p_mime_type is the MIME type for the BLOB. Use the predefined constants provided in the WWSBR_API package. The following are parameters for add_item_post_upload: ■ 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_file_name is the internal document name for the file item, matching a document in the document table. Pass the value returned by upload_blob to this parameter to reference the uploaded document as the file for this item.