There are different requirements which we generally come across to iterate the data from VO.
Following are different approaches - we can use to get the data from VO.
You can write the below logic in : AMImpl
//Using RowSetIterator Logic
public void initShowEmpData()
{
EmpEOVOImpl vo = getEmpEOVO1();
EmpEOVORowImpl row = null;
RowSetIterator rowIter = vo.createRowSetIterator("EmpIter");
while(rowIter.hasNext())
{
row = (EmpEOVORowImpl)rowIter.next(); //FETCH INTO
System.out.println("EmpNO-->"+ row.getEmpno() + " Name-->"+ row.getEname()
+ " SelectFlag-->" + row.getselectFlag()
);
}
rowIter.closeRowSetIterator();
}
//Using FilteredRows Logic to get the filtered rows.
public void deleteSelectedRowsNew()
{
EmpEOVOImpl vo = getEmpEOVO1();
EmpEOVORowImpl row = null;
Row rows[]= vo.getFilteredRows("selectFlag","Y");
int selectedRowLenth = rows.length;
if(selectedRowLenth>0)
{
for(int i=0;i<selectedRowLenth;i++)
{
row = (EmpEOVORowImpl)rows[i];
row.remove();
}
OAException infoMsg = new OAException("Deleted The Selected Rows--Count-->"+selectedRowLenth,
OAException.INFORMATION);
throw infoMsg;
}
else
{
OAException warningMsg = new OAException("Plese Select The Rows", OAException.WARNING);
throw warningMsg;
}
}
//Using RowQualifier
public void showEmpDataUsingRowQualifier()
{
EmpEOVOImpl vo = getEmpEOVO1();
EmpEOVORowImpl row = null;
System.out.println("Using --showEmpDataUsingRowQualifier Logic");
oracle.jbo.server.RowQualifier rowQualifer = new RowQualifier(vo);
rowQualifer.setWhereClause("Deptno= 10 and Job='SALESMAN'");
Row rows[] = vo.getFilteredRows(rowQualifer) ;
int selectedRowLenth = rows.length;
if(selectedRowLenth>0)
{
for(int i=0;i<selectedRowLenth;i++)
{
row = (EmpEOVORowImpl)rows[i];
System.out.println("EmpNO-->"+ row.getEmpno() + " Name-->"+ row.getEname()
+ " SelectFlag-->" + row.getselectFlag() );
}
}
}
No comments:
Post a Comment