Adding a View Link Instance with a New View Object Attribute-Based Definition at Runtime

If you have two view object instances in your data model, you can place the view object instances into a master-detail relationship at runtime by using createViewLinkBetweenViewObjects().

Note: This is the most flexible, but the most complex, way to create view link instances dynamically. If you have a view link definition or association that might be appropriate, we recommend that you use another method. For more information, see the related topics list.

To add a view link instance with a new view object attribute-based definition at runtime:

  1. Create a String containing the name you want to give the view link instance in the data model. For example, if this instance is to be called CustOrdLink1, you would use the following code:

    String vlInstanceName = "CustOrdLink1";

  2. Find the attribute definitions for the source and destination attributes.
  3. Create an array containing the source attributes, and another array containing the corresponding destination attributes.
  4. Create a String containing the accessor name for the detail view object instance, which can be used to traverse view links. For more information, see the related topics list. For example, the following is acceptable:

    String accessorName = "Orders";

  5. Create a String containing the parametrized WHERE clause for the view link (for more information, see the related topics list). If you want to use Oracle ADF Business Components' default SQL, you can assign a value of null to the String. For example, either of the following would be acceptable:
    String whereClause = null;
    
    String whereClause = ":1 = Orders.ORDER_ID";                

    Note: The rules for custom WHERE clauses are the same as when you create them during design time. See the related topics list for details.

  6. Pass the Strings, view object instances, and arrays of attribute definitions into createViewLinkBetweenViewObjects():
    ViewLink vl = myAM.createViewLinkBetweenViewObjects(
    
      vlInstanceName, accessorName,
    
      allCustVO, masterAttributeArray, custOrdVO, detailAttributeArray,
    
      whereClause);                

Ways to Change View Object Relationships at Runtime
Adding a View Link Instance Based on a Predefined View Link at Runtime
Adding a View Link Instance with a New Association-Based Definition at Runtime
Removing a View Link Instance at Runtime
About Oracle ADF View Links
About View Objects
About Application Modules
About View Object and View Link Instances
Finding View Object Instances in the Data Model
Traversing View Links
Changing View Link SQL

 

 

Copyright © 1997, 2004, Oracle. All rights reserved.