ADF Tutorial: How to apply bulk actions to a view object rows. Part 1

Here is a quick one. If there is a requirement that states that an action must be performed to all the result set of a view object, then you might consider the following method. In our case, we have a requirement that we need to raise the salary of all the employees within an specific department. 

For this, we need to think where is the right place to implement this logic. We have several options. We have taken the one we consider is more neat and follows best practices; in the view object implementation class. Let’s see how is made:

First we need to create the ViewObjectImpl class;

adf_bc_bulk_action_view_impl

Then, we need to write the code to achieve this functionality. We need to iterate for the result set of the view object, we can do that using the following code;

adf_bc_bulk_action_view_impl_java

Now, we need to be able to access that method from our application module. That is why we need to expose it to the client interface of the view object itself;

adf_bc_bulk_action_view_impl_client

If we run the application module, we will be able to test it. Let’s pick some random department;

adf_bc_bulk_action_view_am_before

Since the method is exposed in the Employee VO, we right click to the link instance and select Operations from the menu;

adf_bc_bulk_action_view_am_view_operations

After this,  you will get the client interface screen where you can execute your exposed methods. Let’s give a rise of 2000;

adf_bc_bulk_action_view_am_view_operations_execute

If we check now, we will see the salary has increased just for the employees of this department;

adf_bc_bulk_action_view_am_after

Note: if you are working over the same project from previous posts; then a task for you will be to refresh the AvgSalary. We have re-executed the query of the VO to get this updated.

Leave a comment