Resetting CMEF Global Variables

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. Content Management API Introduction 9-9 The examples are written to be run from SQLPlus. If running from other environments, for example Portal Services, you may need to make changes to the code given the context in which it is executing. The examples, with the exception of Chapter 14, Creating Multi-Lingual Content , which deals with translations, assume that the language context is set to the default language of the page group being manipulated. This simplifies the WHERE clause on any SQL statements. Objects always have a translation in the default language therefore the queries will return a single row as appropriate. If this assumption on the language code does not hold true for your code, refer back to Section 9.5.2, Querying Translatable Objects for an example of how to extend the WHERE clause to deal with multiple translations or the non-existence of a translation in the given language context.