OAF Methods for View Object
Removing the selected row
a. Using RowSetIterator
//The below logic should be written in the AMImpl.java
public void deleteStudentRows()
{
XxcusStudentDataEOVOImpl vo = getXxcusStudentDataEOVO1();
XxcusStudentDataEOVORowImpl row = null ;
RowSetIterator rowIter = vo.createRowSetIterator(“studentData”) ;
String empNo = null;
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());
String selectFlag = row.getselectFlag() ;
if(selectFlag!=null && “Y”.equals(selectFlag))
{
empNo = empNo + ” , ” + row.getId() ;
row.remove();/// removes the data from VO
}
}
rowIter.closeRowSetIterator();
getOADBTransaction().commit();
throw new OAException(“Selected Rows Are Deleted Successfully–>”+ empNo , OAException.INFORMATION) ;
}
b. Using filteredRows Method
//The below logic should be written in the AMImpl.java
public void newDelteStudentRows()
{
XxcusStudentDataEOVOImpl vo = getXxcusStudentDataEOVO1();
XxcusStudentDataEOVORowImpl row = null ;
Row[] rows = vo.getFilteredRows(“selectFlag”,”Y”) ;
String empNo = “”;
for(int i=0; i<rows.length;i++)
{
row = (XxcusStudentDataEOVORowImpl)rows[i];
empNo = empNo + ” , ” + row.getId() ;
row.remove();
}
if(rows.length>=1)
{
getOADBTransaction().commit();
throw new OAException(“Selected Rows Are Deleted Successfully–>”+ empNo , OAException.INFORMATION) ;
}
else
{
throw new OAException(“Please Select The Rows TO Be Deleted”, OAException.ERROR) ;
}
}