Tuesday, 3 December 2019

What is RowQualifier in ADF?

Rowqualifier is used in ADF to programmatically filter rows. This can be used to filter the ViewObject based on one or more where clauses.

For example: If you have an employeeViewObject containing information of the employees and you want to fetch the record of the employees for some particular department. In this case, RowQualifier can be used.

RowQualifier filters the rows from the Memory. i.e. first it loads all the records of the ViewObject in the memory and then filtered the row.

RowQualifier in ADF




Tip: Never user RowQualifier on a table with large no. of records as it will take time to load all the rows into the memory and then run the filter. The application may take some time to process the request.


I have created a method in ApplicationModuleImpl to filter the rows of EmployeeVO on the basis of the RowQualifier.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
    public void getEmployeeOfDepartment(Integer DepartmentId) {
        // Employee ViewObject Instance
        ViewObjectImpl employeeVO = getEmployeeVO1();
        System.out.println("Employee Count :" + employeeVO.getRowCount());
        // Creating rowQualifier for EmployeeVO
        RowQualifier rQlfr = new RowQualifier(employeeVO);
        rQlfr.setWhereClause("DepartmentId =" + DepartmentId);
        Row[] filteredRows = employeeVO.getFilteredRows(rQlfr);
        System.out.println("Employees in Department 10 :" + filteredRows.length);
    }

On executing the method below result is printed.



We can also filter the rows using ViewCriteria in ADF Application.
What is ViewCriteria in ADF??

Monday, 2 December 2019

What is a View Criteria in ADF?

ADF ViewCritera is basically used to create where clause in ViewObjects.

Suppose you have created a ViewObject with a selected statement and you want that data to be filtered by where clause, in this case, ViewCritera comes into the picture.


Let us see how we can create a ViewCriteria.


Click on Add Button to create a ViewCriteria.


Now click on Add Item button to add a clause to View Criteria.


Here I want a filter the Department table with the DepartmentVO with DepartmentId as 10. So I have selected value 10.  So the ViewCriteria is created now.


I have added an instance DepartmentVO2 to apply the above viewCritera and check.


Now click on the Edit Button. and select the ViewCritera.




Now click on the Ok button. So the ViewCriteria is applied now.
Run the application module to see the results.
As you can see the buttons are grayed out, which means there is only one record in the view. The records are filtered on the basis of given criteria.


RowQualifier can also be used for in-memory filtering of the rows.
Filtering rows through RowQualifier in ADF