Traversing Links (continued)
At run time, the getAttribute() method on a Row enables you to access by name the value of any attribute of a row in the view object’s result set. The view link accessor behaves like an additional attribute in the current row of the source view object, so you can use the same getAttribute() method to retrieve its value. The only practical difference between a regular view attribute and a view link accessor attribute is its data type. Whereas a regular view attribute typically has a scalar data type with a value such as 303 or ahunold, the value of a view link accessor attribute is a row set of zero or more correlated detail rows. Assuming that curOrder is a Row from some instance of the Orders view object, you can write a line of code to retrieve the detail row set of order items:
RowSet lineItems = (RowSet)curOrder.getAttribute(“LineItems");
The RowSet is closed when you iterate and retrieve the last row from it. If you stop the iteration before retrieving the last row, you can programmatically close the RowSet if you want to release all the rows it contains. You can do this using the closeRowSet() API.
Note: If you generate the custom Java class for your view row, the type of the view link accessor will be RowIterator. At run time, the return value will always be a RowSet, so it is safe to cast the view link attribute value to a RowSet.