Get a hands-on introduction to Oracle ADF's services for personalization and customization
Today’s application users expect that their regularly used applications will remember how they like to work, and therefore not require them to set up the application anew each time they log in. Users want their common searches and screen layouts, for example, to remain from day to day, making their use of the application easier and more intuitive. Oracle Metadata Services provides a foundation that can be leveraged by Oracle Application Development Framework (ADF) applications to provide such persistent personalization. This article shows you how to configure your Oracle ADF application to allow end user customizations.
Desktop application users are accustomed to being able to set and save their personal application preferences. For example, Oracle JDeveloper 11g users can rearrange the application windows and set other preferences, and expect that when they exit Oracle JDeveloper 11g and return the following day, their preferred layout and other options will be as they left them. Saving personal preferences in this way allows users to customize applications to their desired way of working and thus increase their productivity. Now that many applications are delivered via a Web browser, more and more users will come to expect similar customizability for Web-based applications. Building such customizability into a new application can require a lot of development time; developers need to build a framework for storing personalizations in a datastore, capturing and saving user changes to such a datastore and applying the personalizations at runtime for a specific user. For complex enterprise applications (such as Oracle E-Business Suite), the effort required to build such a framework might well be justified; for smaller applications, the effort is often not justified.
Fortunately for developers using Oracle ADF, Oracle has already created services for personalization and customization and integrated them with Oracle ADF; they're called Oracle Metadata Services (MDS). Oracle E-Business Suite Releases 11i and 12 used a precursor of Oracle MDS to allow users to personalize their self-service applications, and to allow application administrators to customize aspects of the application for specific groups of users. In Oracle JDeveloper 11g, these capabilities are available for developers to leverage in providing the same capabilities to Oracle ADF Web applications.
This article was written using Oracle JDeveloper 11g (220.127.116.11). If you use the provided sample application, you will need to change the connection information for the HR connection defined in the Application Resources panel in the Application Navigator. Also note that to run the sample application, you should follow along with any required configuration steps detailed in the article.
Metadata Services Concepts
Oracle MDS stores customization and personalization information in a repository. The repository can either be stored in a database or in a file-based store; for reasons of scalability and reliability, as well other reasons, I strongly recommend using a database for storing the MDS repository (the next article in this series will show you how to configure the repository). For the develop/test/debug cycle, the Oracle WebLogic Server integrated with Oracle JDeveloper 11g provides a local MDS repository, so you do not need to set up a separate one for development purposes.
The MDS repository can store data about various types of customization and other metadata, including
* Specific properties of Oracle ADF Faces components that have been changed by the user at runtime (for example, the ordering of columns in a table)
* Users’ saved searches (created using the af:query component)
* Customized settings developed at design time for various Oracle ADF content, including Oracle ADF Faces, Oracle ADF Business Components, and Oracle ADF Controller (page flows)
* Customizations to resource bundles
* Metadata for other Oracle products, such as Oracle B2B
* Metadata for Oracle WebCenter applications
This article will show you how to configure an Oracle ADF application to allow end user runtime customization and how to run and test the customizable application in the development environment. The next article in the series will show you how to create design time customizations and how to configure a database-based MDS repository.
Requirements for End User Customization
For an Oracle ADF Faces application to allow end users to customize the application at runtime, you must follow several steps:
* Configure the Oracle JDeveloper 11g project to allow end user customizations.
* Configure a default customization class. The Oracle JDeveloper 11g documentation is not clear that this step needs to be performed; but in practice, I found that the changes did not persist if this step was omitted, and I also observed errors like this in the log:
Warning in log if customization class not specified
Figure 1 Warning in log if customization class not specified
* Configure the Oracle ADF application descriptor with the Oracle ADF Faces components that should enable customization.
* For saving user queries in the af:query component, configure a metadata namespace (as documented in the Oracle JDeveloper 11g release notes – if you are using Oracle JDeveloper 11g Version 18.104.22.168, this is not required).
* For deployment, you must create and register an Oracle MDS repository (this step is covered in a subsequent article).
Additionally, your application must conform to the following:
* Your Oracle ADF Faces pages must be stored in XML format (.jspx), and the user-customizable components in the page must each have an ID specified. These requirements are due to the way in which Oracle MDS records customizations made by the user.
* Your application must have security enabled. This requirement is so that Oracle MDS has an identity against which to store user customizations.
In practice, it is easiest if you perform all of the required steps when you first create your Oracle ADF application, because Oracle JDeveloper 11g will configure some settings for you (such as automatically creating your Oracle ADF Faces pages in XML format).
Step 1: Creating a Sample Application Model Layer
To demonstrate how to configure and test end user customizations, I’ll be using a simple application. In order to develop and run the sample application, you’ll need access to an Oracle Database with the HR sample schema installed. (You can download Oracle Database Express Edition (XE), a free version of the Oracle Database, here. ) First, you’ll create the application and create some default Oracle ADF Business Components. Then, before you create any Oracle ADF Faces pages, you’ll configure the application to support customization. Finally, you’ll create and test some customizable pages. You can either follow the summary steps below to create the application, or you can download the sample app. If you’d like to create the application on your own, follow these steps (I assume you have had some basic Oracle JDeveloper 11g experience, and as such, I will show you the abbreviated steps):
1. Create a new Fusion Web Application (ADF) by selecting New from Oracle JDeveloper 11g’s
File menu and selecting the appropriate option in the New Gallery: