Sie sind auf Seite 1von 29

For this exercise, you'll be implementing a simple search and results page as shown in Figure 1 below.

Eventually, we'll add the ability to view, create and delete employees.
Figure 1: Search Page Exercise Finished Product

Task 1: Create Your Project


Step 1.1 Create an Oracle Applications (OA) Project
Task 2: Create Your Page's Model Components
In this task, you'll create the initial standards-compliant packages and objects that comprise the model
in your Employees Model-View-Controller (MVC) application.
Step 2.1 Create the BC4J Package for Client (UI) Objects
Create a new Business Components for Java (BC4J) package to contain your user interface (UI)
related application modules, view objects and view links.
Select the TutorialLabs.jpr project in the Navigator, right-click and select New Business
Components Package... from the context menu.
If the Welcome page appears in the Business Components Package Wizard, select Next.
Enter oracle.apps.ak.employee.server as the package name.
Verify that the radio button Entity Objects mapped to database schema objects is selected.
Select the Finish button to create the package.
Note: All the packages and names (classes, methods, and UI components) that you specify in the
ToolBox Tutorial exercises comply with the OA Framework File Standards. Furthermore, all code that you define or write in
the ToolBox Tutorial exercises complies with the following suite of standards and guidelines. Any production code that you
write after completing this tutorial must also comply with these standards.
Standard Description
Oracle Browser Look-and-Feel Oracle corporate UI design guidelines for browser-based
(BLAF) UI Guidelines applictions.
BLAF Internal Site
(internal access only)
OTN (Exernal Access
Link)

42
Oracle Java Coding Standards Oracle corporate Java coding standads.
(internal access only)
Oracle Applications Java Standars and guidelines applying to any Java code written in
Coding Standards the Oracle Applications division (supplemental to the Oracle
corporate standards).
OA Framework Model Coding OA Framework coding standards for model objects in an MVC
Standards application.
OA Framework View Coding OA Framework coding standards for the view (user interface) in
Standards an MVC application.
OA Framework Controller OA Framework coding standards for the (user interface)
Coding Standards controller in an MVC application.
Step 2.2 Create the BC4J Package for Server (Business Logic) Objects
Create a new BC4J package for entity objects, association objects, validation application modules and
validation view objects.
Select the TutorialLabs.jpr project in the Navigator, right-click and select New Business
Components Package... from the context menu.
If the Welcome page appears in the Business Components Package Wizard, select Next.
Enter oracle.apps.ak.schema.server as the package name.
Verify that the radio button Entity Objects mapped to database schema objects is selected (you
will not be able to create your entity object in this package if you fail to do this).
Select the Finish button to create the package.
Step 2.3 Create Your Root UI Application Module (AM)
Create a new Application Module (AM) to be used as the root UI application module for your page.
Select the oracle.apps.ak.employee.server BC4J package in the Navigator, right-click and
select New Application Module... from the context menu to open the Application Module (AM)
wizard.
If the Welcome page appears, select Next.
In the Name page, specify EmployeeAM as the AM name and verify that the Package is
oracle.apps.ak.employee.server.
Click the Next button until you get to Step 4 of 4.
In the Java page, select the Generate Java File(s) checkbox.
Select the Finish button to create the AM.
Step 2.5 Save Your Work
Save your work as shown in Figure 4. Using the menu option File > Save All will save your metadata
changes to an XML file and save all your other file changes (such as to a .jsp or .java file).
Tip: Though it will not be written out as a separate step from here on, you should save your work
43
frequently: at least at the end of each task.
Figure 4: File > Save All Option in JDeveloper Main Menu

Step 2.6 Create an Employee Entity Object (EO)


Create an entity object (EO) for the FWK_TBX_EMPLOYEES table in the OA Framework ToolBox
Tutorial schema as shown in Figure 5.
Figure 5: OA Framework ToolBox Tutorial Schema
44
Tip: Most of the BC4J wizards allow you to resize the wizard window, even though there may not be
visible resize controls. This is helpful for viewing long values and SQL statements.
Select the oracle.apps.ak.schema.server BC4J package in the Navigator, right-click and
select New Entity Object... from the context menu to open the Entity Object wizard.
If the Welcome page appears, select
Next. In the Name page:
Enter EmployeeEO in the Name field.
Verify that the Package is oracle.apps.ak.schema.server.
In the Schema Object field, enter FWK_TBX_EMPLOYEES. You must type this name
correctly. Otherwise, you can check the Synonyms check box (so both Tables and
Synonyms are checked) and choose the correct name from a very long list.
Select the Next button twice to navigate to the Attribute Settings page (note that all the table's
columns are automatically included as attributes, which complies with the OA Framework Model
Coding Standards for Entity Objects.
Verify that the EmployeeId attribute's Primary Key check box is selected. Do not change any
other default settings.
Select the Next button.
In the Java page, select the Generate Java File check box for the Entity Object Class:
EmployeeEOImpl (you will add business logic to this Java file in a later exercise).
In the Generate Methods region, check the Accessors, Create Method and Remove Method
check boxes.
Select the Next button.
In the Generate page, deselect the Generate Default View Object check box (or, verify that it is
not selected).
Select the Finish button to create your EO.
Step 2.7 Create an Employee-to-Manager Association (AO)

45
Create an employee-to-manager association (AO) for the self-join condition on the
FWK_TBX_EMPLOYEES table. Note that an employee must have a manager only if her assigned
POSITION_CODE != "PRESIDENT". An employee may have, at most, 1 manager. A manager can
have many employees.
Select the oracle.apps.ak.schema.server BC4J package in the Navigator, right-click and
select New Association...from the context menu to open the Association Object (AO) wizard.
If the Welcome page appears, select Next.
In the Name page, specify EmpToMgrAO as the association's name and verify that the
Package is oracle.apps.ak.schema.server.
Select the Next button.
Select * to 0...1 in the Cardinality poplist.
In the Select Source Attribute list, select the ManagerId attribute in your
oracle.apps.ak.schema.server.EmployeeEO.
In the Select Destination Attribute list, select the EmployeeId attribute in your
oracle.apps.ak.schema.server.EmployeeEO.
Select the Add button.
Select the Next button.
In the Association Attributes page, verify that the Expose Accessor check box is checked for
both the Source and the Destination.
Select the Finish button to create your association.
Step 2.8 Create an EmployeeSummaryVO View Object (VO)
Create a summary-level view object including only those attributes that you need for the Employees
search results table. This view object should leverage the EmployeeEO and EmpToMgrAO that you just
created (per the OA Framework Model Coding Standards for View Objects, all but the simplest view
objects for things like poplists, lists of values and so on should be based on entity objects).
Select the oracle.apps.ak.employee.server BC4J package in the Navigator, right-click and
select New View Object... from the context menu to open the View Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify EmployeeSummaryVO as the view object's name and verify that
the Package is oracle.apps.ak.employee.server.
Select the Next button.
In the Entity Objects page, select the EmployeeEO in the Available list and shuttle it to the
Selected list twice (once for the employee, and once for the employee's manager).
Verify that the Alias for the second instance of the EmployeeEO class is EmployeeEO1, and
that the Association End field is set to ManagerIdEmployeeEO.
Select the Next button.
In the Attributes page, select the following attributes from the Available list and shuttle them to
the Selected list:
From EmployeeEO:
EmployeeId
FullName
EmailAddress
From EmployeeEO1:
EmployeeId (JDeveloper assigns this attribute the default name of EmployeeId1)
FullName (JDeveloper assigns this attribute the default name of FullName1)
EmailAddress (JDeveloper assigns this attribute the default name of
EmailAddress1)
Select the Next button.
In the Attribute Settings page, select the FullName attribute using the Select Attribute poplist,
set the Attribute Name field to be EmployeeName, and change the Query Column Alias field to
be EMPLOYEE_NAME.
46
Now select the EmployeeId1 attribute in the Select Attribute poplist, set the Attribute Name field
to be ManagerId, and change the Query Column Alias field to be MANAGER_ID.
Now select the EmailAddress attribute, set the Attribute Name field to be EmployeeEmail, and
change the Query Column Alias field to be EMPLOYEE_EMAIL.
Now select the FullName1 attribute, set the Attribute Name field to be ManagerName, and
change the Query Column Alias field to be MANAGER_NAME.
Now select the EmailAddress1 attribute, set the Attribute Name field to be ManagerEmail, and
change the Query Column Alias field to be MANAGER_EMAIL.
Select the Next button.
At this point the query should look like the following in the Query page (without the
formatting we've used here to improve readability):
SELECT EmployeeEO.EMPLOYEE_ID,
EmployeeEO.FULL_NAME AS EMPLOYEE_NAME,
EmployeeEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
EmployeeEO1.EMPLOYEE_ID AS MANAGER_ID,
EmployeeEO1.FULL_NAME AS MANAGER_NAME,
EmployeeEO1.EMAIL_ADDRESS AS MANAGER_EMAIL
FROM FWK_TBX_EMPLOYEES EmployeeEO,
FWK_TBX_EMPLOYEES EmployeeEO1
WHERE EmployeeEO.MANAGER_ID = EmployeeEO1.EMPLOYEE_ID
Select the Expert Mode checkbox. This allows you to edit the generated query.
In the Query Statement text box modify the query so it looks like the following. Note that you
must add the outer join (+) operator to the MANAGER_ID / EMPLOYEE_ID join (as of OA
Extension 9.0.3.8.1/OA Framework 11.5.10C, this is not automatically derived from the
association), and you must join to the FWK_TBX_LOOKUP_CODES_VL view to obtain the
display name for the employee's assigned position.
When you are finished with your editing, select the Test button to ensure your syntax is correct.
SELECT EmployeeEO.EMPLOYEE_ID,
EmployeeEO.FULL_NAME AS EMPLOYEE_NAME,
EmployeeEO.EMAIL_ADDRESS AS EMPLOYEE_EMAIL,
EmployeeEO1.EMPLOYEE_ID AS MANAGER_ID,
EmployeeEO1.FULL_NAME AS MANAGER_NAME,
EmployeeEO1.EMAIL_ADDRESS AS MANAGER_EMAIL,
flkp.meaning AS POSITION_DISPLAY
FROM FWK_TBX_EMPLOYEES EmployeeEO,
FWK_TBX_EMPLOYEES EmployeeEO1,
FWK_TBX_LOOKUP_CODES_VL flkp
WHERE EmployeeEO.MANAGER_ID = EmployeeEO1.EMPLOYEE_ID
(+) and EmployeeEO.POSITION_CODE = flkp.lookup_code
and flkp.lookup_type = 'FWK_TBX_POSITIONS'
Select the Next button.
In the Attribute Mappings page, verify that your view object attributes map to the correct query
columns. If you need to make any changes, place your cursor into the incorrect View Attributes
field and select the correct value from the poplist.
Select the Next button.
In the Java page, deselect the Generate Java File for View Object Class:
EmployeeSummaryVOImpl (you don't need to add any code to this view object). Do select the
Generate Java File for View Row Class: EmployeeNamesVORowImpl to comply with OA
Framework coding standards.
Select the Finish button to create your VO.
Now verify that your VO attribute settings match the aliases in your SQL query: Select
the EmployeeSummaryVO in the Navigator, right-click and select Edit
EmployeeSummaryVO... from the context menu to open the View Object wizard.
47
Navigate to the Attributes section for your attributes and verify that any aliases in your query
are shown correctly. Make any necessary changes and select Apply.
Navigate to the Attribute Mappings page and verify that all the mappings are correct. Make
any necessary changes and select Apply.
Select the OK button to finish editing your VO.
Step 2.9 Add Your View Object to the Root UI Application Module
View objects can be used only within the context of a containing application module. Before you can use the
EmployeeSummaryVO in your page, you must add it to the page's root UI Application Module.
Select the EmployeeAM in the Navigator pane, right-click and select Edit EmployeeAM... from
the context menu to open the Application Module wizard.
Navigate to the Data Model page.
Select the EmployeeSummaryVO view object in the Available View Objects list and shuttle it to
the Data Model list.
Tip: Take careful note of the default View Instance name that BC4J creates when you add your
VO to the selected AM (BC4J creates this name by appending a "1" to your VO name). Leave
it or change it, your choice (we suggest leaving the default value as is). In either case, know
what the value is before creating your Results table region in the next task.
Select the OK button to finish adding your VO to your root AM.

Task 3: Create Your Initial Page


For this step, you will build and run a page with just the Employees < your name > page title and the
instruction text as shown in Figure 6 below:
Figure 6: Task 3 Finished Product

Step 3.1 Create the EmpSearchPG Page


Create a new UI page in the oracle.apps.ak.employee.webui package.
Select the TutorialLabs.jpr project in the Navigator, right-click and select "New..." from the
context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Page in the OA Components Items list.
Select the OK button to continue.
In the New Page dialog, enter EmpSearchPG in the Name field and
oracle.apps.ak.employee.webui in the Package field.
Warning: You MUST use this name and package or your page will not run properly. In fact, if
any package, Java file, region name, item name, etc. is specified in the exercise instructions,
you must match it exactly in your work.
Select the OK button to create your page.
Step 3.2 Modify the pageLayout Region
Select your EmpSearchPG in the Structure pane and select the region1 that
JDeveloper created for you.
Verify and set (if necessary) the following properties:
Property Value
ID PageLayoutRN

48
Region Style pageLayout
AM Definition oracle.apps.ak.employee.server.EmployeeAM
Window Title Framework ToolBox Tutorial: Labs <your name>
Title Employees <your name>
AutoFooter True
(This ensures that the standard footer, including the Oracle copyright and privacy notice,
render in the page).
Tip: For the purposes of these Toolbox tutorial exercises (only), it is a good idea to include your name
or some other identifying information in the window title and titles (page headers) for all your pages.
Later in the exercises, when you are creating links or destinations that use function names, these
names in the headers will help you know if you have gone to your own page or a page in the Toolbox
lab solution files (the names and functions are very similar).
Tip: You can set the Property Inspector to list the properties by category or in alphabetical order. To
change between category and alphabetical sorting, select the Categories button in toolbar at the top of
the Property Inspector as shown in Figure 7.
Figure 7: Categorized JDeveloper Property Inspector

Step 3.5 Test Your Work


Select your page in either the Structure pane or the Navigator window, right-click and choose
Run < file name > from the context menu.
Your results should appear as shown in Figure 6 above.
Task 4: Configure a Results-Based Search
In this section, you'll create a simple "results-based" search by leveraging the OA Framework query
region. You'll see how to enable the user-personalizable Views panel, the Simple Search panel, and
the Advanced Search panel without explicitly creating the UIs for these regions. In the next task, you
will change from a "results-based" search to an "auto customization criteria" search so you can take
a bit more control of the UI that displays in the Search region.
Tip: See the Search topic in Chapter 4 of the OA Framework Developer's Guide for additional
information about implementing searching in your pages. This is a broad topic, and we're just
scratching the surface of what you can do in this lab.
The finished region should appear as shown in Figure 8 below when you've completed all the steps in
this task.
Figure 8: Task 4 Finished Product
50
Step 4.1 Add a Query Bean to Your Page
Add the query bean region to your page.
Select the PageLayoutRN in the Structure pane, right-click and select New > Region from
the context menu.
Select the new region (region1), and set/verify its properties as follows:
Property Value
ID QueryRN
Region Style query
Construction Mode resultsBasedSearch
Include Simple Panel True
Include Views Panel True
Include Advanced True
Panel
Step 4.2 Add a Results Data Table to Your QueryRN
Select the QueryRN in the Structure pane, right-click and select New > Region Using Wizard
from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your EmployeeAM
(oracle.apps.ak.employee.server.EmployeeAM), and then select your
EmployeeSummaryVO1 view object instance from the Available View Objects list.
DO NOT select the Use this as Application Module Definition for this region checkbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to ResultsTable and set the
Region Style to table.
Select the Next button.
In the View Attributes page, select the following attributes from the Available View Attributes list
and shuttle them to the Selected View Attributes list:

51
EmployeeId
EmployeeName
PositionDisplay
ManagerName
Select the Next button.
In the Region Items page, set the ID, Style, and Attribute Set properties as follows (note that the
Prompt value is set for you as soon as you apply the Attribute Set, so do the attribute sets first
and then verify that the prompts are correct):
ID Prompt Style Data Type Attribute Set *
EmpNum Number messageStyledText NUMBER /< base path
>/EmployeeId_Number
EmpName Name messageStyledText VARCHAR2 /< base path >/FullName
Position Position messageStyledText VARCHAR2 /< base path >/Position
ManagerNa Manager messageStyledText VARCHAR2 /< base path
me >/FullName_Manager
* Please replace the < base path > variable in the table above with the following text:
oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees. When you do this, be VERY
careful with the slashes. For example, if we had room in the table to be explicit, the first attribute set
would be:
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId_Number
Tip: You can use the Search capability to help find your attribute sets. Type
/oracle/apps/fnd/framework/toolbox/attributesets/ (or a shorter path such as
/oracle/apps/fnd/framework) into the Package field in the Search window, select Search in: Entire
MDS XML Path, then select the Search button (not the Browse button).
Tip: Remember, you can always change the table and item properties using the Property Inspector
after you leave the wizard.
Click the Finish button to create your data table.
Step 4.3 Set or Verify Your ResultsTable Region Properties
Select the ResultsTable region in the Structure pane, and set/verify the following properties:
Property Value
ID ResultsTable
Region Style table
AM Definition Make absolutely sure that you have not inadvertently associated an
application module here. If you have, please delete it.
Rendered True
Records 10
Displayed
Width 100%
Step 4.4 Set or Verify EmpNum Item Properties
Configure this item to support sorting in the table, to be included in the "results-based" search region
that the OA Framework automatically creates, and to be a selectively required search value (for
performance reasons, blind queries are disallowed in Oracle Applications unless the underlying view
object has been tuned to include a performant query so no additional search criteria is required).
For the EmpNum item:
Set the Search Allowed property to True to enable sorting on this table column.
Set the Sort Allowed property to ascending
Set the Initial Sort Sequence property to first.
Set the Selective Search Criteria property to True.

52
Tip: For more information on the Sort Allowed and Initial Sort Sequence properties, refer to the
Developer's Guide topic on Tables > Sorting.
Tip: For more information on the Search Allowed and Selective Search Criteria properties, refer to the
Developer's Guide topics on Search > Declarative Implementation: Results Based Search and
Search > Declarative Implementation: Auto Customization Criteria.
Step 4.4 Set or Verify EmpName Item Properties
For the EmpName item:
Set the Search Allowed property to True.
Set the Selective Search Criteria property to True.
Step 4.5 Set or Verify Position Item Properties
For the Position item:
Set the Search Allowed property to True.
Step 4.6 Set or Verify Manager Item Properties
For the Manager item:
Set the Search Allowed property to True.
Set the Destination URI property to mailto:{@ManagerEmail}.
Step 4.7 Test Your Work
Test your work. Your results should appear as shown in Figure 8 above. Try selecting the Advanced
Search button, and the Save Search button after executing a query. Also try selecting the Go button
without specifying any search criteria.
Note that you don't have to implement the query; the OA Framework implements this for you
automatically based on the table items that you identified with the Search Allowed property.
Furthermore, the OA Framework creates a Search UI based on the data and item types of the Search
Allowed items.

Task 5: Convert Your Search Region to Use Auto Customization


Criteria
Because we want to add an LOV with our search region, we cannot just use the simple "results-based"
search because it generates search items automatically based on the columns in your results table. So,
we need to convert our query bean to run in "auto customization criteria mode" (that is, we want to
customize our search criteria by adding an LOV). The finished region should appear as shown in
Figure 9 below.
Figure 9: Task 5 Finished Product

Step 5.1 Change the Query Bean to Use autoCustomizationCriteria


Select the QueryRN in the Structure pane.
53
Change its Construction Mode property to autoCustomizationCriteria.
Change its Include Views Panel property to False.
Change its Include Advanced Panel property to False.
Step 5.2 Add a Simple Search Region
Select the QueryRN in the Structure pane, right-click and choose New > simpleSearchPanel
from the context menu.
Select the default region created under the simpleSearchPanel folder (region1) and set its
properties to the following:
Property Value
ID CustomSimpleSearch
Region Style defaultSingleColumn
Text Search
Step 5.3 Create an Employee Name Search Item
Select CustomSimpleSearch region in the Structure pane, right-click and select New > Item
from the context menu.
Select this item, and set or verify its properties as follows (note that some properties are set
by the attribute set, so you should specify this first):
Property Value
ID SearchEmpName
Item Style messageTextInput (you will change this to an LOV field
a bit later)
Attribute Set /oracle/apps/fnd/framework/toolbox/attributesets/FwkTbx
Employees/FullName
Selective Search Criteria True
Data Type VARCHAR2
Maximum Length 240
Prompt Employee Name
CSS Class OraFieldText
Length 40
Step 5.4 Create an Employee Number Search Item
Select the CustomSimpleSearch region in the Structure pane, right-click and select New >
Item from the context menu.
Select this item, and change or verify its properties as follows:
Property Value
ID SearchEmpNum
Item Style messageTextInput
Attribute Set /oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployee
s/EmployeeId
Selective True
Search
Criteria
Data Type NUMBER
Maximum 15
Length
Prompt Employee Number
CSS Class OraFieldText

54
Length 15
Step 5.5 Create Search Mappings Between Your Name / Number Items and the
ResultsTable
The OA Framework uses the mappings that you define between your custom search items and
columns in the ResultsTable to automatically handle the query when the user selects the Go button.
Select the query bean or the query Components folder in the Structure pane, right-click and
choose New > simpleSearchMappings from the context menu.
Select the default mapping created under the simpleSearchMappings and set its properties to
the following:
Property Value
ID EmpNameMap
Search Item SearchEmpName
Results Item EmpName
Select the simpleSearchMappings folder in the Structure pane, right-click and choose New
> queryCriteriaMap from the context menu.
Select the new mapping and set its properties as follows:
Property Value
ID EmpNumMap
Search Item SearchEmpNum
Results Item EmpNum
Step 5.6 Test Your Work
Test your work. Your results should appear as shown in Figure 9 above. Notice how this differs from
the results-based search you tested earlier.

Task 6: Add a List of Values (LOV) to Your Employee Name Field


In this section, you'll create a reusable list of values (LOV) that you will then configure for use in the
Search page (you'll use this same LOV later in the Create page). The finished LOV should appear as
shown in Figure 10.
Figure 10: Task 6 Finished Product
55
Step 6.1 Create the BC4J Package for Your LOV-Related Model Objects
All LOV view objects should be created in a common product package.
Select the TutorialLabs.jpr project in the Navigator, right-click and select New Business
Components Package...to open the Business Components Package Wizard.
If the Welcome page appears, select the Next button.
In the Package Name page, enter oracle.apps.ak.lov.server.
Verify that the radio button Entity Objects mapped to database schema objects is selected.
Click the Finish button to create the LOV BC4J package.
Step 6.2 Create a Common LOV Application Module
Related LOV view objects should be grouped into a common application module. For example, any
LOV view objects that you create for the Employees application should be included in one application
module.
Select the oracle.apps.ak.lov.server BC4J package in the Navigator, right-click and select
New Application Module... from the context menu to open the Application Module (AM) wizard.
If the Welcome page appears, select Next.
In the Name page, specify LabsLovAM as the AM name and verify that the Package is
oracle.apps.ak.lov.server.
Click the Next button until you get to Step 4 of 4.
In the Java page, deselect the Generate Java File(s) checkbox (you won't be adding any
code to this application module).
Select the Finish button to create the AM.
Step 6.3 Create the LOV View Object
Select the oracle.apps.ak.lov.server package in the Navigator, right-click and select "New
View Object..." from the context menu to open the View Object wizard.
If the Welcome page appears, select Next.
In the Name page, specify EmployeeNamesVO as the view object name and verify that the
Package is oracle.apps.ak.lov.server.
Select the Next button until you get to the Query page.
In the Query page, enter the following query into the Query Statement text field (note that this LOV
is querying "active" employees, and for the sake of simplicity, the business rule assumes that the
presence of any end_date -- regardless of what this date is relative to sysdate -- indicates that the
employee is inactive). Select the Test button to ensure your syntax is correct.
SELECT full_name AS EMPLOYEE_NAME,
employee_id AS EMPLOYEE_NUMBER,
email_address
FROM fwk_tbx_employees
WHERE end_date is null
Select the Next button until you get to the Java page.
In the Java page, deselect the Generate Java File for View Object Class:
EmployeeNamesVOImpl (you don't need to add any code to this view object). Do select the
Generate Java File for View Row Class: EmployeeNamesVORowImpl to comply with OA
Framework coding standards.
Select the Finish button to create your VO.
Step 6.4 Add the EmployeeNamesVO to the LabsLOVAM
View objects can be used only within the context of a containing application module. Before you can
use the EmployeeNamesVO in your LOV, you must add it to the LOV application module.
Select the LabsLovAM in the Navigator pane, right-click and select Edit LabsLovAM...
from the context menu to open the Application Module wizard.
Navigate to the Data Model page.
56
Select the EmployeeNamesVO view object in the Available View Objects list and shuttle it to
the Data Model list.
Select the OK button to finish adding this VO to the AM.
Step 6.5 Create the Shared EmployeesLovRN LOV Region
Since the Employee Names LOV can be used in many different pages, it must be created as a
shared, standalone region.
Select the TutorialLabs.jpr project in the Navigator, right-click and select New... from the
context menu.
In the New window, expand the Web Tier hierarchy and select OA Components.
Select Region in the OA Components Items list.
Select the OK button to continue.
In the New Region dialog, specify the following values:
In the Name field enter EmployeesLovRN.
In the Package field enter oracle.apps.ak.lov.webui.
In the Style field select listOfValues.
Click the OK button to create your region.
Select the EmployeesLovRN in the Structure pane, set the AM Definition property to
oracle.apps.ak.lov.server.LabsLovAM and set the Scope property to Public.
Step 6.6 Add a Table to Your LOV
Select the EmployeeLovRN in the Structure pane, right-click and select New > table Using
Wizard from the context menu.
If the Welcome page appears, select Next.
In the BC4J Objects page, select your LabsLovAM (oracle.apps.ak.lov.server.LabsLovAM),
and then select your EmployeeNamesVO1 view object instance from the Available View
Objects list.
DO NOT select the Use this as Application Module Definition for this region checkbox.
Select the Next button.
In the Region Properties page, set the Region ID field value to EmpNamesTable and set the
Region Style to table.
Select the Next button.
In the View Attributes page, add all the attributes in the EmployeeNamesVO1.
Select the Next button.
In the Region Items page, set the ID, Style, and Attribute Set properties as follows (note that the
Prompt value is set for you as soon as you apply the Attribute Set, so do the attribute sets
before the prompts and then verify that the prompts are correct).
ID Prompt Style Data Type Attribute Set *
EmpName Employee messageStyledText VARCHAR2 /< base path >/FullName
Name
EmpNum Number messageStyledText NUMBER /< base path
>/EmployeeId_Number
EmailAddress Email messageStyledText VARCHAR2 /< base path >/EmailAddress
Address
* Please replace the < base path > variable in the table above with the following text:
oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees. When you do this, be VERY
careful with the slashes. For example, if we had room in the table to be explicit, the first attribute set
would be:
/oracle/apps/fnd/framework/toolbox/attributesets/FwkTbxEmployees/EmployeeId_Number
Click the Finish button to create your data table.
Select the EmpName and EmpNum item in the Structure pane, and set their Search Allowed
57
properties to True.
Step 6.7 Make the Employee Name Item an LOV
When you first created the Employee Name item, you set its style to messageTextInput (a standard text
entry field). Now, you need to configure it to include an LOV.
Select the SearchEmpName item in the CustomSimpleSearch panel.
Change its Item Style property to messageLovInput.
When you set the Item Style property to messageLovInput, JDeveloper automatically creates
an inline LOV region (region style listOfValues) and a default LOV mapping.
Set the External List of Values property to /oracle/apps/ak/lov/webui/EmployeesLovRN.
Change its Disable Validation property to True. Note: Per the OA Framework View Coding
Standards, validation should always be enabled on an LOV field unless the user should be able
to enter partial values as is often the case in a search crtieria field.
Note: When you change this property, JDeveloper displays a confirmation message indicating
that children of your base field, such as the inline LOV region, will be removed by the
change. Confirm the change (select the OK button). Once you confirm, the inline LOV region
is removed and the new external LOV region appears in the hierarchy (grayed out because it
cannot be edited directly in your page).
Step 6.8 Define LOV Mappings
Create mappings between base page items and LOV items. The mappings identify the data
input/output relationships between base page items and LOV items.
Select the default LOV mapping, ID'ed as lovMap1, and set the following properties:
Change the LOV Region Item property by selecting EmpName field from the poplist.
Change the Return Item property by selecting SearchEmpName field from the poplist.
Change the Criteria Item property by selecting SearchEmpName field from the poplist.
Right-click lovMappings in the Structure panel, and select New > lovMap from the context
menu.
Select the default LOV mapping, ID'ed as lovMap2, and set the following properties:
Change the LOV Region Item property by selecting EmpNum field from the poplist.
Change the Return Item property by selecting SearchEmpNum field from the poplist.
Step 6.9 Test Your Work
Test your work. Your base page (the Employees search page) should appear as shown in Figure 1
above. When you select the list of values icon, your LOV window should appear as shown in Figure
10 above.
Warning: You cannot run and test the LOV page directly. You must run your base page, and then
select the list of values icon to invoke the LOV.
Congratulations! You are now finished with this exercise.
Copyright © 2003, Oracle. All rights reserved.