First page Back Continue Last page Text

oracle adf workshop


Using View Objects with Polymorphic View Rows

In the previous example, the polymorphism occurs at the entity object level. Since client code works with all view rows that use the same PersonListVORow interface, it cannot distinguish between rows based on an EmployeeEO entity object from those based on a PersonEO entity object. The code works with all view rows, which use the same set of view row attributes and methods common to all types of underlying entity subtypes.

If you configure a view object to support polymorphic view rows, the client can work with different types of view rows by using a view row interface specific to the type of row it is. This way the client can access view attributes or invoke view row methods that are specific to a given subtype as needed. The slide illustrates the hierarchy of view objects that enables this feature for the PersonListVO example. EmployeeListVO and CustomerListVO are View Objects that extend the base PersonListVO VO. Notice that each one includes an additional attribute specific to the subtype of Person that they have as their entity usage. EmployeeListVO includes an additional Salary attribute, whereas CustomerListVO includes the additional CreditLimit attribute. When you configure a client for view row polymorphism, it can work with the results of the PersonListVO VO by using:

The PersonListVORow interface for view rows related to persons

The EmployeeListVORow interface for view rows related to employees

The CustomerListVORow interface for view rows related to customers