Creating a master-detail Task Flow

Tweet about this on TwitterShare on Facebook0Share on LinkedIn4Share on Google+0

The Oracle ADF (Application Development Framework) is an application framework that builds on Java Platform, Enterprise Edition (Java EE) standards and open-source technologies. Because of its declarative nature, Oracle ADF simplifies and accelerates development by allowing developers to focus on the logic of application creation rather than coding details.

Let’s start programming in Oracle ADF and creating a master-detail Task Flow of departments and employees. Download sample application: MasterDetailApp.zip

To create a new Oracle ADF Application, navigate to File | General | Applications, select Fusion Web Application (ADF), and click on OK.

Change the following properties:

  • Application Name: MasterDetailApp
  • Application Package Prefix: br.com.waslleysouza

We don’t need to change the projects, so click on Finish.

creating-a-master-detail-task-flow1

Now, we have an application with two projects, Model that is responsible by model layer and ViewController that is responsible by view and controller layers.

To create Business Components, right-click on Model project and select New.
Navigate to Business Tier | ADF Business Components, select Business Components from Tables, and click on OK.

If this is the first time you create an application, you will have to create a database connection.
Click on plus icon to create the connection.
After configure the properties, click on OK twice.

creating-a-master-detail-task-flow2

An Entity Object represents a row in a database table and simplifies modifying its data.
We will only need the Employees and Departments tables for this application.
Click on Query to search tables from HR Schema and select Employees and Departments. Click on Next.

creating-a-master-detail-task-flow3

A View Object represents a SQL query and simplifies working with its results.
Select Employees and Departments, and click on Next.

creating-a-master-detail-task-flow4

We don’t need Read-Only View Object. Click on Next.

Application Module is the transactional component that UI clients use to work with application data.
Click on Finish.

creating-a-master-detail-task-flow5

Now, we have twelve files in our project:

  • AppModule is an Application Module.
  • Employees and Departments are Entity Objects.
  • EmployeesView and DepartmentsView are View Objects.
  • EmpManagerFkAssoc, DepMgrFkAssoc and EmpDepFkAssoc are Entity Associations. Entity Associations are business components that define a relationship between two Entity Objects.
  • EmpManagerFkLink, DepMgrFkLink and EmpDepFkLink are View Links. View links are business components that define a relationship between two View Objects.
  • Model.jpx file contains configuration information that JDeveloper uses in the design time to allow you to create the data model project with ADF Business Components.

creating-a-master-detail-task-flow6

To create Task Flow, right-click on ViewController project and select New.
Navigate to Web Tier | JSF, select ADF Task Flow, and click on OK.
Uncheck the Create with Page Fragments option, and click on OK.

creating-a-master-detail-task-flow7

Drag-and-drop a view component from Component Palette inside Task Flow.
Rename it to DepartmentEmployees.

creating-a-master-detail-task-flow8

Double-click on DepartmentEmployees, and click on OK to create the page.

creating-a-master-detail-task-flow9

Go to Component Palette and drag-and-drop Panel Splitter from Layout section inside page.
Change the Orientation property to vertical.

creating-a-master-detail-task-flow10

creating-a-master-detail-task-flow11

Go to Data Controls from Application Navigator pane, and expand AppModuleDataControl.
Drag-and-drop DepartmentsView1 inside first facet, and select Table | ADF Read-only Table.
Select Single Row option, and click on OK.

creating-a-master-detail-task-flow12

Go to Data Controls from Application Navigator pane, and expand DepartmentsView1.
Drag-and-drop EmployeesView3 inside second facet, and select Table | ADF Read-only Table.
Click on OK.

creating-a-master-detail-task-flow13

We need to refresh the second table when we select a row in the first table, to get the employees from department.
Select the second table, and go to Property Inspector pane.
Edit the PartialTriggers property, select the first table, and click on OK.

creating-a-master-detail-task-flow14

Save all.
To run the application, right-click on task-flow-definition.xml and select Run.

creating-a-master-detail-task-flow15

Ps.: Instead of create two tables inside the page, you can drag-and-drop EmployeesView3 inside page and select Master-Detail | ADF Master Table, Detail Table.
This way you have the same result. =D

creating-a-master-detail-task-flow16

Tweet about this on TwitterShare on Facebook0Share on LinkedIn4Share on Google+0

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 *