272 total views, 7 views today

How to apply ADF View Criteria in AppModule Java class

In this section, we walk through about applying an ADF  View Criteria programmatically in AppModule Java class.

 

I have created a View Criteria for an Employee View Object called EmployeeEOViewCriteriaLT10000 which queries all the employee table where the salary is greater than 10000 as shown below. (Click here for instruction to create a View Object & ADF View Criteria for an Employee table).

 

050816_0538_AccessingVi1 How to Apply ADF View Criteria in AppModule Java class

 

Create Java classes for AppModule

First, we need to create Java classes for the Application Module.

Double Click on your AppModule.xml >> Click Java >> Click the Pencil icon >> Enable both the check box >> Click Ok. This will create Java classes for AppModule.

050816_0538_AccessingVi2 How to Apply ADF View Criteria in AppModule Java class

Accessing View Criteria

Open your AppModuleImpl.java and add a method as shown below. This method retrieves the view Criteria EmployeeEOViewCriteriaLT10000  and print the salary

050816_0538_AccessingVi3 How to Apply ADF View Criteria in AppModule Java class

 

Expose the Method

We have to expose the method to access it from the JSF page.

Double click on the AppModule.XML file >> Click Java >> Edit the Client Interface >> Move the method from Available to Selected

 

Test the AppModule

  • Right, click on the AppModule.XML >> Click Run
  • The AppModule wizard opens on the screen >> Double click on the AppModule >> Select the method >> Click execute
  •  

    050816_0538_AccessingVi4 How to Apply ADF View Criteria in AppModule Java class

 

  • The  Salary will get printed on the console

 

 

050816_0538_AccessingVi5 How to Apply ADF View Criteria in AppModule Java class

 

Create ADF View Criteria programmatically

The same way, we can create a ViewCriterea in AppModule Java class. The following method creates a ViewCriteria where Salary > 10000 and  Prints it in the console.

 

govindan How to Apply ADF View Criteria in AppModule Java class
Connect me

Govind

Thank you for visiting my personal blog. Myself Govindan, Software Developer by profession since 2006 and hence I started this blog early in 2016 and ever since I've been writing about technologies experienced and learnings of everyday life.

The views expressed on this blog are my personal views and do not necessarily reflect the views of my employer.

Please feeling free to reach me on any comments and feedbacks you have. Would be more than glad to listen and reply šŸ™‚
govindan How to Apply ADF View Criteria in AppModule Java class
Connect me
By | 2017-06-11T09:00:08+00:00 May 8th, 2016|Categories: ADF|Tags: , , , , |0 Comments
Like us on Facebook.
Connect!