Friday, August 15, 2014

Personalization using MDS in Oracle ADF

Personalization for the users is the most wanted features in Enterprise applications nowadays. This gives user good experience and makes him to decide what and how he needs to see things in Enterprise Applications .

This post we will see how can we do User level Personalizations in Oracle ADF Applications and steps to configure it.

Example uses Jdev 11.1.1.7. Lets get started !


Created a simple ADF Application. Created BC from HR schema consist of EmployeesEO/VO and DepartmentsEO/VO and AppModule.

Implemented ADF Security. This is required since we are doing personalization for a particular user



Now first step is enabling MDS between the sessions. This is done on View Controller project .

ViewController -> Properties ->ADF View -> Enable User Customizations.

By default it is between the sessions, since we need to make it between the session, one needs to check Across the Sessions using MDS.



So now it is enabled across the sessions using MDS.


Next thing to configure is adf-config.xml . This file has all the information about what Layers are defined for Personalizations and what are the components and their attributes will be persisted to MDS store.

First is adding User Layer.

Open adf-config.xml -> MDS Configuration. Click on green icon and search for UserCC.



UserCC provides user level customization. All the changes which a user makes for MDS enabled component, are store for that particular user in MDS Store.


Refere UserCC documentation : http://docs.oracle.com/cd/E41362_01/apirefs.1111/e10686/oracle/adf/share/config/UserCC.html

Ok So we are done with enabling MDS in our application as well as defining UserCC Layer.

Now next thing is to define, what components and attributes will get persisted to MDS Store.

On the View option in adf-config.xml , we need to add Tags and Tag Attributes. Tags are components which will be participating in MDS persistence. Tag Attributes are attributes of the Tags which will be getting saved to MDS Store.

So in Tags lets add Table and Column. When you click on green add icon, there will be list of components :



After adding table below is how it looks :



After adding Tags, there will be default tag attributes which will get added.

Lets also add column in Tags.


Persist changes simply depicts whether attributes state will be stored in MDS or not.

So now we are all set. Lets create a page in View Controller project with a table out of EmployeesVO.
After this lets deploy the application.

On deployment, there is a Deployment Configuration window which comes up. 


This is a option where you need to select MDS Store. MDS Store can be of two types. One is Database and other is local file system. For now we will use local file system. So selected second option.

On running the page, ADF security asks for username to login. User user name testuser1 in this case to login first. 


On login use is greeted with table. 
Now lets do some changes to columns. Lets remove any particular column. Lets remove first column which is employee id.



Now Logout and login again with same user. One can see below that Employee id column is not shown on the table.



But this change will be there only for this user. Lets Login with some other user.


You can see below that for this user, Employee Id column is there.


So our Personalization is working for a particular user :)

Now lets see what is happening behind the scenes.

Since we used file based MDS, all the personalizations for every user is store in file system. It creates a folder for each user that performs Personalization.
They are by defaul stored at :
C:\Users<username>\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\o.mds.dt\adrs\UserMDSApp\AutoGeneratedMar\mds_adrs_writedir\mdssys\cust\user\robertlewallen


We can see that there is a xml file which is of our page which user modified. Changes of this page is persisted in this xml file UserMDSTest.jspx.xml.

For every user which performs personalization and which are added to MDS, there will be a folder with that user name. Inside the user name , there will be xml for all the pages which that user has modified. These changes will be applied at runtime on top of normal rendering of the page thus resulting of personalized output.

If we open this XML and see the contents , it shows as below :


One can see that
   <mds:modify element="c4">
      <mds:attribute name="visible" value="false"/>
   </mds:modify>

Here c4 is id of column which is made invisible and attribute 'visible' is made to false.


In next posts on MDS we will see how to add attributes which are not specified by default for a component. Also we will take a look how we can save attributes programmatically. 


Hope this was usefull !!

Thanks

21 comments:

  1. Thanks for share such usefull article.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. How to achieve this without using ADF security?

    ReplyDelete
  4. Most Welcome Ajay.
    Rahul - For this case you need to create Custom Layer Class. You can create a class by extending from CustomizationClass and overriding getValue() method which will return userNames and will act as layer.
    Refer - http://docs.oracle.com/cd/E28280_01/web.1111/b31974/customize.htm#BABJDBEA

    Thanks

    ReplyDelete
  5. Ho Rohan,
    Thanks for the nice post.
    Could you please share the steps to create mds store (file system or DB based)?

    ReplyDelete
  6. Hi Saurabh, Thanks !!
    For File system based MDS Store , you dont have to do anything. Once MDS is enabled, it will by default start saving MDS changes in XML. It will be saved on ur local machine file system at C:\Users\\AppData\Roaming\JDeveloper\system11.1.1.7.40.64.93\o.mds.dt\adrs\UserMDSApp\AutoGeneratedMar\mds_adrs_writedir\mdssys\cust\user

    For DB Based, you just need to run RCU(Repository creation tool) which can be downloaded from OTN. Create a datasource out of it. When you deploy/run your application make it as MDS Store.

    Thanks!

    ReplyDelete
    Replies
    1. Hi Rohan, I am working with jdeveloper 12.2.1.1.0 and I followed your post to get the personalisations saved in file based MDS repo. Can you please list out the detailed steps to achieve the same with DB Based MDS. I did not get the lat part of your reply to Saurabh "When you deploy/run your application make it as MDS Store.". Can you please list out all of these steps in details?

      Delete
  7. Hi Rohan,
    Thanks for the post.
    I have tried to run app using MDS. Created sample App as per the steps you mentioned But, while deploying i could not get the Deployement Configuration window to select MDS Store.
    Please upload ,if you have sample app.

    ReplyDelete
  8. Thanks Dtmrp,
    How are you deploying the application? If you will run by right click and run page, it will use file based store. You need to deploy it as ear/war by creating deployment profile. At that time it asks for configuration window.

    ReplyDelete
  9. Hi Rohan,
    Thanks for the nice post.
    How to use personalization using SSO login?
    My code is working with MDS file system as well as with RCU repository using jzan authentication but when i run the same using my Single Sign On settings then it's not working.

    Thanks,
    Vik

    ReplyDelete
  10. This comment has been removed by the author.

    ReplyDelete
  11. Hey Rohan,
    your providing such a valuabe information about studying..and also have some good key points to every student.
    ORACLE ADF

    ReplyDelete
    Replies
    1. Thanks Neha for this. Glad that you liked it.

      Delete
  12. There is a great blog about Oracle ADF and thanks for sharing about Oracle ADF information. We are providing online training classes OracleADFonlinetraining

    ReplyDelete
  13. Thanks for giving this topic this is helpful for Informatica learners and helpful to the online training class oracleadfonlinetraining

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. Thanks for the Best topic. Very useful information.
    We IT hub Online Training are good in giving the oracle adf training

    ReplyDelete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Hi Rohan,

    Any thoughts on achieving this?

    Req:

    Provide a selectOneChoice to user with items 10,20,40,50... and display selected number of rows from tables present in app across sessions based on selection.

    and I see only few components available to use with MDS. Can i use any component? For example can i save and render disabled of commandImageLink and retrieve from MDS to perform some logic.

    Thanks.

    ReplyDelete
  18. Excellent Blog very imperative good content, this article is useful to beginners and real time
    employees.Thank u for sharing...
    Oracle ADF Online Training
    Oracle DBA Online Training
    Oracle APPS Online Training

    ReplyDelete
  19. CIITN is located in Prime location in Noida having best connectivity via all modes of public transport. CIITN offer both weekend and weekdays courses to facilitate Hadoop aspirants. Among all Hadoop Training Institute in Noida , CIITN's Big Data and Hadoop Certification course is designed to prepare you to match all required knowledge for real time job assignment in the Big Data world with top level companies. CIITN puts more focus in project based training and facilitated with Hadoop 2.7 with Cloud Lab—a cloud-based Hadoop environment lab setup for hands-on experience.

    CIITNOIDA is the good choice for Big Data Hadoop Training in NOIDA in the final year. I have also completed my summer training from here. It provides high quality Hadoop training with Live projects. The best thing about CIITNOIDA is its experienced trainers and updated course content. They even provide you placement guidance and have their own development cell. You can attend their free demo class and then decide.

    Hadoop Training in Noida
    Big Data Hadoop Training in Noida

    ReplyDelete