Total Pageviews

Tuesday 31 October 2017

Useful Codes Used in OAF -2

Method To Insert the record in the table.

write the following code in the AM

public void InsertRecord()
{
  InsertVOImpl vo= getInsertVO1();
  OADBTransaction trans= getOADBTransaction();
  vo.executeQuery();
  Row v_row;
  v_row = (Row)vo.createRow();
  vo.insertRow(v_row);
}


The following code shows the initialization process of AM in controller.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
    super.processRequest(pageContext, webBean);
    InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
    am.InsertRecord();

}


The following code shows the creation of record.

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
  super.processFormRequest(pageContext, webBean);
   InsertRecordsAMImpl am=(InsertRecordsAMImpl)pageContext.getApplicationModule(webBean);
    if(pageContext.getParameter("item6")!=null)
    {
     am.getOADBTransaction().commit();
     throw new OAException("Data Created sucsessfully",OAException.CONFIRMATION);
    }
}

Swap the values from one item to other items

Swap the values from one item to other items

public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
{
 super.processFormRequest(pageContext, webBean);
  if(pageContext.getParameter("item3")!=null)
  {
   String name=pageContext.getParameter("item1");
   OAMessageStyledTextBean mst=                      (OAMessageStyledTextBean)webBean.findChildRecursive("item2");
   mst.setValue(pageContext,name);
   OAMessageTextInputBean mtib =            (OAMessageTextInputBean)webBean.findChildRecursive("item1");
   mtib.setValue(pageContext,null);
  }
}