Requirement: I have home.jspx page. In home.jspx I will have a banner “Welcome to the Home Page“, the logged in 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” post, as we need to have security if we want to apply Metadata Services.
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 Customization 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 persistence 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 persistent for the User Moumita.
Hence, the solution to our requirement.
If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.
Thanks & Regards,
Susanto Paul
566 total views, 3 views today