Creating Items Oracle Fusion Middleware Online Documentation Library

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. 12-8 Oracle Fusion Middleware Developers Guide for Oracle Portal ■ 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. ■ p_display_option is how the item should be displayed. Use the following predefined constants: – wwsbr_api.FULL_SCREEN to display a link that, when clicked, displays the item in the same browser window. – wwsbr_api.NEW_WINDOW to display a link that, when click, displays the item in a new browser window. – wwsbr_api.IN_PLACE to display the item in the region this applies to text and PLSQL items only. If you have already created the item that you want to use to claim the uploaded document, use the modify_item_post_upload API.

12.5 Setting Perspectives Attributes of Pages and Items

When creating a page or item you can, optionally, specify the perspectives that apply to that page or item. Example 12–8 shows how you specify the perspectives that apply to a page when creating the page. Example 12–9 shows how you specify the perspectives that apply to an item when creating the item. Example 12–8 Specifying Perspectives When Creating a Page declare l_new_page_id number; l_perspective_ids wwsbr_api.g_perspectiveidarray; l_perspective_caids wwsbr_api.g_caid_array; begin select id, caid bulk collect into l_perspective_ids, l_perspective_caids from wwsbr_all_perspectives where caid in l_caid, wwsbr_api.shared_objects; l_new_page_id := wwsbr_api.add_folder p_caid = 33, p_name = ENTERTAINMENT, p_display_name = Entertainment Page, p_type_id = wwsbr_api.FOLDER_TYPE_CONTAINER, p_type_caid = wwsbr_api.SHARED_OBJECTS, p_perspectives = l_perspective_ids, p_perspective_caid = l_perspective_caids ; Extending Your Portal 12-9 -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; Example 12–9 Specifying Perspectives When Creating an Item declare l_new_item_master_id number; l_perspective_ids wwsbr_api.g_perspectiveidarray; l_perspective_caids wwsbr_api.g_caid_array; begin -- Select perspectives with the name prefix = ENTERTAINMENT. select id, caid bulk collect into l_perspective_ids, l_perspective_caids from wwsbr_all_perspectives where caid in l_caid, wwsbr_api.shared_objects and display_name like ENTERTAINMENT; l_new_item_master_id := wwsbr_api.add_item p_caid = 33, p_folder_id = 13923, p_display_name = Movie Review, p_type_id = wwsbr_api.ITEM_TYPE_TEXT, p_type_caid = wwsbr_api.SHARED_OBEJCTS, p_region_id = 5, p_text = This is the text of the review., p_perspectives = l_perspective_ids, p_perspectives_caid = l_perspective_caids ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; ■ p_perspectives is an array of perspective IDs. ■ p_perspective_caid is an array of page group IDs for the perspectives identified in p_perspectives. The position of each element in this array must match the position of the corresponding perspective ID in p_perspectives. The values in p_perspective_caid must be the same as the page group in which you are creating the page or item p_caid or the Shared Objects page group use the wwsbr_api.SHARED_OBJECTS constant. For descriptions of the other parameters in these examples, refer to Example 12–2 and Example 12–5 .

12.6 Approving and Rejecting Items

The WWSBR_API package includes two APIs to help with managing approvals. To see how you might use these APIs in conjunction with the Content Management Event Framework, refer to Section 16.7, Example: Item Validation and Section 16.8, Example: Integrating External Workflow Example 12–10 shows how to approve a pending item. Example 12–11 shows how to reject a pending item. 12-10 Oracle Fusion Middleware Developers Guide for Oracle Portal Example 12–10 Approving an Item begin wwsbr_api.approve p_item_id = 8056, p_site_id = 53, p_comment = Item approved ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; end; Example 12–11 Rejecting an Item begin wwsbr_api.reject p_item_id = 8056, p_site_id = 53, p_comment = Item rejected ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; end; ■ p_item_id is the unique ID of the item being approved or rejected. ■ p_site_id is the ID of the page group to which the item belongs. ■ p_comment provides additional information about the approval or rejection of the item. 13 Searching Portal Content 13-1 13 Searching Portal Content This chapter describes how to use the public search APIs provided with Oracle Portal. The search APIs are available in the WWSRC_API package. The public search APIs enable you to search your portal programmatically and return search results as content records or an XML document. Using these APIs, you can design completely custom search forms that seamlessly integrate with Oracle Portal pages. You can also customize how portal search results get displayed on a page; you are no longer limited to the search results portlet provided with Oracle Portal. As the public search APIs can return the results in XML, you may process or format the search results however you require. You can also use the search APIs to display portal content in any custom application. For example, if you have a Web-based application you could easily provide a search form in the application and display the search results from Oracle Portal there as well. The WWSRC_API package provides the following two types of API: ■ Search submissionexecution APIs – Item search – Page search – Category search – Perspective search ■ Search results APIs – Get item results as XML document – Get page results as XML document To determine the structure of the search results returned by the search APIs, refer to the appropriate secure content repository view, as shown in Table 13–1 . Table 13–1 Search Results to Secure View Mapping Search API Secure Content Repository View wwsrc_api.item_search WWSBR_ALL_ITEMS wwsrc_api.page_search WWSBR_ALL_FOLDERS wwsrc_api.category_search WWSBR_ALL_CATEGORIES wwsrc_api.perspective_search WWSBR_ALL_PERSPECTIVES