This view link accessor containes rows for corresponding row of master (Departments) viewObject, It returns different rowset (list of Employees) for each record of Departments viewObject and we can programmatically access this view link accessor for each master record
Code in AMImpl to Iterate over Master and Detail view object records
import oracle.jbo.Row; import oracle.jbo.RowSet; import oracle.jbo.RowSetIterator; import oracle.jbo.ViewObject; /** * This is the method to iterate over Departments and corresponding Employees records */ public void iterateMasterDetail() { //Get Master ViewObject ViewObject deptVo = this.getDepartmentsView(); //Create iterator to iterate over master viewObject RowSetIterator rsi = deptVo.createRowSetIterator(null); while (rsi.hasNext()) { //Get Master ViewObject Row Row departmentsRow = rsi.next(); System.out.println("Department Name :" + departmentsRow.getAttribute("DepartmentName")); //Get Corresponding child viewobject accessor RowSet rs = (RowSet) departmentsRow.getAttribute("EmployeesView"); //Iterate over child viewObject rows for corresponding master record while (rs.hasNext()) { Row r = rs.next(); System.out.println(" Employee : " + r.getAttribute("FirstName") + " " + r.getAttribute("LastName")); } } //Close Master viewObject iterator rsi.closeRowSetIterator(); }
Add this method to client interface of Application Module and Run Application Module to check it
Output on log
No comments:
Post a Comment