Setting Item Attributes Editing Content

Performing Simple Content Management Tasks 11-9 Name wwsbr_api.ATTRIBUTE_ NAME Any varchar2256 value Specify a name that is unique within the page and all its tabs and sub-pages Page Link wwsbr_api.ATTRIBUTE_ PAGE_LINK pagegroupid_pageid Perspectives wwsbr_api.ATTRIBUTE_ PERSPECTIVES pagegroupid_perspectiveid Separate multiple perspectives with commas. Non-existing perspective IDs are identified by the API. Only those perspectives that are available to the page group are added to the item. PLSQL wwsbr_api.ATTRIBUTE_ PLSQL Any varchar22000 value Publish Date wwsbr_api.ATTRIBUTE_ PUBLISHDATE Any date value This is a required attribute. Rollover Image wwsbr_api.ATTRIBUTE_ ROLLOVERIMAGE The path and file name of the image file that you want to upload Table 11–2 Cont. Attribute Values for Base Attributes Attribute Constant Value p_attribute_value 11-10 Oracle Fusion Middleware Developers Guide for Oracle Portal Smart Link wwsbr_api.ATTRIBUTE_ SMARTLINK ■ wwsbr_api.VALUE_ACCOUNT_ INFO ■ wwsbr_api.VALUE_ADVANCED_ SEARCHE ■ wwsbr_api.VALUE_BUILDER ■ wwsbr_api.VALUE_COMMUNITY ■ wwsbr_api.VALUE_CONTACT ■ wwsbr_api.VALUE_EDIT_PAGE ■ wwsbr_api.VALUE_FAVOURITES ■ wwsbr_api.VALUE_HELP ■ wwsbr_api.VALUE_PORTAL_ HOME ■ wwsbr_api.VALUE_CUST_ MOBILE_HOME_PAGE ■ wwsbr_api.VALUE_NAVIGATOR ■ wwsbr_api.VALUE_PAGE_GROUP_ HOME ■ wwsbr_api.VALUE_PERSONAL_ PAGE ■ wwsbr_api.VALUE_CUSTOMIZE_ PAGE ■ wwsbr_api.VALUE_PORTLET_ REPOS_REF_STATUS ■ wwsbr_api.VALUE_PORTLET_ REPOS ■ wwsbr_api.VALUE_PROPERTY_ SHEET ■ wwsbr_api.VALUE_REF_PORTLET_ REPOS ■ wwsbr_api.VALUE_REFRESH_ PAGE ■ wwsbr_api.VALUE_SUBSCRIBE Smart Text wwsbr_api.ATTRIBUTE_ SMARTTEXT ■ wwsbr_api.VALUE_SMART_TEXT_ CURRENT_DATE ■ wwsbr_api.VALUE_SMART_TEXT_ CURRENT_PAGE ■ wwsbr_api.VALUE_SMART_TEXT_ CURRENT_USER Text wwsbr_api.ATTRIBUTE_ TEXT Any varchar24000 value URL wwsbr_api.ATTRIBUTE_ URL Any URL value up to varchar22000 Table 11–2 Cont. Attribute Values for Base Attributes Attribute Constant Value p_attribute_value Performing Simple Content Management Tasks 11-11

11.2.2 Editing an Item

To edit an existing item, use the modify_item API. This API enables you to set the properties of an item and also enables you to perform the following: ■ Add new versions of the item if item version is enabled for the page. See Section 11.2.4, Using Version Control . ■ Enable item level security for the item if item level security ILS is enabled for the page. See Section 15.3, Setting Item Level Privileges for an alternative way of doing this. ■ Upload files that are associated with the item. If the file that you want to associate with the item has already been uploaded, use the modify_item_post_upload API instead. You should use this API to edit only those items with an ACTIVE value of 1. That is, do not use it to edit pending, rejected, or deleted items. You must pass both the items master ID to identify the item and its ID to identify the specific version of the item that you want to update. The specified ID does not have to be the current version of the item. For information about obtaining an object ID, refer to Section 10.3, Finding an Object ID . The modify_item API modifies the value of every attribute, even if the attribute is not passed in the parameter list. If an attribute is not passed, its value will revert to the default value of the parameter. If you want to preserve the current value of attributes, you must retrieve those values for the item and pass them to the API. The value of attributes can be retrieved from the following views and APIs: ■ WWSBR_ALL_ITEMS for built-in attributes ■ WWSBR_ITEM_ATTRIBUTES for custom attributes ■ WWSBR_ITEM_TYPE_ATTRIBUTES for a list of attributes for an item type ■ WWSBR_ITEM_PERSPECTIVES for perspectives ■ wwsec_api.grantee.list for a list of privileges on the item type. See Section 15.3, Setting Item Level Privileges for more information on using this API. Example 11–3 updates the display name and text of a text item. Example 11–3 Editing an Item modify_item API declare l_item_master_id number; begin l_item_master_id := wwsbr_api.modify_item Version Number wwsbr_api.ATTRIBUTE_ VERSION_NUMBER Any positive number. The number does not have to be an integer. Specify a version number that is unique, that is, it should not be the same as any existing version of the item. If you supply a value that is the same as an existing version number for the item, then it will be set to one more than the highest version number for the item. Table 11–2 Cont. Attribute Values for Base Attributes Attribute Constant Value p_attribute_value 11-12 Oracle Fusion Middleware Developers Guide for Oracle Portal p_master_item_id = 453, p_item_id = 454, p_caid = 33, p_folder_id = 45, p_display_name = Movie Review, p_text = This is the text of the review. ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; ■ p_master_item_id is the master ID of the item. You can look up this value in the MASTERID column of the WWSBR_ALL_ITEMS view. ■ p_item_id is the ID of the item. This identifies the version of the item and does not have to be the items current version. ■ p_caid is the ID of the page group to which the item belongs. ■ p_folder_id is the ID of the page on which the item appears. ■ p_display_name is the display name title of the item. ■ p_text is the text for the item the item in this example is a text item.

11.2.3 Checking Items Out and In

If an item is enabled for check-out, before editing it, you should check the item out so that other users cannot make changes at the same time Example 11–4 . Example 11–4 Checking an Item Out and In check_out_item and check_in_item begin -- Check out the item. wwsbr_api.check_out_item p_master_item_id = 12345, -- Master ID is the same for all versions. p_caid = 33 ; -- Update the display name of the item. wwsbr_api.set_attribute p_site_id = 33, p_thing_id = 8056, -- Unique item ID. p_attribute_site_id = wwsbr_api.SHARED_OBJECTS, p_attribute_id = wwsbr_api.ATTRIBUTE_TITLE, p_attribute_value = New Display Name ; -- Check the item back in. wwsbr_api.check_in_item p_master_item_id = 12345, -- Master ID is the same for all versions. p_caid = 33 ; Tip: To identify the items current version, use the following query: select id from wwsbr_all_items where master_id = 453 and is_current_version = 1; Performing Simple Content Management Tasks 11-13 -- Process cache invalidation messages. wwpro_api_invalidation.execute_ache_invalidation; exception ... end; ■ p_master_item_id is the master ID of the item being checked out or in. ■ p_caid is the ID of the page group to which the item belongs. For information about the set_attribute API used in Example 11–4 , refer to Section 11.2.1, Setting Item Attributes .

11.2.4 Using Version Control

When you edit an item using the modify_item API, if you set p_addnewversion = TRUE, a new version is created for the item. The new version is given a new ID the master ID stays the same. If you do not want the new version of the item to be immediately published as the current version, set p_add_as_current_version = FALSE. Example 11–5 shows how you can use the modify_item API to create a new version of an item. Example 11–5 Creating a New Version of an Item modify_item API declare l_item_master_id number; begin l_item_master_id := wwsbr_api.modify_item p_master_item_id = 453, p_item_id = 454, p_caid = 33, p_folder_id = 45, p_display_name = Movie Review, p_text = This is the text of the review., p_addnewversion = true ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; For a description of the parameters used here, see Example 11–3 .

11.3 Reorganizing Content

Content is very rarely static, so you may find that you need to move content around within your portal. This section contains the following examples: Note: To check whether an item is already checked out, query the IS_ITEM_CHECKEDOUT column of the WWSBR_ALL_ITEMS view. For more information about this view, refer to Section F.2.5, WWSBR_ ALL_ITEMS . 11-14 Oracle Fusion Middleware Developers Guide for Oracle Portal ■ Section 11.3.1, Moving an Item to a Different Page ■ Section 11.3.2, Moving Pages

11.3.1 Moving an Item to a Different Page

You can use the move_item API to move an item to a different page in the same page group or to a page in a different page group. Moving an item preserves the items metadata. To move an item to a different page group, the item must not be: ■ based on a local item type. ■ associated with a local category. ■ associated with any local perspectives. Example 11–6 moves an item from one page group to a page in a different page group. Example 11–6 Moving an Item to a Different Page Group move_item API begin wwsbr_api.move_item p_caid = 33, p_master_item_id = 12345, p_dest_caid = 53, p_dest_page_id = 1, p_dest_region_id = 5 ; -- Process cache invalidation messages. wwpro_api_invalidation.execute_cache_invalidation; exception ... end; ■ p_caid is the ID of the page group to which the item currently belongs. ■ p_master_item_id is the master ID of the item that you want to move. ■ p_dest_caid is the ID of the page group to which you want to move the item. ■ p_dest_page_id is the ID of the page to which you want to move the item. ■ p_dest_region_id is the ID of the item region of the page in which you want to move the item. If you do not specify a region ID, the item is moved to the pages default item region, which may not be desirable.

11.3.2 Moving Pages

You can use the move_folder API to move a page within the same page group. You cannot move a page to a different page group. To move a page, users must have Manage privileges on the page being moved and the page under which the page is being moved. Example 11–7 shows how to move a page. Example 11–7 Moving a Page move_folder API begin wwsbr_api.move_folder p_id = 12345, p_siteid = 33,