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));
}

}

}

Wednesday, October 12, 2011

ADF Insert Row and Use it in procedures or funtions without commiting this.getDBTransaction().postChanges();

Given senarios like we need to create a row in a particular table and then call a procedure which uses the key from this row and inserts records in another tables all without commiting this to database. This is done using this.getDBTransaction().postChanges();

You can define this is any impl classes of view object and expose it to client. If you make any changes to view object in backing bean then call this method before invoking any procedures :)

Application Module Impl.java Method Declaration

You should define your custom methods in ApplModuleImpl.java class for reusability.

Sample Method :
public void getEmpDetails(Number empId) {
ViewObjectImpl myViewQuery = this.getMyViewQueryVO1(); //the view you have defined and added to appmodule.xml file
myViewQuery .setNamedWhereClauseParam("empId", empID); //view with param
myViewQuery .executeQuery();

//to commit you can use
getDBTransaction.commit() / rollback()

}
After defining this method you need to add this method to AppModule.xml file to expose it to client and you will find it in DataController panel.

To invoke this metod: In your jsff or jspx page definition in bindings create method binding for this method. you can also define values for this here or programmatically do it as

bindings = getBindings();
OperationBinding operationBinding = bindings.getOperationBinding("getEmpDetails");
operationBinding.getParamsMap().put("empId", employeeId);
operationBinding.execute();


public BindingContainer getBindings() {
return BindingContext.getCurrent().getCurrentBindingsEntry();
}

Monday, October 10, 2011

ADF Table automatically loads in between data entry?

Set the content delivery property to lazy to solve this issue.

Tuesday, October 4, 2011

Helpful ADF Blogs

ADF Demo Links:
http://jdevadf.oracle.com/adf-richclient-demo/faces/components/lov/comboLOVWithCustomActions.jspx;jsessionid=xsmhTJpVKCyyQvnRrF2pnQgKyx2XbSZbnncNdNy3mlMQJqsGvlqS!446378343?_afrLoop=392807939445182&_afrWindowMode=2&Adf-Window-Id=w0


http://www.oracle.com/technetwork/developer-tools/adf/learnmore/index-101235.html