Monday, November 24, 2014

Persisting to MDS Store using Programmatic API's in ADF

In last some of the posts regarding MDS, we saw how to achieve Personalizations and Seeded Customizations in Enterprise applications using Oracle ADF. There was explanation how to leverage Oracle ADF MDS framework for this purpose. Most of the personalization and customization is provided OOTB by the framework and just requires correct configurations and steps to achieve. These are declarative user customizations which allow to implicit save component changes done by the user.

But there are scenarios where some custom persistence is required to be saved to MDS Store. This means, that state of the components needs to be changes based on certain conditions. This explicit saving of state of components can be done using Java API provided by the framework.

Lets take an example for this post:
This example uses a ShowDetailFrame which is webcenter component. There is a button show/hide SDF which hides and shows the below SDF. Now this hide and show of SDF is being persisted in MDS Store. For now we will take File system based MDS Store. So for a particular user, when user performs show or hide of SDF, its state is stored in MDS and is presented to the user when it Logins next time into the application.

So when user clicks Hide/UnHide SDF button , action listener has to perform the logic of hide/unhide of SDF. More than this, the action listener needs to save the state of SDF (hide or show) to MDS Store. Now this is where it comes to the topic of this post. At this stage, it need some mechanism in action listener to perform this save of state of SDF to MDS Store.

This is done through API provided by MDS framework in ADF. It uses ChangeManager API from FacesContext to perform this.

Below is the page layout that I have described above.

Now lets see the implementation part. MDS is enabled and UserCC is added to adf-config.xml along with showDetailFrame as component.

By default showDetailFrame when selected from dropdown green button only has expansionMode and  contentStyle. Since we will be dealing with Hide/UnHide of SDF we need to add rendered property of SDF under showDetailFrame TagAttributes. Though there are no options in the Overview mode of adf-config.xml, attribute can be added in source mode. This is done as per below.

Now when Overview mode of adf-config.xml is again selected , one sees the new rendered attributed added.

By this way, one can add any attribute available with the component in the Tag Attributes just by adding the attribute in XML source of adf-config.xml under tagLib tag of the component.

Now since everything is set for our use case, lets see the page and managed bean where we need to code our magical action listener to save the state of SDF to MDS.

Below is the page how it which look like.

CustomMDSAppMB is managed bean. PannelCollection and showDetailFrame have their respective bindings in the bean. PannelCollection acts as a outer container which is being refreshed programmatically from actionlistener after show and hide is being done. Below is the code for actionlistener

This method gets called on click of hide/UnHide SDF and simply checks that if SDF is already rendered, set its rendered property as false else true.

Setting up of rendered property makes the SDF appear or disappear. After it the outer container(Panel Collection in this case) is being refreshed to make SDF appear or disappear.

So far so good. Now we achieved appear/disappear of SDF on button click. But the main thing is still pending. We need to save this state of SDF (weather appear or disappear which means redered property is true or false) in MDS Store for a particular user so that when user logs into the application next time he sees the changes done in last login.

Yes you guessed it right. persistAttributeChange method is doing the persistence of rendered attribute of showdetailframe to the MDS store.

Below is what persistAttributeChange method looks like.

The ChangeManager api provided by ADF is used to persist the attribute for a particular component to the MDS Store.

Now lets run the application. Login using Weblogic as user and click on hide/unhide SDF.

The result of click is as follows.

On click Hide/Unhide SDF, actionlistener gets fired and it changes the rendered property of SDF and save to MDS by calling persistAttributeChange method which uses ChangeManager API. One can see the changed xml in local file system.

Thats it, by using powerful MDS framework provided by ADF, developers can not only perform personalizations declarative/implicitly but also power of API which is provided by the framework can be used to do custom explicit personalizations.

Thanks !!


  1. Hi,

    Is there a way to copy an ADF saved search in the MDS programmatically and assign it to a difference user? Which will, in effect, share the saved search with another user? The MDS is database-based.


  2. Hi William,

    ADF Search can be saved in MDS, but i doubt that if it will be assigned to different user since the customization object needs to be based on user, roles or site. What I think is it may be possible if we give it a try by creating our own customization object. I will try and write a post on this.


  3. Hi,

    If i want to play with the af:query in respect to MDS, how do i achieve that. The tag configuration in adf-config file does not have query component in it.


  4. Hi Rohan,
    I have a question about saved search.
    My VO has some attributes which have default values which are exposed in the view criteria and thereby in the query panel. But when i create a saved search, my defaults are not getting persisted in the MDS.

    Have you come across this scenario?

  5. last month he share is herbal medicine in some medical hospital and now he is well recognize as one of the best in West Africa, you don’t have to be sad any more or share your tears any more on this virus when the cure have already be find in 2013 if you want to get in touch with him in private contact him on his email Or you can visit his website on https:// or