Thursday, October 29, 2009

To get viewObject from Java File and create new row

Assume that you have an application with HR schema and make a Department viewObject.

To get viewObject:
DepartmentsViewImpl dv = (DepartmentsViewImpl)findViewObject("DepartmentsView1");

To get current row:
DepartmentsViewImpl dv = (DepartmentsViewImpl)findViewObject("DepartmentsView1");
DepartmentsViewRowImpl r = (DepartmentsViewRowImpl)dv.getCurrentRow();

To create new row:
DepartmentsViewImpl dv = (DepartmentsViewImpl)findViewObject("DepartmentsView1");
DepartmentsViewRowImpl r = (DepartmentsViewRowImpl)dv.createRow();
dv.insertRow(r);

How to make a domain

A domain is used for making your own data type with your validation to do this:
- Right click in the package then choose New.
- Choose ADF Business Component then choose Domain.
- Enter the package and the name of the domain.
- Choose data type then finish.
- After creating a domain open the generated domain java class.
- Enter you validation in validate() method.
- There is a generated object 'mData' this object contain the data which you enter.
- Go to the attribute in any entity from type choose your domain.

For making a client method (Model Method)

1- Open Application Module.
2- Goto Java link then mark on "Generate Application Module Class".
3- In the generated class (ApplicationModuleImpl) write any public method you want.
4- Open Application module then go to java link then go to client interface and shuttle your method.
Hint: if you want to write your method in other class not in (Applicationmoduleimpl class) write your own class then make Applicationmoduleimpl class extends your own class.