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.
Step 1: Configuring the Application to Support User Customization
As mentioned previously in this article, ideally you should configure your application to support end user customization before you start to create any Oracle ADF Faces pages. To configure the application, follow these steps:
- Double-click the ViewController project in the Application Navigator to display the project properties. Select the ADF View node and enable user customizations across sessions using MDS by selecting the appropriate options and clicking OK:
Figure 1 Enabling user customizations in the ViewController project - Using the Application Navigator, expand the Application Resources section, and double-click the adf-config.xml file (it will be in theADF META-INF subfolder of the Descriptors folder):
Figure 4 Locating the adf-config.xml file - For the runtime changes to persist properly, at least one customization class must be registered. Click the Add icon to add a customization class. In the Edit Customization Class dialog box, specify
oracle.adf.share.config.UserCCas the name of the customization class (this is a default customization class provided by Oracle ADF; you will not be using the capability of the UserCC customization class, but a customization class must be specified for personalization to work) and click OK:
Figure 5 Specifying the customization class - Specify which of the Oracle ADF Faces 11g components should allow end user customization. You do this by selecting the Viewsection of the adf-config.xml editor and using the Add button to add the specific components. For our sample application, we’ll allow the user to customize the columns’ order/size/etc. in a table (by enabling customization of the column component) and allowing the user to customize whether specific panel boxes are disclosed (by enabling customization of the panelBox component):
Figure 6 Adding panelBox to the list of customizable componentsWhen you have finished adding both the column and panelBox components to the list of customizable tags, the editor should look like this:
Figure 7 adf-config.xml editor showing column and panelBox as customizable tagsIf you like, you can also add other components and specify which specific properties of the components will be persisted. The list of Oracle ADF Faces components and their properties that can be persisted by default can be found in the documentation. - As documented in the Oracle JDeveloper 11g release notes , you must make a manual configuration change to the adf-config.xmlfile to enable persistence of users’ saved queries (for the af:query component); this is not required if you are using Oracle JDeveloper 11g Version 11.1.1.3. To make the change, click the Source tab of the adf-config.xml editor to display the XML source for the file. Locate the cust-config element and paste the code from the release notes (I also like to add an XML comment so that I remember why the code was added). When you have completed this step, the adf-mds-config element of your adf-config.xml file should look something like this: You can copy code from here.
<persistence-config><metadata-namespaces> <namespace path="/persdef" metadata-store-usage="MAR_TargetRepos"/> </metadata-namespaces> <metadata-store-usages> <metadata-store-usage id="MAR_TargetRepos" deploy-target="true" default-cust-store="true"></metadata-store-usage> </metadata-store-usages> </persistence-config> Just write this code under the </cust-config> tag.
Figure 8 adf-mds-config section of adf-config.xml file after manual change
Step 2: Enabling Oracle Application Development Framework Security for the Application
Finally, before you can test persistence of end user customizations, you need to enable security for your application so that MDS can identify the user making the customizations; at a minimum, your application needs to have authentication configured. The ADF Code Corner section of OTN has a number of tutorials on setting up ADF security (see “ADF Code Corner Internet TV”) . However, for the purpose of demonstration, we will do just a very simple security setup for our sample application. Fortunately, Oracle JDeveloper 11gincludes security wizards that make this simple setup quite easy. To configure security in the sample application, follow these steps:
- Invoke the ADF Security wizard from the application menu of the Application Navigator:
Figure 13 Invoking the ADF Security wizard - For our simple testing, select ADF Authentication and click Next:
Figure 14 Selecting ADF Authentication only - At this point, you can simply click Finish to complete the wizard, or if you like, you can click through each step separately to see the options available to you.
- When you finish the wizard, Oracle JDeveloper 11g will display a message telling you that the security infrastructure has been created and providing a link for some more information:
Figure 15 Security infrastructure created - To test the application with security enabled, you should create a few users using Oracle JDeveloper 11g’s jazn-data.xml editor. You can access the editor from the Application Navigator menu like this:
Figure 16 Opening the jazn-data.xml editor - Now, you can use the Add button to add users to the configuration. For my testing, I added users named “john” and “josephine,” each with passwords of “weblogic1.” Because our test application only has authentication (and not authorization), you do not need to assign any roles to the users:
Figure 17 Creating the users
Now you can run your application and you can test your customise-able application by just reorder any columns and logout from application. Then close your browser and reopen it and then you can see your customization of the specific page will exist.
Conclusion
You now know how to enable and configure end-user customization persistence for Oracle ADF Faces applications and how to test such applications in the integrated Oracle WebLogic Server. The next article in this series will show you how to implement seeded customizations to design a different application experience for different groups of users.
Source: http://www.oracle.com/technetwork/articles/adf/part8-085816.html
One most common error like
ReplyDelete"Caused by: oracle.mds.persistence.DocumentExistsException: MDS-00512: failure to create document /mdssys/cust/user/ADMIN/ChartTnaIK.jsff.xml because file C:\Users\Nasir\AppData\Roaming\JDeveloper\system11.1.1.5.37.60.13\o.mds.dt\adrs\AutoGeneratedMar\mds_adrs_writedir\mdssys\cust\user\ADMIN\ChartTnaIK.jsff.xml already exists
just go to the following path and rename the file or delete that file of a particular user, so that the specific user can customize again to his page.
C:\Users\Nasir\AppData\Roaming\JDeveloper\system11.1.1.5.37.60.13\o.mds.dt\adrs\AutoGeneratedMar\mds_adrs_writedir\mdssys\cust\user\ADMIN\Yourtestpage.jsff.xml