Creating a Page Group

12-4 Oracle Fusion Middleware Developers Guide for Oracle Portal l_new_perspective_id number; l_caid number := 33; begin l_new_perspective_id := wwsbr_api.add_perspective p_caid = 33, p_parent_id = 0, p_name = newperspective1, p_display_name = New Perspective 1 ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; ■ p_caid is the ID of the page group in which you want to create the category or perspective. ■ p_parent_id is the ID of the category or perspective under which you want to create the new category or perspective. If this is a top-level category or perspective, use 0 zero. ■ p_name is the internal name for the new category or perspective. ■ p_display_name is the display name for the new category or perspective.

12.4 Creating Items

To create an item on a page, use the add_item API Example 12–5 . This API returns the master ID of the item, which is not the items unique ID. To look up the ID of the item after it is created, query the WWSBR_ALL_ITEMS view as shown in Example 10–7 . For more information about the difference between an items unique ID and its master item ID, refer to Section 10.2, API Parameters . Example 12–5 Creating a Text Item add_item API declare l_new_item_master_id number; begin 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., ; -- 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. 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,