Wednesday, 2 April 2014

How to keep or remove the runtime MDS customization in Oracle ADF Jdeveloper

Sometime we face a problem that the MDS customization work fine for the first time, but if we run the application again, then it creates some problem e.g it did not allow to make the user any change in UIl, it give some exception.

So, If you want to avoid this error/exception then just follow a simple step.

1.  Go to Application --> Application Properties --> Run --> MDS and from the directory content use the select "delete customization before each run".

After selecting this option whenever you will run your ADF application all the customization/preferences by the users will be vanished. Then the users will have to customize the application again according to their own choice.

If you select the "Preserve customization accros application runs " then it will keep the preference forever either you run many time your ADF application.

I suggest you to override location also, because you can also avoid the above problem by just changing the default path.




How to Change the context root of Oracle ADF Application

It's very annoying to have a long url of your application. You can make it short very easily by just following the one simple step.

1. Double Click on the view-controller project or go to Application tab and click on the project properties and change the name of the Java EE Application and also change the Java EE Web Context root below it.

After this when you will run you ADF application you can see very short url in the browser.


How to build customiseable Oracle ADF Application in easy steps

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:
  1. 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

    stegeman-mds1-f3
    Figure 1 Enabling user customizations in the ViewController project
  2. 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): 

    stegeman-mds1-f4
    Figure 4 Locating the adf-config.xml file
  3. 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.UserCC as 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

    stegeman-mds1-f5
    Figure 5 Specifying the customization class
  4. 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): 

    stegeman-mds1-f6
    Figure 6 Adding panelBox to the list of customizable components
    When you have finished adding both the column and panelBox components to the list of customizable tags, the editor should look like this:
    stegeman-mds1-f7
    Figure 7 adf-config.xml editor showing column and panelBox as customizable tags
    If 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.
  5. 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.
  6. stegeman-mds1-f8
    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:
  1. Invoke the ADF Security wizard from the application menu  of the Application Navigator: 

    stegeman-mds1-f13
    Figure 13 Invoking the ADF Security wizard
  2. For our simple testing, select ADF Authentication and click Next

    stegeman-mds1-f14
    Figure 14 Selecting ADF Authentication only
  3. 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.
  4. 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: 

    stegeman-mds1-f15
    Figure 15 Security infrastructure created
  5. 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: 

    stegeman-mds1-f16
    Figure 16 Opening the jazn-data.xml editor
  6. 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: 

    stegeman-mds1-f17
    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