Tuesday, December 17, 2013

Reusable Task Flow for Dynamic Tables in ADF

In this post we will be seeing practical example of reusing task flow to display same tabular format of data using same table component for different View Objects.

So suppose there are two pages in the application Employee and Department and both show respective data in Table format. Instead we can create a task flow which can take the name of the ViewObject as a parameter and display data on the same table dynamically. There will be only one page in task flow and one table component in the page which display data of employee and department dynamically based on corresponding VO name as input parameter to the task flow. Isn't this wonderful. Further you can reuse the same taskflow anywhere in the application by just changing the input ViewObject name.

Lets get started.

Lets create a ADF Fusion Web Application and create business components for model layer. I used HR Schema and created EO and VO for Departments and Employess along with AppModule which gives us a data control.

Now in the view project, create a Bounded Task flow and name it as reusableFlow . This task flow has a jsff display.jsff which will be having a Dynamic Table which will show data dynamically based on input VoName parameter to reusableFlow task flow.

Now lets create a parameter in the reusableFlow task flow to take Vo Name as input.

Now double click on Display page and open it. Drag DepartmentsVO from data control and select ReadOnly Dynamic table as below.

Below is the source code which will be generated in display.jsff.

Now lets go the Page definition file of display.jsff. Below is the source code for displayPageDef.xml

Now this is normal binding. We need to make this binding as dynamic. This means we need our Iterator binding to be based on VoObject name. So lets modify it as follows.

Here we have changed the Binds variable of Iterator tag to take value from pageFlowScope.voName. This is the parameter which will be set when reusableFlow will get called.

And also id field of Iterator tag is changed so that it can be used in tree binding.

nodeDefinition tag is now empty. This signifies that all the nodes of the iterator are available.

Ok so now bindings are in good shape. Let's change UI. Change the dynamic table source code in display.jsff and replace DepartmentsVO1 with GenericTable which is name of our generic tree binding.
Below is the changed source code.

We are all set with our task flow. Lets invoke it and provide a parameter. 

Create a new task flow and name it as inputFlow . Create a jsff  voInput.jsff and drag the reusableFlow on to it and connect it with control flow as below.

Create a Managed Bean and register it in inputFlow task flow.

Now create a field inputVoName in ReusableFlowBean managed bean and generate its accessors.

Now in voInput.jsff source code add an input text and bind it to field inputVoName of managed bean. Add a submit button with action as flow control case. Add a property listener to add the value of input field to pageFlowScope.voName. Below is the source code.

Next is to provide this Vo name as parameter while calling reusableFlow task flow.
Provide the parameter as below.

So we are done now. Lets create a page to test. Create input.jspx and embedd inputFlow task flow as a region.

Now run input.jspx.

Enter value of DeparmetsVO1 which is there in AppModuleDataControl.

Click submit and you will see table with Departments data populated.

Similarly if you input EmployeesVO1 , it will show Employee records table on the same component.

That's it. That's the power of using dynamic bindings. 

Happy Learning !!

Refrences :- https://blogs.oracle.com/groundside/entry/towards_ultra_reusability_for_adf (Thanks to very useful and informative post from Duncan Mills)


  1. This comment has been removed by the author.

  2. Do you have example for dynamic pivot table??

  3. Hi Carlos, not this time. But I will surely come up with a post on pivot tables!!

  4. Thanks, sounds greats. But, it's possible?? because i tried of many ways without successfully

  5. Yes its possible !! Will write on it shortly !! Take Care

  6. hi Rohan Walia ,i tried to drop DeptVo as read only Dynamic table into jsff ,but i did't found that option in table context menu
    how can i enable this feature?

  7. hi Rohan i followed all steps, but i am facing below error.

    oracle.adf.controller.ControllerException: ADFC-10001: cannot instantiate class 'ReusableFlowBean'

  8. In case you are looking into making money from your visitors via popup ads - you can try one of the most reputable networks - Propeller Ads.

  9. Hadoop Training Institute in Noida, The Hadoop certification has considerable advantages in addition to the great demand for trained professionals. A certified Hadoop professional gets the advantage in terms of payment package compared to other professionals working in the field without certification. When it comes to IJP, Hadoop certification is compatible to advance the ladder and accelerate your career. big data hadoop training in Noida, big data hadoop Training institutes in Noida, sector 2, oracle big data training,Oracle Training in Noida, big data boot camp, nosql database training, big data appliance training, exalytics training, exadata course, big data introduction, oracle course, oracle training, big data training in Noida, ibm big data hadoop training institutes noida
    Hadoop Training Institute in Noida


    B-12, Sector - 2, Noida, U.P
    State - Uttar Pradesh U.P
    Country - India
    Pin Code - 201301

    Phone - +917290926565
    Mon - Sun: 10am - 6pm