Wednesday, October 12, 2011

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