WSDEPARTMENTS as the schema
object name.
4. In step 2 of 6, click the New button
(repeatedly) to open a New Entity
Attribute properties page and create the
four entity attributes detailed in Table 1.
When you have finished creating all four
attributes, click Next.
5. Click Next to skip the wizard step 3 of 6.
In the wizard step 4 of 6
•;Check the Generate Entity Object Class
checkbox.
•;Click the Classes Extend button to
launch the Override Base Classes
dialog box.
6. In the Override Base Classes dialog box,
click the Browse button next to the Row
field. The Find Superclass search dialog
box appears.
7. Type WsEntity in the Match Class or
Package Name field. When the WsEntity
( oramag.sample.application.model
.fmwExtensions) package appears in
the dialog box, click it and then click OK
to save the change. Click OK again to
dismiss the dialog box and redisplay the
wizard step 4 of 6.
8. Click Finish to conclude the wizard.
Oracle JDeveloper generates a custom
entity class, WsDepartmentsImpl, based
on the template, and places its metadata
file on the XML edit pane. Now you override
the abstract methods of the WsEntity template class in WsDepartmentsImpl to make
Business Components write data updates to
the Web service.
9. In the WsDepartments.xml editor,
select the Java menu option and the
link next to the Entity Object Class label
to open the entity implementation
class, WsDepartmentsImpl, in the
Java code editor.
10. In the Java code editor, right-click
anywhere in the file and choose
Source -> Override Methods from the
context menu.
11. In the Override Methods dialog box,
check the Group By Class checkbox and
then locate WsEntity (and its methods)
in the list.
Select the doDML and doSelect methods
under the WsEntity class. Also check the
Copy Javadoc checkbox (at the bottom of the
dialog box), so that the override instructions
from the template populate the file.
12. Click OK.
Oracle JDeveloper generates a Java class
containing method signatures and comments instructing you how to access the
JavaBean wrapper class in the AdfBcModel
project from this class. To simplify your tasks
for this example integration, I’ve provided
the complete code for you.
13. Open the entity-code-complete.txt file,
located in the entities package, and
copy and paste the file’s contents over
WsDepartmentsImpl.java, replacing the
entire generated content.
14. Close all tabs in Oracle JDeveloper, and
save all your work.
You now have a programmatic entity
object that can be used as the basis for the
view object that will access the Web service.
The next step is to create the programmatic
view object.
BUILDING THE PROGRAMMATIC
VIEW OBJEC T
When using programmatic view objects, you
must override the Business Components
framework methods that query the database
for data. The view object methods you will
typically need to override include create,
executeQueryForCollection, createRowFromResultSet, getQueryHitCount, and hasNext-ForCollection. (See “Key Framework Methods
to Override for Programmatic View Objects” in
Oracle Application Development Framework
Developer’s Guide For Forms/4GL Developers
to learn more.) For this sample integration,
the template provides much of the code, so
you won’t be selecting all these methods.
Table 1: Attribute definitions for the custom entity object
Name Type Other property to set
DepartmentId BigDecimal Check Primary Key checkbox
DepartmentName String Set Database Column Type to VARCHAR2( 30)
ManagerId BigDecimal None
LocationId BigDecimal None
As with the programmatic entity object
creation, a wizard guides you through the
process. These steps begin in the
OraMag-AdfBc WsApp application in the
Application Navigator:
1. Expand the AdfBcModel -> Application
Sources node until the oramag.sample
. application.model.views node appears.
2. Right-click the oramag.sample
. application.model.views package node
and select New View Object from the
context menu. The Create View Object
wizard launches. On the Name page
(Create View Object – Step 1 of 9)
•;Enter WsDepartmentsView in the entity
Name field.
•;Keep the Data Source option set to
Entity object.
3. Click Next to continue. On the Entity
Objects page (step 2 of 9)
•;Expand the oramag.sample.application
.model.entities package, and select the
WsDepartments entity object.
•;Click the right arrow to move
WsDepartments to the Selected pane.
Click Next.
4. Click the double-arrow to move all
Available attributes to the Selected pane.
5. Click Next until the wizard step 7 of 9
appears. Set the Java properties for
the view object as follows: check the
Generate View Object Class checkbox
(causes the wizard to create a custom
view object implementation class whose
default framework methods you can
override). Under this checkbox
•;Uncheck the Include bind variable
accessor checkbox (the sample application does not use bind variables).
•;Uncheck the Include custom data
source methods checkbox. (In other
applications, you might use this feature
to generate signatures for the methods
to be overridden, but this sample application provides you with a template
class for this task).
•;Click the Classes Extend button. In
the Override Base Classes dialog box,
click the Browse button (next to the
Object field) to open the Search dialog
box. In the Search dialog box, type
WsViewObject in the Match Class or
Package Name field. When the package