OAF_Methods for View Object
Initialization of the VO
1. Method to execute the VO without any bind parameter
// Below code has to be written in the AMImpl.java and the VO name differs based on your project setup
public void initOeOrdersVO()
{
OeOrderHeadersVOImpl vo = getOeOrderHeadersVO1();
vo.executeQuery(); //OPEN operation on cursor
}
2. Method to execute the VO by setting bind parameter
//Method to bind the parameter to the VO
public void initPerPeopleVO()
{
String bgID = “202”;
PerPeopleVOImpl vo = getPerPeopleVO1();
vo.clearCache();
vo.setWhereClauseParam(0,bgID);
vo.executeQuery();
}
3. Adding Row Manually
//Below code refers to add the row in the VO Manually
public void addStudentRowManually()
{
XxcusStudentDataEOVOImpl vo = getXxcusStudentDataEOVO1();
XxcusStudentDataEOVORowImpl row = null;
row = (XxcusStudentDataEOVORowImpl)vo.createRow();
row.setNewRowState(row.STATUS_INITIALIZED);
Number studentIDNO = getOADBTransaction().getSequenceValue(“XXCUS_STUDENT_ID_S”) ;
row.setId(studentIDNO);
// vo.last();
// vo.next();
vo.first();
vo.previous();
vo.insertRow(row);
}
4. Iterating the VO Using RowSetIterator
public void showStudentData()
{
XxcusStudentDataEOVOImpl vo = getXxcusStudentDataEOVO1();
XxcusStudentDataEOVORowImpl row = null ;
RowSetIterator rowIter = vo.createRowSetIterator(“studentData”) ;
while(rowIter.hasNext())
{
row = (XxcusStudentDataEOVORowImpl)rowIter.next(); ///FETCH
System.out.println(“ID –>” + row.getId());
System.out.println(“Sname–>”+ row.getSname());
System.out.println(“SelectFlag–>”+ row.getselectFlag());
}
rowIter.closeRowSetIterator();
}