Download sample application - UserCustomizationsSession2.zip. As I already have mentioned, this sample is based on my previous sample application from User Customizations for Duration of Session in Oracle ADF 11g blog post. Main update in today sample is changed User Customization level from Duration of Session to Across Sessions with MDS:
When you want to use persistence across sessions feature for saving query criteria results, in order to make it work you need to enable ADF Security in your application:
And define some configuration settings in adf-config.xml file - setup persistence store and define customization class:
That's it, now we can test it. I have defined to users for my sample - john and scott, both have same role assigned and same password - welcome1. First we'll open sample application as john user:
Will perform query and store query parameter together with search results as FirstNameStartsWithS:
Search results are saved, user can navigate away from page and come back, he will have choice to retrieve saved results by selecting previously saved query from Saved Search list:
Now we should do a test - let's close Web browser and open application again. We will check if we will have our saved search remaining in a new session. We should login with the same user as before:
And..., it works - in Saved Search list we can see previously saved query parameter and search results - FirstNameStartsWithS:
If we choose FirstNameStartsWithS saved search, it brings correct results:
Its important to say, persisted changes are saved even WebLogic server goes down, its because user modifications are stored on file system in persistence store directory.
Now we should test with second user - scott, this user should not see saved search results by user john:
It works as expected, there are no saved search results for user scott:
Persistence store is created in WebLogic domain folder structure, you can see separate directories for Model and ViewController:
Difference in View Object for user john, is persisted and we can see saved query parameter with value assigned: