Skip Headers
Oracle® Application Development Framework Developer's Guide For Forms/4GL Developers
10g (10.1.3.1.0)

Part Number B25947-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Master Index
Master Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

7.4 Creating an Association-Based View Link

Just as with read-only view objects, you can link entity-based view objects to other view objects to form master/detail hierarchies of any complexity. The only difference in the creation steps involves the case when both the master and detail view objects are entity-based view objects and their respective entity usages are related by an association. In this situation, since the association captures the set of source and destination attribute pairs that relate them, you can create the view link just by indicating which association it should be based on.

7.4.1 How to Create an Association-Based View Link

To create an association-based view link, you use the Create View Link wizard.

To create an association-based view link

  1. From the New Gallery in the Business Tier > ADF Business Components category, select the Create View Link wizard.

  2. In step 1 on the Name page, supply a package and a component name. Assume you want to create the view link in the devguide.model.queries.viewlinks package and call it RequestsAssignedToTechnician.

  3. In step 2 on the View Objects page, in the Select Source Attribute tree expand the source StaffList view object in the devguide.model.queries package. In the Select Destination Attribute tree expand the ServiceRequests view object. Notice that in addition to the view object attributes, for entity-based view objects relevant associations also appear in the list. As shown in Figure 7-12, select the same ServiceRequestsAssignedToUser association in both Source and Destination trees, then click Add to add the association to the table below. Click Next and Finish to complete creating the new view link.

    Figure 7-12 Selecting an Association Relating the Source View Object's Entity Usage to the Destination's

    Step 2 of the View Objects wizard
  4. Next, create another association-based view link between the ServiceRequests view object and a view object that displays the detail information about the service request's history entries. You already have the master ServiceRequests view object, but you need to first create a view object for the detail before you can link them. Using the shortcut you learned above, in the Application Navigator select the ServiceHistory entity object in the devguide.model.entities package and choose New Default View Object... from the context menu to create a view object named ServiceHistories in the devguide.model.queries based on this entity.


    Note:

    In the Create Default View Object you can use the combobox to select devguide.model.queries from the list of existing packages.

  5. Finally, repeat the steps used above to create an association-based view link between the ServiceRequests view object and the new ServiceHistories view object based on the association that relates their respective primary entity usages. Name the view link HistoryLinesForRequest in the devguide.model.queries.viewlinks package. As an additional shortcut, to avoid having to type in the package name, as shown in Figure 7-13 you can use the New View Link... on the context menu of the viewlinks package node in the Application Navigator.

    Figure 7-13 Shortcut for Creating a View Link in an Existing Package

    Image shows context menus in Application Navigator

7.4.2 What Happens When You Create an Association-Based View Link

When you create an association-based view link, JDeveloper creates the XML component definition file that represents its declarative settings and saves it in the directory that corresponds to the name of its package. In the example above, the view links were named RequestsAssignedToTechnician and HistoryLinesForRequest in the devguide.model.queries.viewlinks package, so the XML files created will be /RequestsAssignedToTechnician.xml and /HistoryLinesForRequest.xml in the ./devguide/model/queries/viewlinks directory under the project's source path. This XML file contains the declarative information about the association that relates the source and target view objects you've specified. In addition to saving the view link component definitions themselves, JDeveloper also updates the XML definition of the source view objects in the view link relationships to add information about the view link accessor attribute.