ORACLE JDEVELOPER/ORACLE APPLICATION DEVELOPMENT FRAMEWORK
ORACLE JDEVELOPER/ORACLE APPLICATION DEVELOPMENT FRAMEWORK
C:/FrameworksMayJun2010/EmpFlow/
C:/FrameworksMayJun2010/DeptFlow/
right-click the Dept entity object in the
EmpFlow.jws file. Note that the EmpFlow
DeptFlow.jws file. The Model project already
Resource Palette and choose Add to Project.
workspace’s contents replace the MainApp
When the Confirm Add ADF Library dialog workspace’s contents in the Application
contains a DeptModule application module,
box appears, click Add Library. This action Navigator. (The control at the top of the
so the first order of business is to create a
performs two configuration tasks under the Application Navigator displays the name of
view object to work with the list of depart-
covers. First, it updates the current ( Model) the current workspace and enables you to
ments. The entity objects used by all of the
project to depend on this new Oracle ADF select any other open workspace to make it
application’s task flows were developed in a
separate Entities workspace and deployed to
library by adding the JAR file to the ADF
current when necessary.)
Library entry in the project’s library list. In the EmpFlow workspace’s
an Entities.jar Oracle ADF library. You’ll start
by adding the appropriate Dept entity object
Second, it imports the package of Oracle ADF
ViewController project, expand the Web
from this library to the current project to
business components containing the Dept
object, so that these components are avail- contains. Note that the empflow task flow
Content folder and the Page Flows folder it
build a view object on top of it.
able to reference in the design-time editors.
appears there. Also expand the Application
Next, create a view object to retrieve Sources folder and the package nodes it
As an application
the department rows. In the Application contains until you see this workspace’s
grows, the number Navigator, right-click the oramag.deptflow
DataBindings.cpx file. Note that it is in the
of task flows and .model package node in the Model project
oramag.empflow.view package. When you and choose New View Object. When the create supplementary workspaces to produce
related business
Create View Object dialog box appears, com- task flows in a library, each workspace must
plete the following steps: use a unique default package name so that
components
1. Enter DeptView for the new view object’s the DataBindings.cpx file in that workspace’s
inevitably increases. name, leave the default Updatable access
ViewController project does not conflict through entity objects option selected, with any other DataBindings.cpx file used in
and click Next. the application. The EmpFlow workspace’s
Choose View -> Resource Palette to
display Oracle JDeveloper’s palette of reus-
2. Expand the oramag.model.entities
ViewController project uses the oramag
package in the Available list, select the .empflow.view default package name to avoid
able resources, which helps make quick work
Dept entity, click > to shuttle it into the clashing with the DataBindings.cpx file in the
of this task. To reference resources, such as
Selected list, and click Next. MainApp workspace’s ViewController project.
Oracle ADF libraries, on the file system, you
3. Click the >> Add All button to add all the To see the default package name setting,
add one or more entries called file system
attributes to the view object, and click double-click the ViewController project in
connections to the Resource Palette. A file
Finish to create the view object. the EmpFlow workspace to open the Project
system connection provides a nickname for
a directory on disk where reusable resources
Double-click the DeptModule application
Properties dialog box. On the Project Source
reside. Click the folder-with-a-plus-sign icon
module to open it in the editor. On the Data
Paths page, note the Default Package field
to the left of the Resource Palette’s search
Model page, select DeptView in the Available
View Objects list, enter Departments in space, the first step is to ensure that you
at the bottom. When you create a new work-
box, and choose New Connection -> File
the New View Instance field (below the have configured a unique default package
System from the menu. When the Create
Available View Objects list), and click > to name for both your Model project and your
File System Connection dialog box appears,
add a new view instance with this name to ViewController project. This way, when you
enter Libraries for Connection Name and
the data model. begin building components, the files will be
click Browse to choose a directory path. Find
the C:/FrameworksMayJun2010/Libs direc-
created in the correct, unique location.
tory, click it, and then click Select. Click Test
CREATING LIBRARIES AND CONFIGURING
Click Cancel to dismiss the dialog box. In
Connect to ensure that the directory path is
DEPENDENCIES
the sections that follow, you’ll complete the
Each project that will be part of a set of reus- deptflow task flow, deploy it in an Oracle ADF
correct. If it is, click OK.
able components should produce its own library, and then reuse the new task flow in
A new File System node appears in the
Oracle ADF library JAR, so now you’ll create the MainApp application.
Resource Palette. Expand it to reveal the
new Libraries connection, and expand that
a new Oracle ADF library deployment profile
to see the Entities.jar Oracle ADF library.
for the DeptFlow workspace’s Model project’s
USING A LIBRARY FROM THE
Expand this library node and the Business
components. In a subsequent step, you’ll
RESOURCE PALETTE
Components folder it contains, and then
also create an Oracle ADF library deployment
The deptflow task flow lives in the DeptFlow
profile for the ViewController project. workspace. Open this workspace in Oracle
select the Dept entity object in the oramag
.model.entities package. Click the Model
Start by double-clicking the Model project
JDeveloper by choosing File -> Open
to open the project properties editor. On from the main menu and selecting the
project in the Application Navigator to
ensure that it is the active project, and then
the Deployment page, click New to create a
MAY/JUNE 2010 ORACLE.COM/ORACLEMAGAZINE
ORACLE MAGAZINE MAY/JUNE 2010
new deployment profile. When the Create Deployment Profile dialog box appears, set Archive Type to ADF Library JAR File, enter DeptFlowModel in the Name field, and click OK. In the Edit ADF Library JAR Deployment Profile Properties dialog box that appears, on the JAR Options page, change the default path and filename to C:\FrameworksMayJun2010\Libs\ DeptFlowModel.jar . Click OK once to dismiss this dialog box and OK again to close the Project Properties dialog box.
To create the new library archive, right- click the Model project and choose Deploy -> DeptFlowModel. When the Deploy DeptFlowModel dialog box appears, click Finish to start the process. Click the Deployment tab in the Log window to see the results of the deployment operation. You should see something like “Wrote Archive Module to C:\FrameworksMayJun2010\ Libs\DeptFlowModel.jar” in the log. To refresh the list of libraries in the Resource Palette, right-click the Libraries file system connection node and choose Refresh. Note that the new DeptFlowModel.jar now appears in the list. The steps you just per- formed to create a new Oracle ADF library JAR deployment for the model components are the same as the steps completed ahead of time to create the reusable Entities.jar Oracle ADF library you used earlier.
By default, Oracle JDeveloper configures your ViewController project to depend on the compiled output of the Model project, so that pages can reference your model objects through the Oracle ADF model data-binding layer. When you produce an Oracle ADF library JAR for your model components, you must first add the model components library JAR to the ViewController project’s library list and then update the project’s dependency settings to use the new JAR instead of the compiled output. The first step is to click the ViewController project in the Application Navigator to make it the current project. Then, right-click the DeptFlowModel.jar node in the Resource Palette and choose Add to Project. When the confirmation dialog box appears, click Add Library to complete this task.
To update the project’s dependency set- tings, double-click the ViewController project to open the Project Properties dialog box and
then open the Dependencies page. Select the Model.jpr entry in the Dependent Projects and Archives list, and click the pencil icon to edit it. In the Edit Dependencies dialog box, note that the check box next to Build Output is checked. Click the check box next to the DeptFlowModel deployment profile. When you do this, an Adjusting Dependencies alert appears to let you know that the two check boxes are mutually exclusive; click OK. Now the DeptFlowModel deployment profile is checked as a dependency, and the original check box is cleared. Click OK to close the Dependencies page.
While you’re here, you can also create the Oracle ADF library deployment profile for the ViewController project. It will contain the task flows you will finish building shortly. On the Deployment page, click New. Select the ADF Library JAR File archive type, provide the name DeptFlow for the profile, and click OK. On the Edit ADF Library JAR Deployment Profile Options dialog box’s JAR Options page, change the default path and filename to C:\FrameworksMayJun2010\Libs\ DeptFlow.jar , click OK, and click OK again to close the Project Properties dialog box.
Next, you’ll finish building the pages in the deptflow task flow and then deploy the DeptFlow Oracle ADF library you just created. Expand the ViewController project and the Web Content folder inside it. Double-click the ListDepartments.jspx page name to open the page in the editor. Expand the Data Controls section of the Application Navigator, and expand DeptModuleDataControl. If you don’t see the Departments data collection, click the refresh icon in the Data Controls section title bar. Drag the Departments data collec- tion, and drop it onto the page below the two existing buttons. In the Create menu, choose Table -> ADF Read-only Table. When the Edit Table Columns dialog box appears, check the Row Selection and Sorting check boxes at the top and click OK. Now double-click EditDepartments.jspx to open it in the editor. Drag the Departments data collection, and drop it onto the page below the two existing buttons. In the Create menu, choose Form -> ADF Form. When the Edit Form Fields dialog box appears, accept the defaults and click OK. Finally, deploy the new DeptFlow Oracle ADF library containing the task flow. Right-
click the ViewController project, and choose Deploy -> DeptFlow. When the Deploy DeptFlow dialog box appears, click Finish. To verify that everything has gone as expected, select the Deployment tab of the Log window and scroll to the bottom. You should see a confirmation message like “Wrote Archive Module to C:\FrameworksMayJun2010\ Libs\DeptFlow.jar.” Right-click the Libraries file system connection in the Resource Palette and choose Refresh to update the list of available libraries.