Thursday, May 31, 2012

SavedSearch in af:query panel

The component, af:query allows you to save the search criteria and its results. If you want to save the search across the user sessions, we need to use either file based MDS or DB based MDS. I am demoing the way to save the search and its results in the af:query.

Steps to follow:
1) Create the model project  and the business components (EmployeeEO, EmployeeVO, HrModule etc).
2) Create a view criteria in EmployeeVO which can be dropped as search criteria in the page.
3) Create the view controller project and create a page and drop the view criteria as Query --> ADF Query
     panel with table.
4) Enable security for the application. Goto Application menu ---> Secure --> Configure Security ---> ADF
    Authentication and Authorization --->  HTTP Basic Authentication ---> No Authentic Grants ---> Redirect
    Upon Successful Authentication (select your page in the welcome page) ---> Finish.
5) Open jazn-data.xml file and goto Resource Grants tab. Select 'Web Page' in the ResourceType and select
    your project in the SourceProject.
6) Select your page in the 'Resources'  and goto Granted To section and click on + icon , add the                                    
    authenticated  role.
   

7) If you want to create any other users, goto 'Users' tab in the jazn-data.xml file and create. By default,
    weblogic/weblogic1 user available with the weblogic server. I created a user amason/welcome1 here.

8) Right click on your UI project, goto project properties, select ADF View ---> Check 'Enable User
    Customizations' and select 'Across Sessions Using MDS'.


9) Open adf-config.xml file --> MDS Configurations -->  Add 'UserCC' as the customization class.

 

10) Goto 'View' tab in the adf-config.xml file and select the UI components whose settings you want to save
      in the MDS. Here I selected table, panelBox which I used in my page.



11)  Open the adf-config.xml file in the source mode and add the below tags under <mds-config>.

    <persistence-config>
<metadata-namespaces>
<namespace path="/persdef" metadata-store-usage="MAR_TargetRepos"/>
</metadata-namespaces>
<metadata-store-usages>
          <metadata-store-usage id="MAR_TargetRepos"
                                deploy-target="true"
                                default-cust-store="true">
          </metadata-store-usage>
</metadata-store-usages>
      </persistence-config>

12) Now Run your page, login with weblogic/weblogic1. Search and save the search. I login with
      weblogc/weblogic1 and saved the search as 'WeblogicDept20'. When you logout and login again you
      can see the search you saved in the 'Saved Search' choice list. If you login with different user                                ( amason/welcome1) , you don't see 'WeblogicDept20' in the 'Saved Search' choice list.



13)  Similarly, you can login with amason/welcome1 and save your search. In the below picture, you don't
       see the search done by the user weblogic.







No comments:

Post a Comment