Monday, 30 May 2016

Implement MDS-User Customization in ADF 12C

Requirement: I have home.jspx page. In home.jspx I will have a banner “Welcome to the Home Page“, the loggedin UserName ansd the Logout link.

Also in home.jspx page I have an Employee table display the Employees data. Now we should be able to hide/show columns of the table. If we want we should be able to order the position of the columns as well.

Now when we logout of the session and try to Login with the same credentials, we should see the same changes the same user made in his previous session.

When the user Login with some other credentials those changes that was made by the previous should should not be visible to him.

Solution: For solution to the above requirement we will extend the workspace that we have created as a part of “Implement Security in Oracle ADF 12C“ sample, as we need to have security if we want to apply MDS. Various steps that are required for solutions are given below:

Step 1: Open an Oracle ADF Fusion Web Application ADFSecurityDemo.

Step 2: Create an ADF Business Components from Table (Employees) . The ADF Business Component should have EmployeesEO, EmployeesVO, and AppModule.

Step 3: Open home.jspx page.

Click Data Controls à Expand AppModuleDataControl à Select Employees1 and drag and drop it on home.jspx as ADF Table.

Select Row Selection as Single, Check Enable Sorting, Check Enable Filtering, Check Read-Only Table and then click OK as shown below:

Step 4: Double click ViewController project of the ADFSecurityDemo à Click on ADF View à Check Enable User Customizations à Select Across Sessions using MDS à Click OK.

Step 5: Surround the af:table with af:panelCollection and set styleClass="AFStretchWidth" for the af:panelCollection

Step 6: Expand Application Resources à Descriptors à ADF META-INF à Open adf-config.xml file as shown below:

Click MDS à Click the green (+) icon beside Costumization Configuration: Match Path = “ / “ à Add UserCC class à Click OK as shown below:

Click View à Select Tag Library under Tag Persistance as ADF Faces Components à Add Components as column and table as shown below:

Step 6: Save all and run login.jspx page.Thus the ran application is shown below:
Give the UserName as Susanto and Password as welcome1 and click on Login button. On successful Login we will land in the below home.jspx page.

Click View à Columns à Deselect FirstName and HireDate as shown below:

Drag and drop Email as the first column as shown below:

Logout to close the session and Login again with the same credentials. Thus we can see that whatever changes we have done in the previous session is persistance in the new session. That means the layout is saved for the user Susanto.

Logout and try to Login with the UserName as Moumita and Password as welcome1. Thus the home.jspx page will look as below:

Thus we can see that whatever changes we did for User Susanto is not persistant for the User Moumita.

Hence the solution to our requirement.

If you like the post, then comment, share and do like me on Facebook.

Thanks & Regards,

Susanto Paul