OAF Different VO Methods for Initiation, Row Operations, Dynamic Query

//Logic to initialize VO in AMImpl

    public void  initKFFVO()
     {
       XxcusKffTestEOVOImpl vo = getXxcusKffTestEOVO1(); 
       XxcusKffTestEOVORowImpl row = null;
       
       vo.clearCache();
       vo.setMaxFetchSize(0);
       row = (XxcusKffTestEOVORowImpl)vo.createRow();
       row.setNewRowState(row.STATUS_INITIALIZED);
       vo.insertRow(row);
       
     }
//Logic to set the query dynamically
   public void setValueSetQueryForPopList(String valueSetNameStr)
    {
      
      String valueSetSQLQuery = getValueSetQuery(valueSetNameStr);
      
      GLValueSetVOImpl vo = getGLValueSetVO1();
      vo.clearCache();
      vo.setFullSqlMode(vo.FULLSQL_MODE_AUGMENTATION);
      vo.setQuery(valueSetSQLQuery);
      vo.executeQuery();
      
    }
//Logic to insert a Row in the VO
    public void insertEmpOAPLSQLEOVO()
     {
         EmpOAPlsqlEOVOImpl vo = getEmpOAPlsqlEOVO1(); 
         EmpOAPlsqlEOVORowImpl row = null;
         row = (EmpOAPlsqlEOVORowImpl)vo.createRow();
         row.setNewRowState(row.STATUS_INITIALIZED);
         vo.first();
         vo.previous();
         vo.insertRow(row);
     }
    
//Logic to delete the rows
    public void deleteEmpRowsForOAPlsqlEOVO()
     {
     
       EmpOAPlsqlEOVOImpl vo = getEmpOAPlsqlEOVO1();
       EmpOAPlsqlEOVORowImpl row = null ; 
       
       Row rows[] = vo.getFilteredRows("selectFlag","Y");
       
       int rowsLenth = rows.length; 

       if (rowsLenth>0)
        {
          for (int i=0;i<rowsLenth;i++)
            {
              row = (EmpOAPlsqlEOVORowImpl)rows[i];
              row.remove();
            }
              getOADBTransaction().commit();
              throw new OAException("Removed Rows Successfully",OAException.INFORMATION);
        }
       else
        {
          throw new OAException("Plese Select The Rows For Deletion");
        }
     
     }
    
//Validation logic to validate a value 

 public void validateInvLineAmount()
  {
    
      XxcusInvLinesEOVOImpl linesVO = getXxcusInvLinesEOVO1();
      XxcusInvLinesEOVORowImpl linesRow = null;
      
      Number invLinesAmount = null ; 
      
      
      RowSetIterator rowIter =    linesVO.createRowSetIterator("linesDataIter"); 
       while(rowIter.hasNext())
         {
             linesRow = (XxcusInvLinesEOVORowImpl)rowIter.next();
             invLinesAmount = linesRow.getAmount();
             if(linesRow.getLineType()!=null  && "STN".equals(linesRow.getLineType())) 
               {
                 if(invLinesAmount!=null && invLinesAmount.intValue() >100 )
                   {
                     throw new OAException("Invalid Line Amount For Stationary Line Type");
                   }
               } 
           
         }
      
      rowIter.closeRowSetIterator();
  
  }
//Logic to delete the row
public void deleteInvHdrRow()
 {
   XxcusInvHdrEOVOImpl headerVO = getXxcusInvHdrEOVO1(); 
   XxcusInvHdrEOVORowImpl row =  null ; 
   
   Row rows[]= headerVO.getFilteredRows("selectFlag","Y");
   if(rows.length>0)
    {
      row = (XxcusInvHdrEOVORowImpl)rows[0];
      row.remove();
      getOADBTransaction().commit();
      throw new OAException("Removed the row successfully",OAException.INFORMATION);
    }
   else
    {
      throw new OAException("Please select the rows to be deleted");
    }
 }

Leave a Reply

Your email address will not be published.