Saturday, October 22, 2011

Programmatically Accessing Application Module, ViewImpl & ViewRowImpl classes

//the syntax of configuration is 1st parameter to have full path and second to have modulename with Local added to it


public static void main(String[] args) {
ApplicationModule appModule =
Configuration.createRootApplicationModule("com.adf.sample.model.SampleModule", "SampleModuleLocal");
DepartmentsViewImpl deptVo = (DepartmentsViewImpl)appModule.findViewObject("DepartmentsView1");
while(deptVo.hasNext()){
DepartmentsViewRowImpl deptRowVo = (DepartmentsViewRowImpl)deptVo.next();
System.out.println("Department Name: "+deptRowVo.getDepartmentName());
RowIterator empVo = deptRowVo.getEmployeesView();
while(empVo.hasNext()){
Row empRow = empVo.next();
//EmpDetailsViewViewRowImpl empRow = (EmpDetailsViewViewRowImpl)empVo.next();
//System.out.println(" "+empRow.getFirstName());
System.out.println(" "+empRow.getAttribute(1));
}

}

}