CRUD with Task Flow Template in ADF

When you are building an ADF Application, you should think about best practices to reuse some code and components. There is a very good post from Andrejus Baranovskis showing some Task Flow Template improvements. I will use it as my start point to create a CRUD Task Flow Template and my Task Flows will be based on this template.

Download the sample application: ADFTFTemplateApp.zip.

Create an ADF Fusion Web Application, and call it as ADFTFTemplateApp.
Create the Business Component using the Employees and Jobs tables.

adf-crud-with-task-flow-template1

Create an ADF Task Flow Template and call it as crud-tf-template.xml.
Drag two View (listView and editView) and a Method Call (CreateInsert) components and drop them into the template.
Just drag and drop the components, do not create them.
In the Data Control panel, expand Operations node, drag Commit and Rollback operations and drop them into the template.

adf-crud-with-task-flow-template2

Now, let’s create two Task Flows based on CRUD Task Flow Template.
Create the first Task Flow and call it as employees-flow.xml.
Check the “Base on Template” option and choose crud-tf-template file.

adf-crud-with-task-flow-template3

The Task Flow was created!

adf-crud-with-task-flow-template4

To create the pages, we need to override the view activities.
Right-click the listView activity and select the Override Inherited Activity option.
Double-click the listView activity and create the page.

adf-crud-with-task-flow-template5

Repeat the steps above for the editView activity.

adf-crud-with-task-flow-template6

We need to override the CreateInsert activity too.
Right-click the CreateInsert activity and select the Override Inherited Activity option.
In Data Control panel, expand the EmployeesView1 and Operations nodes, drag and drop the CreateInsert operation in CreateInsert activity.
In the Properties panel, change the Fixed Outcome property to view.

adf-crud-with-task-flow-template7

Repeat the steps above to create the Jobs Task Flow.

adf-crud-with-task-flow-template8

Run the application and enjoy!

adf-crud-with-task-flow-template9

adf-crud-with-task-flow-template10

Waslley Souza

Author: Waslley Souza

Consultor Oracle com foco em tecnologias Oracle Fusion Middleware e SOA. Certificado Oracle WebCenter Portal, Oracle ADF e Java.

Leave a Reply

Your email address will not be published. Required fields are marked *