Skip Headers
Oracle® Application Server Portal Developer's Guide
10g Release 2 (10.1.4)
B14135-02
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

11 Performing Simple Content Management Tasks

This chapter describes how to use the APIs provided with OracleAS Portal to perform simple content management tasks. It contains the following sections:

More on OTN

For more information about any of the APIs mentioned in this chapter, refer to the Oracle Application Server Portal PL/SQL 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 PL/SQL API Reference.


Tip:

Remember, if you are calling the APIs from a Web provider or external application, you need to set the session context first. For more information, refer to Section 10.1, "Setting the Session Context".

11.1 Editing Page Properties

If you want to edit page properties, you need to:

  1. Query the WWSBR_USER_PAGES view to populate a page record. You may need to create this view first (refer to Section 11.1.1, "Creating the WWSBR_USER_PAGES View").

  2. Modify the properties you want to update.

  3. Pass the updated page record to the modify_folder API.

You can update the following properties in the page record:

Table 11-1 Editable Page Record Properties

Property Data Type Description

NAME

VARCHAR2(60)

Name of the page. This name is used in path based URLs.

TITLE

VARCHAR(256)

Display name, or title, of the page.

SETTINGSSETID

NUMBER

ID of the style used by the page.

SETTINGSSETSITEID

NUMBER

Page group ID of the style used by the page.

ISPUBLIC

NUMBER(1)

Indicates that the page is viewable by public users. Valid values:

  • 0 - not public

  • 1 - is public

IMAGE

VARCHAR2(350)

Unique document name of the image associated with the page, for example 6001.JPG.

ROLLOVERIMAGE

VARCHAR2(350)

Unique document name of the rollover image associated with the page, or the inactive tab image for the tab, for example 6001.JPG.

TITLEIMAGE

VARCHAR2(350)

Unique document name of the active tab image for the tab, for example 6001.JPG.

LEADER

VARCHAR2(256)

E-mail address of the page contact.

DESCRIPTION

VARCHAR2(2000)

Description of the page.

CREATEDATE

DATE

Date the page was created.

CREATOR

VARCHAR2((256)

User name of the person who created the page.

HAVEITEMSECURITY

NUMBER(1)

Indicates that item level security is enabled for the page. Valid values:

  • 0 - ILS disabled

  • 1 - ILS enabled

ITEMVERSIONING

VARCHAR2(30)

Indicates the level of item versioning for the page. Valid values:

  • versionnone - no versioning

  • versionsimple - simple versioning

  • versionaudit - audit versioning

TOPICID

NUMBER

ID of the category assigned to the page.

TOPIC_SITEID

NUMBER

Page group ID of the category assigned to the page.

VALUE

VARCHAR2(2000)

For PL/SQL pages, the PL/SQL code.

For JSP pages, the JSP source document name. Do not change this value for JSP pages.

IS_PORTLET

NUMBER(1)

Indicates if the page is published as a portlet. Valid values:

  • 0 - not a portlet

  • 1 - is a portlet

PLSQL_EXECUTOR

VARCHAR2(30)

For PL/SQL type pages, the database schema used to execute the PL/SQL code. Valid values:

  • $PUBLIC$

  • $CREATOR$

  • <database user name>

KEYWORDS

VARCHAR2(2000)

Keywords for the page.

IS_READY

NUMBER(1)

Indicates that page creation is complete. Valid values:

  • 1 - page creation is complete

INHERIT_PRIV

VARCHAR2(200)

The page from which this page inherits its privileges. Use the following format:

<page group id>/<page id>

CACHE_MODE

NUMBER(1)

Caching mode for the page. Valid values:

  • 2 - no caching

  • 1 - cache page definition only

  • 0 - cache page definition and content for x minutes

  • 4 - cache page definition only at system level

  • 3 - cache page definition and content at system level for x minutes

CACHE_EXPIRES

NUMBER(38)

Cache period in minutes.

ALLOW_PAGE_STYLE

NUMBER(1)

For templates, indicates if pages can use a different style. Valid values:

  • 1 - allow pages to use different style.

ALLOW_PAGE_ACL

NUMBER(!)

For templates, indicates if pages have different access settings. Valid values:

  • 1 - allow pages to have different access settings

INIT_JSPFILE

VARCHAR2(256)

For JSP pages, initial JSP file if the JSP source of the page is a JAR or WAR file.

UI_TEMPLATE_ID

NUMBER(38)

ID of HTML page skin.

TEMPLATE_ISPUBLIC

NUMBER(1)

Indicates if the template is ready to use. Valid values:

  • 1 - template is ready to use

CONTAINER_ID

NUMBER

ID of the container page.

DEFAULT_ITEM_REGION_ID

NUMBER

ID of the default item region for the page.

DEFAULT_PORTLET_REGION_ID

NUMBER

ID of the default portlet region for the page.

ITEMTYPE_INHERIT_FLAGS

NUMBER(1)

For WebDAV, indicates if default item types are inherited from parent page. Valid values:

  • 7 - inherit all item types from parent page

  • 0 - specify all types on this page

REGFILE_ITEMTYPE

RAW(32)

For WebDAV, GUID of default item type for regular files.

ZIPFILE_ITEMTYPE

RAW(32)

For WebDAV, GUID of default item type for zip files.

IMAGEFILE_ITEMTYPE

RAW(32)

For WebDAV, GUID of default item type for image files.

DISPLAYINPARENT

NUMBER(1)

Indicates if the page is displayed in its parent page's sub page region. Valid values:

  • 1 - display page in parent's sub page region

SEQ

NUMBER

The sequence (order) of the page in its parent page's sub page region.

ALPHABETICAL_SORT

NUMBER(1)

Indicates that sub pages are displayed in alphabetical order. Valid values:

  • 1 - display sub pages in alphabetical order

ITEM_PAGE_ID

NUMBER(38)

ID of the item template.

ITEM_PAGE_SITE_ID

NUMBER(28)

Page group ID of the item template.

ITEM_PAGE_TABSTRING

VARCHAR2(512)

Tab strings of the item template. Use the following format:

<tab name>:<sub tab name>:...:<sub tab name>

INHERIT_ITEM_PAGE

NUMBER(1)

For item template only, indicates that items inherit the parent page's item template. Valid values:

  • 1 - inherit parent page's item template

ALLOW_ITEM_PAGE_OVERRIDE

NUMBER(1)

For item template only, indicates that items can have their own item template. Valid values:

  • 1 - allow items on the page to have their own item template

HAS_INPLACE_ITEM

NUMBER(1)

Indicates if the page or tab has a placeholder item. Valid values:

  • 1 - has a placeholder item

TIMEOUT

NUMBER

Limit time, in seconds, used to fetch portlets.


Users need to have Manage privileges on a page to edit its properties.

When updating translatable page attributes, modify_folder updates the translation determined by the session language setting. Therefore to make sure you update the translation with the correct values for all the translatable attributes, you must query the page attributes of the same language first.

Example 11-1 shows how to use the modify_folder API to edit the English translation of the display name of a page.

Example 11-1 Editing Page Properties

declare
  l_page     wwsbr_api.page_record;
begin
  wwctx_api.set_nls_language(
    p_nls_language => wwnls_api.AMERICAN
  );
  select *
  into l_page
  from   <schema>.wwsbr_user_pages
  where  siteid = 33
    and  id = 1
    and  language = wwnls_api.AMERICAN;
  l_page.title := 'New Page Display Name';
  wwsbr_api.modify_folder(
    p_page => l_page
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

p_page is the page record for the page you want to modify.

schema is the portal schema (that is, the schema in which OracleAS Portal is installed).

11.1.1 Creating the WWSBR_USER_PAGES View

The modify_folder API takes a page record as a parameter. To populate the page record, you need to query the data from the WWSBR_USER_PAGES view. This view lists all the pages on which the current user has Manage privileges. If the WWSBR_USER_PAGES view does not already exist in your portal schema, you will need to create it.

To create the WWSBR_USER_PAGES view:

  1. Log in to SQL*Plus as the portal schema owner, for example:

    sqlplus portal/oracle1
    
    
  2. Create the WWSBR_USER_PAGES view:

    create or replace view WWSBR_USER_PAGES as
    select *
    from WWV_USER_OWNED_CORNERS
    /
    
    
  3. If the procedures and packages that reference this view exist in a schema other than the portal schema, you need to grant privileges on the view to that schema:

    grant select on WWSBR_USER_PAGES to <schema>
    /
    
    

11.2 Editing Content

This section contains the following examples:


Note:

When editing an item, it is good practice to check the item out first to ensure that any changes made by your code are not overwritten by other users. Don't forget to check the item back in after you have completed your edits. For information about checking items out and in, refer to Section 11.2.3, "Checking Items Out and In".

11.2.1 Setting Item Attributes

If you want to set a particular attribute for an item, use the set_attribute API. This API updates the value of an attribute for a particular version of an item. The values provided are validated against the data type of the attribute. You can use this API to set the value of a base attribute (see Table 11-2) or a custom attribute. You cannot use this API to edit rejected items, items marked for deletion, and rejected items that have been marked for deletion.


Tip:

Use the set_attribute API when you want to set a single item attribute. If you want to set multiple item attributes, use the modify_item API (described in Section 11.2.2, "Editing an Item").

Example 11-2 Setting the Display Name of an Item (set_attribute API)

begin
  wwsbr_api.set_attribute(
    p_site_id           => 37,
    p_thing_id          => 8056,
    p_attribute_site_id => wwsbr_api.SHARED_OBJECTS,
    p_attribute_id      => wwsbr_api.ATTRIBUTE_TITLE,
    p_attribute_value   => 'New Display Name'
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

  • p_site_id is the ID of the page group to which the item belongs.

  • p_thing_id is the unique item ID. The item ID identifies the particular version of the item that you want to edit.

  • p_attribute_site_id is the ID of the page group to which the attribute belongs. For base attributes, use the wwsbr_api.SHARED_OBJECTS constant.

  • p_attribute_id is the ID of the attribute. For base attributes, use the constants from the WWSBR_API package as shown in Table 11-2.

  • p_attribute_value is the new value that you want to assign to the attribute. For base attributes, see Table 11-2.

For information about how to obtain an object ID, for example a page group ID or item ID, refer to Section 10.3, "Finding an Object ID".

Table 11-2 provides guidelines for setting the values of base attributes.

Table 11-2 Attribute Values for Base Attributes

Attribute Constant Value (p_attribute_value)

Author

wwsbr_api.ATTRIBUTE_AUTHOR

Any varchar2(50) value

Category

wwsbr_api.ATTRIBUTE_CATEGORY

<pagegroupid>_<categoryid>

Character Set

wwsbr_api.ATTRIBUTE_CHARSET

  • wwsbr_api.VALUE_BIG5

  • wwsbr_api.VALUE_EUC_JP

  • wwsbr_api.VALUE_GBK

  • wwsbr_api.VALUE_ISO_8859

  • wwsbr_api.VALUE_SHIFT_JIS

  • wwsbr_api.VALUE_US_ASCII

  • wwsbr_api.VALUE_UTF8

  • wwsbr_api.VALUE_WINDOWS_1252

Description

wwsbr_api.ATTRIBUTE_DESCRIPTION

Any varchar2(2000) value

Display Name

wwsbr_api.ATTRIBUTE_TITLE

Any varchar2(256) value

Display Option

wwsbr_api.ATTRIBUTE_DISPLAYOPTION

  • wwsbr_api.IN_PLACE to display the item directly in place

  • wwsbr_api.FULL_SCREEN to display the item in the full browser window

  • wwsbr_api.NEW_WINDOW to display the item in a new browser window

Enable Item Check-out

wwsbr_api.ATTRIBUTE_ITEMCHECKOUT

  • wwsbr_api.ENABLE_ITEM_FOR_CHECK_OUT

  • wwsbr_api.DISABLE_ITEM_FOR_CHECK_OUT

Expiration Period

wwsbr_api.ATTRIBUTE_EXPIRATIONPER

  • wwsbr_api.PERMANENT to un-expire the item

  • Any numeric value to set the expire mode to NUMBER

  • Any date value greater than the publish date to set the expire date to the value passed and the expire mode to DATE

File

wwsbr_api.ATTRIBUTE_FILE

The path and file name of the file that you want to upload

Image

wwsbr_api.ATTRIBUTE_IMAGE

The path and file name of the image that you want to upload

ImageMap

wwsbr_api.ATTRIBUTE_IMAGEMAP

Any varchar2(4000) value

Image Alignment

wwsbr_api.ATTRIBUTE_IMAGEALIGN

  • wwsbr_api.ALIGN_TEXT_TOP

  • wwsbr_api.ALIGN_ABSOLUTE_BOTTOM

  • wwsbr_api.ALIGN_ABSOLUTE_MIDDLE

  • wwsbr_api.ALIGN_BOTTOM

  • wwsbr_api.ALIGN_RIGHT

  • wwsbr_api.ALIGN_TOP

  • wwsbr_api.ALIGN_LEFT

  • wwsbr_api.ALIGN_MIDDLE

  • wwsbr_api.ALIGN_BASELINE

  • wwsbr_api.ALIGN_IMAGE_ABOVE_LINK

Item Link

wwsbr_api.ATTRIBUTE_ITEM_LINK

<pagegroupid>_<itemid>

Item Template

wwsbr_api.ATTRIBUTE_ITEM_TEMPLATE

<pagegroupid>_<itemtemplateid>

Keywords

wwsbr_api.ATTRIBUTE_KEYWORDS

Any varchar2(2000) value

Mime Type

wwsbr_api.ATTRIBUTE_MIME_TYPE

Any of the mime type constants in the WWSBR_API package. For example:

  • wwsbr_api.VALUE_TEXT_HTML

  • wwsbr_api.VALUE_TEXT_PLAIN

  • wwsbr_api.VALUE_IMAGE_GIF

For a list of the available mime type constants, refer to the Oracle Application Server Portal PL/SQL 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 PL/SQL API Reference.

Name

wwsbr_api.ATTRIBUTE_NAME

Any varchar2(256) 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.

PL/SQL

wwsbr_api.ATTRIBUTE_PLSQL

Any varchar2(2000) 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

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 varchar2(4000) value

URL

wwsbr_api.ATTRIBUTE_URL

Any URL value up to varchar2(2000)

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.


11.2.2 Editing an Item

To edit an existing item, use the modify_item API. As well as setting the properties of the item, this API also enables you to:

  • Add new versions of the item (if item versioning 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 item's 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(
    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 item's current version.


    Tip:

    To identify the item's current version, use the following query:
    select id
    from wwsbr_all_items
    where master_id = 453
      and is_current_version = 1;
    

  • 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
  );
  -- 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".


Tip:

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 E.2.5, "WWSBR_ALL_ITEMS".

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 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:

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 item's 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 page's 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,
    p_parent_id => 10000
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

  • p_id is the ID of the page that you want to move.

  • p_siteid is the ID of the page group to which the page belongs.

  • p_parent_id is the ID of the page under which you want to move the page.

11.3.3 Moving Categories and Perspectives

You can, if necessary, move categories and perspectives around within a page group. You cannot move a category or perspective to a different page group.

To move a category or perspective, a user must have Manage Classifications privileges or higher on the owning page group.

To move a category, use the move_category API.

Example 11-8 Moving a Category (move_category API)

begin
  wwsbr_api.move_category(
    p_src_id => 2000,
    p_dest_id => 3000,
    p_siteid  => 33
  );
exception
  ...
end;
/

To move a perspective, use the move_perspective API.

Example 11-9 Moving a Perspective (move_perspective API)

begin
  wwsbr_api.move_perspective(
    p_src_id => 2000,
    p_dest_id => 3000,
    p_siteid  => 33
  );
exception
  ...
end;
/

  • p_src_id is the ID of the category or perspective that you want to move.

  • p_dest_id is the ID of the category or perspective under which you want to move the category or perspective.

  • p_siteid is the ID of the page group to which the category or perspective belongs.

11.4 Copying Content

If you want to add content that is the same as, or similar to, some content that already exists, instead of creating it all over again, you can copy the existing content.

This section contains the following examples:

11.4.1 Copying Items

You can use the copy_item API to copy an item to a different page in the same page group or to a page in a different page group. To copy 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

Copying an item preserves the item's metadata.

Example 11-10 copies an item to a page in a different page group:

Example 11-10 Creating a Copy of an Item in a Different Page Group (copy_item API)

begin
  wwsbr_api.copy_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 copy.

  • p_dest_caid is the ID of the page group to which you want to copy the item.

  • p_dest_page_id is the ID of the page to which you want to copy the item.

  • p_dest_region_id is the ID of the item region of the page in which you want to copy the item. If you do not specify a region ID, the item is copied to the page's default item region, which may not be desirable.

11.4.2 Copying Pages

You can use the copy_folder API to copy a page within the same page group. You cannot copy a page to a different page group.

To copy a page, users must have View privileges on the page being copied and Manage privileges on the page under which the page is being copied.

Example 11-11 shows how to copy a page.

Example 11-11 Creating a Copy of a Page (copy_folder API)

declare
  l_new_pageid number;
begin
  l_new_pageid := wwsbr_api.copy_folder(
    p_id        => 12345,
    p_siteid    => 33,
    p_parent_id => 10000
    p_name      => 'page1',
    p_title     => 'page1'
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

  • p_id is the ID of the page that you want to copy.

  • p_siteid is the ID of the page group to which the page belongs.

  • p_parent_id is the ID of the page under which you want to copy the page.

  • p_name is the name for the new page created by the copy operation.

  • p_title is the display name for the new page created by the copy operation.

11.5 Deleting Content

When content is no longer required, you can use APIs to remove it from the portal and free up space.

This section contains the following examples:

11.5.1 Deleting Items

You can use the delete_item API to delete all versions of an item or just a single specific version. This API also deletes all sub items associated with the versions being deleted. When you delete an item using this API, you can choose to accept the default delete mode for the page group or override this setting.

Example 11-12 deletes version 1 of an item permanently from the page group. The item version is permanently removed, even if the page group is set up to retain deleted items.

Example 11-12 Deleting an Item (delete_item API)

begin
  procedure delete_item(
    p_master_item_id => 48037,
    p_caid           => 54,
    p_version_number => 1,
    p_mode           => wwsbr_api.DELETE_ITEM_PURGE
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

  • p_master_item_id is the master ID of the item that you want to delete.

  • p_caid is the ID of the page group to which the item belongs.

  • p_version_number is the version of the item that you want to delete. If you attempt to delete the current version of the item, the ITEM_ACTIVE_VERSION exception is raised. If you do not specify an item version, all versions of the item are deleted.


    Tip:

    If you want to delete the current version of the item, you must either delete all versions, or use the OracleAS Portal user interface to revert to a previous version.

  • p_mode is the mode to use when deleting the item:

    • wwsbr_api.DELETE_ITEM_DEFAULT uses the page group setting.

    • wwsbr_api.DELETE_ITEM_PURGE deletes the item immediately, regardless of the page group setting.

    • wwsbr_api.DELETE_ITEM_LAZYDELETE marks the item as deleted, regardless of the page group setting.

To restore a previously deleted item, use the undelete_item API. If the item had any sub-items, those sub-items are also restored.


Note:

You can restore a deleted item only if the page group that owns the item is set up to retain deleted items, or the item was deleted using the wwsbr_api.DELETE_ITEM_LAZYDELETE mode, and the item has not been purged from the content repository.

Example 11-13 Restoring a Previously Deleted Item (undelete_item API)

begin
  wwsbr_api.undelete_item(
    p_thing_id => 12345,
    p_caid     => 33
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

  • p_thing_id is the unique ID of the deleted item that you want to restore.

  • p_caid is the ID of the page group to which the item belongs.

11.5.2 Deleting Pages

Use the delete_folder API to delete a page. Users need to have Manage privileges on the page to be able to delete it.


Note:

Deleted pages cannot be restored by another API call.

The following example shows how to delete a page.

Example 11-14 Deleting a Page (delete_folder API)

begin
  wwsbr_api.delete_folder(
    p_id     => 12345,
    p_siteid => 33
  );
  -- Process cache invalidation messages.
  wwpro_api_invalidation.execute_cache_invalidation;
exception
  ...
end;
/

  • p_id is the ID of the page that you want to delete.

  • p_siteid is the ID of the page group to which the page belongs.