Secure Content Repository Views

9-6 Oracle Fusion Middleware Developers Guide for Oracle Portal l_new_item_master_id2 := wwsbr_api.add_item p_caid = l_caid, p_folder_id = l_folder_id, ... ; wwsbr_api.clear_cmef_context; ... For more information about CMEF, refer to Chapter 16, Using the Content Management Event Framework .

9.4.6 Using Predefined Exceptions

The API packages contain many predefined exceptions. When coding with the content management APIs, it is good practice to include the appropriate predefined exceptions rather than relying on the WHEN OTHERS exception to pick up all errors. This also has the advantage that any error messages generated by the code can be more specific to the actual problem. Example 9–2 shows some of the exceptions you might include when calling the wwsbr_api.set_attribute API. Example 9–2 Using Predefined Exceptions 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 when wwsbr_api.ITEM_NOT_FOUND_ERROR then dbms_output.put_lineItem does not exist; when wwsbr_api.ATTRIBUTE_NOT_FOUND then dbms_output.put_lineAttribute does not exist; when wwsbr_api.ITEM_NOT_FOR_UPDATE then dbms_output.put_lineCannot update an item with a status of Rejected, Deleted or Marked for Delete; when wwsbr_api.NOT_AUTHORIZED_USER then dbms_output.put_lineUser trying to update the item is not the current user or the user who checked the item out; when wwsbr_api.EDIT_CUSTOM_ATTR then dbms_output.put_lineError while trying to update a custom attribute; when OTHERS then dbms_output.put_lineError ||to_charsqlcode||: ||sqlerrm; end; For a full list of the exceptions available in each API package, refer to the Oracle Portal PLSQL API Reference on Portal Center: http:portalcenter.oracle.com Tip: When using predefined exceptions, remember to include the name of the package that owns it, for example wwsbr_api.PAGE_ NOT_FOUND.