Using Constants Guidelines for Using the APIs

Content Management API Introduction 9-7 In the Portal Focus Areas section, click Portlet Development, then in the APIs and References section, click PLSQL API Reference.

9.4.7 Naming Objects

When creating page groups and page group objects, you specify a unique internal name for the object p_name. Internal names must: ■ be no more than 60 characters in length. ■ not contain spaces or special characters other than the underscore character _.

9.5 Guidelines for Using the Secure Views

When using the secure views described in this manual, you should follow the best practice guidelines described in the following sections.

9.5.1 Identifying Primary Keys

The primary key for most objects contains the object id, the page group id caid, and the language. When joining between views, always use these columns in the JOIN clause. Example 9–3 shows the JOIN when joining an item to its page. Example 9–3 Joining an Item to Its Page select ... from wwsbr_all_items i, wwsbr_all_folders p where i.folder_id = p.id and i.caid = p.caid and i.language = p.language

9.5.2 Querying Translatable Objects

If an object is translatable that is, it resides in a page group for which translations are enabled and it includes languages in its key, you must observe the following rules: ■ If the object or its current version is translated, a row will exist for the translation. To select the row for the current session language, compare the value of the language column to the function wwctx_api.get_nls_language. ■ If the object is not translated, select the row for the page groups default language. Example 9–4 selects the translated page display name for all pages in a given page group. Example 9–4 Selecting a Translated Page Display Name select p.display_name title from wwsbr_all_folders p where p.caid = 53 and p.language = wwctx_api.get_nls_language -- The current language. or exists -- A row for the page in the page group default language. Note: In this release, there is no supported view of the document table in the repository. A secure view of the document table is planned for a future release. 9-8 Oracle Fusion Middleware Developers Guide for Oracle Portal select pg.id from wwsbr_all_content_areas pg where pg.id = p.caid and pg.default_language = p.language and not exists -- A row for the page in the current language. select p2.id from wwsbr_all_folders p2 where p2.id = p.id and p2.language = wwctx_api.get_nls_language

9.5.3 Selecting Data for the Current User

To select data for the current user, use the function wwctx_api.get_user. Example 9–5 selects items created by the current user. Example 9–5 Selecting Items Created by the Current User declare l_user varchar260; ... begin ... l_user := wwctx_api.get_user; select ... from wwsbr_all_items where creator = l_user ... end;

9.6 Code Samples

The code samples provided in the next few chapters are intended to provide some examples of how you can use the content management and associated APIs. Not all of the APIs are used in these samples, and the samples provided do not utilize all the parameters, constants, exceptions, and so on available to the APIs. For a full list of the public APIs available with Oracle Portal and their parameters, constants, exceptions and so on, 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. Tip: When writing PLSQL routines that refer to the current session language, call wwctx_api.get_nls_language once and store it in a variable. Referring to the variable in any following SQL statements, rather than calling the API multiple times, results in better performing code.