# Substituting Extended View Links

Substituting an extended View Link allows any changes made to the original View Link, such as code added to the View Link's XML file or new source and destination objects, to be made available to all of its instances in the rest of the application. If you substitute the extended View Link, then you must ensure that the extended View Objects it connects (and the extended Entity Objects they reference) are also substituted. This is because the extended View Objects will typically have new attributes that do not exist in the originals. Also, the View Link might use these new attributes in its definition of the source and destination role attributes, and in the View Link query's WHERE clause.

Figure 1: Substituting an Extended View Link

As Figure 1 illustrates, assume that when you extended the `Emp` Entity, you added a `Loc` (location) attribute. This attribute will be added to the query when you create the extended View Object `NewEmpViewEx`. `Loc` is already an attribute of `DeptView`, and will automatically be included in the query of the extended View Object `NewDeptViewEx`. Then when you create the extended View Link between `NewEmpViewEx` and `NewDeptViewEx` you can add `Loc` to the lists of source and destination role attributes, and also to the `WHERE` clause of the View Link query. If you then substitute the extended View Link into the application, you must also substitute `NewEmpEx` and `NewEmpViewEx` (because `Emp` and `EmpView` do not have a `Loc` attribute) and `NewDeptEx` and `NewDeptViewEx` (because `Dept` does not recognize `Loc` as a source role attribute).

## Using JDeveloper to Substitute Extended View Links

Use the Substitutions panel of the Business Components Project wizard to substitute the extended View Links throughout your application. For the procedure to substitute a View Link, see To Substitute Business Components. The framework makes an addition to the `Substitutes` section of the project's `.jpx` file which identifies the name of the original View Link and the name of the extended View Link that should be used instead.

For example, if you use the Substitutions panel of the Business Components Project wizard to substitute the extended View Link `NewFKLinkEx` for the original View Link `EmpForeignKeyLink` throughout your application, the framework adds a line to the `Substitutes` section of the project's XML file. A portion of the project's XML file is included below:

      <Substitutes>
      <Substitute OldName ="package27.DeptView" NewName ="Extender.NewDeptViewEx" />
      <Substitute OldName ="package27.EmpView" NewName ="Extender.NewEmpViewEx" />
      <Substitute OldName ="package27.Emp" NewName ="Extender.newEmp" />
      <Substitute OldName ="package27.EmpForeignKeyAssoc" NewName ="Extender.NewFKAssocEx" />
      <Substitute OldName ="package27.Dept" NewName ="Extender.NewDeptEx" />
      <Substitute OldName ="package27.EmpForeignKeyLink" NewName ="Extender.NewFKLinkEx" />
      </Substitutes>

Note that is is assumed that you have already substituted the extended Entity Objects `NewEmpEx` and `NewDeptEx` for the original Entities `Emp` and `Dept`, and the extended View Objects `NewEmpViewEx` and `NewDeptViewEx` for the original Views `EmpView` and `DeptView` in the project file.

Note also that extending and substituting the Association between the extended Entity Objects is optional and has no effect on the extended View Link between the Views.