Friday, 8 July 2011

Create,Update, Delete Example....

Used:
XXTestMainCO          -->Attached in your start page to Display all details at the time of page loading
XXTestEmpCO           --> Used to submit data for creating New Employee
XXTestUpdateCO       --> used to update Employee Details
XXTestEmpVOImpl     --> Employee Details
XXTestUpdateVOImpl --> Handle update operation
XXTestEmpEOImpl      --> Used to pick all Data and interaction with DB
OAFTestAM                -->to handle all your bussiness logic

**XXTestMainCO :

/*===========================================================================+
 |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
 |                         All rights reserved.                              |
 +===========================================================================+
 |  HISTORY                                                                  |
 +===========================================================================*/
package XXTest.oracle.apps.per.SelfService.test.webui;
import java.io.Serializable;
import oracle.apps.fnd.common.MessageToken;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OADialogPage;
/**
 * Controller for ...
 */
public class XXTestMainCO extends OAControllerImpl
{
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    OAApplicationModule am=  pageContext.getApplicationModule(webBean);
    am.invokeMethod("initEmpDetVo");
  
   
   
    if(pageContext.getParameter("TRANSACTION_STATUS")=="S"){
        pageContext.removeParameter("TRANSACTION_STATUS");
        throw new OAException("Emplouee Created successfully.",OAException.CONFIRMATION);
    }
    if(pageContext.getParameter("TRANSACTION_STATUS")=="D"){
        pageContext.removeParameter("TRANSACTION_STATUS");
        throw new OAException("Employee Deleted successfully.",OAException.CONFIRMATION);
    }
   
    if(pageContext.getParameter("TRANSACTION_STATUS")=="U"){
        pageContext.removeParameter("TRANSACTION_STATUS");
        throw new OAException("Employee Updated successfully.",OAException.CONFIRMATION);
    }
    if(pageContext.getParameter("TRANSACTION_STATUS")=="C"){
        pageContext.removeParameter("TRANSACTION_STATUS");
        throw new OAException("Transaction Canceled.",OAException.CONFIRMATION);
    }
  }
  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
    if(pageContext.getParameter("Create")!=null){
      pageContext.forwardImmediately("OA.jsp?page=/XXTest/oracle/apps/per/SelfService/test/webui/OAFTestPG",
                                     null,
                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                     null, null, true,
                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
     
      }
    else if ("update".equals(pageContext.getParameter(EVENT_PARAM))){
      pageContext.forwardImmediately("OA.jsp?page=/XXTest/oracle/apps/per/SelfService/test/webui/XXTestUpdatePG",
                                     null,
                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                     null, null, true,
                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    }
    else if ("Delete".equals(pageContext.getParameter(EVENT_PARAM))){
      String EmpID= pageContext.getParameter("EmployeeId");
      String empName= pageContext.getParameter("EmployeeName");
      MessageToken[] tokens = { new MessageToken("EMP_NAME", empName)};
      OAException mainMessage = new OAException("AK", "FWK_TBX_T_EMP_DELETE_WARN", tokens);
      OADialogPage dialogPage = new OADialogPage(OAException.WARNING, mainMessage, null, "", "");
      String yes = pageContext.getMessage("AK", "FWK_TBX_T_YES", null);
      String no = pageContext.getMessage("AK", "FWK_TBX_T_NO", null);
     
      dialogPage.setOkButtonItemName("DeleteYesButton");
      dialogPage.setOkButtonToPost(true);
      dialogPage.setNoButtonToPost(true);
      dialogPage.setPostToCallingPage(true);
      dialogPage.setOkButtonLabel(yes);
      dialogPage.setNoButtonLabel(no);
      java.util.Hashtable formParams = new java.util.Hashtable(1);
      formParams.put("EmployeeId", EmpID);
      dialogPage.setFormParameters(formParams);
      pageContext.redirectToDialogPage(dialogPage);
    }
      else if (pageContext.getParameter("DeleteYesButton") != null)
   {
      String EmpID= pageContext.getParameter("EmployeeId");
      Serializable[] params = { EmpID };
      OAApplicationModule am= pageContext.getApplicationModule(webBean); 
      am.invokeMethod("DeleteEmp",params);
      pageContext.putParameter("TRANSACTION_STATUS","D");
      pageContext.forwardImmediately("OA.jsp?page=/XXTest/oracle/apps/per/SelfService/test/webui/MainOATestPG",
                                   null,
                                   OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                   null, null, true,
                                   OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
    }
  }
}
=========================================================================

**XXTestEmpCO:

/*===========================================================================+
 |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
 |                         All rights reserved.                              |
 +===========================================================================+
 |  HISTORY                                                                  |
 +===========================================================================*/
package XXTest.oracle.apps.per.SelfService.test.webui;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
/**
 * Controller for ...
 */
public class XXTestEmpCO extends OAControllerImpl
{
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    /*write any code required at the time of page initialization
     * */
    OAApplicationModule am=  pageContext.getApplicationModule(webBean);
    am.invokeMethod("initEmpVo");
   
  }
  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    /*write code required at the time of any action or event required from the page
     * */
    super.processFormRequest(pageContext, webBean);
   
    if(pageContext.getParameter("Submit")!=null){
        OAApplicationModule am=pageContext.getApplicationModule(webBean);
        am.invokeMethod("apply");
        pageContext.putParameter("TRANSACTION_STATUS","S");
        pageContext.forwardImmediately("OA.jsp?page=/XXTest/oracle/apps/per/SelfService/test/webui/MainOATestPG",
                                     null,
                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                     null, null, true,
                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
       
       
    
    }
    if(pageContext.getParameter("Cancel")!=null){
        pageContext.putParameter("TRANSACTION_STATUS","C");
        pageContext.forwardImmediately("OA.jsp?page=/XXTest/oracle/apps/per/SelfService/test/webui/MainOATestPG",
                                     null,
                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                     null, null, true,
                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
       
        //throw new  OAException("Transaction Completed Successfully",OAException.INFORMATION);
    
    }
  }
 
}
=============================================================================

** XXTestUpdateCO:

/*===========================================================================+
 |   Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA    |
 |                         All rights reserved.                              |
 +===========================================================================+
 |  HISTORY                                                                  |
 +===========================================================================*/
package XXTest.oracle.apps.per.SelfService.test.webui;
import java.io.Serializable;
import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.OAApplicationModule;
import oracle.apps.fnd.framework.OAException;
import oracle.apps.fnd.framework.webui.OAControllerImpl;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.OAWebBeanConstants;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;

/**
 * Controller for ...
 */
public class XXTestUpdateCO extends OAControllerImpl
{
  public static final String RCS_ID="$Header$";
  public static final boolean RCS_ID_RECORDED =
        VersionInfo.recordClassVersion(RCS_ID, "%packagename%");
  /**
   * Layout and page setup logic for a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processRequest(pageContext, webBean);
    OAApplicationModule am=  pageContext.getApplicationModule(webBean);
    String EmpID= pageContext.getParameter("EmployeeID");
    System.out.println("EmpID :"+EmpID);
    Serializable[] params = { EmpID };
    am.invokeMethod("UpdateEmpDetVo",params);
  }
  /**
   * Procedure to handle form submissions for form elements in
   * a region.
   * @param pageContext the current OA page context
   * @param webBean the web bean corresponding to the region
   */
  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
   
    if(pageContext.getParameter("updateSubmit")!=null){
        OAApplicationModule am=pageContext.getApplicationModule(webBean);
        am.invokeMethod("applyUpdate");
        pageContext.putParameter("TRANSACTION_STATUS","U");
        pageContext.forwardImmediately("OA.jsp?page=/XXTest/oracle/apps/per/SelfService/test/webui/MainOATestPG",
                                     null,
                                     OAWebBeanConstants.KEEP_MENU_CONTEXT,
                                     null, null, true,
                                     OAWebBeanConstants.ADD_BREAD_CRUMB_NO);
      throw new OAException("Transaction Completed Successfully",OAException.INFORMATION);
   
    }
  
  }
}
=============================================================================

** XXTestEmpVOImpl:

package XXTest.oracle.apps.per.SelfService.test.server;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class XXTestEmpVOImpl extends OAViewObjectImpl
{
  /**This is the default constructor (do not remove)
   */
  public XXTestEmpVOImpl()
  {
  }
 
  public void initQuery(){
    clearCache();
    executeQuery();
  }
}
=============================================================================
**XXTestUpdateVOImpl:

package XXTest.oracle.apps.per.SelfService.test.server;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class XXTestUpdateVOImpl extends OAViewObjectImpl
{
  /**This is the default constructor (do not remove)
   */
  public XXTestUpdateVOImpl()
  {
  }
 
 
  public void initUpdateQuery(String EmpId){
  clearCache();
  setWhereClause(null);
  setWhereClauseParam(0,EmpId);
  executeQuery();
 
  }
}
=============================================================================
** XXTestEmpEOImpl:

package XXTest.oracle.apps.per.SelfService.test.schema.server;
import XXTest.oracle.apps.per.SelfService.Practice.schema.server.PracticeEOImpl;
import oracle.apps.fnd.framework.server.OAEntityDefImpl;
import oracle.apps.fnd.framework.server.OAEntityImpl;
import oracle.jbo.AttributeList;
import oracle.jbo.Key;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.server.AttributeDefImpl;
import oracle.jbo.server.EntityDefImpl;
import oracle.jbo.server.TransactionEvent;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class XXTestEmpEOImpl extends OAEntityImpl {
    public static final int EMPLOYEEID = 0;
    public static final int TITLE = 1;
    public static final int FIRSTNAME = 2;
    public static final int MIDDLENAMES = 3;
    public static final int LASTNAME = 4;
    public static final int FULLNAME = 5;
    public static final int EMAILADDRESS = 6;
    public static final int MANAGERID = 7;
    public static final int POSITIONCODE = 8;
    public static final int SALARY = 9;
    public static final int STARTDATE = 10;
    public static final int ENDDATE = 11;
    public static final int LASTUPDATEDATE = 12;
    public static final int LASTUPDATEDBY = 13;
    public static final int CREATIONDATE = 14;
    public static final int CREATEDBY = 15;
    public static final int LASTUPDATELOGIN = 16;
    public static final int ATTRIBUTECATEGORY = 17;
    public static final int ATTRIBUTE1 = 18;
    public static final int ATTRIBUTE2 = 19;
    public static final int ATTRIBUTE3 = 20;
    public static final int ATTRIBUTE4 = 21;
    public static final int ATTRIBUTE5 = 22;
    public static final int ATTRIBUTE6 = 23;
    public static final int ATTRIBUTE7 = 24;
    public static final int ATTRIBUTE8 = 25;
    public static final int ATTRIBUTE9 = 26;
    public static final int ATTRIBUTE10 = 27;
    public static final int ATTRIBUTE11 = 28;
    public static final int ATTRIBUTE12 = 29;
    public static final int ATTRIBUTE13 = 30;
    public static final int ATTRIBUTE14 = 31;
    public static final int ATTRIBUTE15 = 32;
    public static final int PRACTICEEO = 33;
    private static OAEntityDefImpl mDefinitionObject;
    /**This is the default constructor (do not remove)
     */
    public XXTestEmpEOImpl()
  {
  }

    /**Retrieves the definition object for this instance class.
     */
    public static synchronized EntityDefImpl getDefinitionObject() {
        if (mDefinitionObject == null) {
            mDefinitionObject =
                    (OAEntityDefImpl)EntityDefImpl.findDefObject("XXTest.oracle.apps.per.SelfService.test.schema.server.XXTestEmpEO");
        }
        return mDefinitionObject;
    }
    /**Add attribute defaulting logic in this method.
     */
    public void create(AttributeList attributeList)
  {
    super.create(attributeList);
  }
  /**Add entity remove logic in this method.
   */
  public void remove()
  {
    super.remove();
  }
  /**Add Entity validation code in this method.
   */
  protected void validateEntity()
  {
    super.validateEntity();
  }
  /**Add locking logic here.
   */
  public void lock()
  {
    super.lock();
  }
  /**Custom DML update/insert/delete logic here.
   */
  protected void doDML(int operation, TransactionEvent e)
  {
    super.doDML(operation, e);
  }
  /**Gets the attribute value for EmployeeId, using the alias name EmployeeId
   */
  public Number getEmployeeId()
  {
    return (Number)getAttributeInternal(EMPLOYEEID);
  }
  /**Sets <code>value</code> as the attribute value for EmployeeId
   */
  public void setEmployeeId(Number value)
  {
    setAttributeInternal(EMPLOYEEID, value);
  }
  /**Gets the attribute value for Title, using the alias name Title
   */
  public String getTitle()
  {
    return (String)getAttributeInternal(TITLE);
  }
  /**Sets <code>value</code> as the attribute value for Title
   */
  public void setTitle(String value)
  {
    setAttributeInternal(TITLE, value);
  }
  /**Gets the attribute value for FirstName, using the alias name FirstName
   */
  public String getFirstName()
  {
    return (String)getAttributeInternal(FIRSTNAME);
  }
  /**Sets <code>value</code> as the attribute value for FirstName
   */
  public void setFirstName(String value)
  {
    setAttributeInternal(FIRSTNAME, value);
  }
  /**Gets the attribute value for MiddleNames, using the alias name MiddleNames
   */
  public String getMiddleNames()
  {
    return (String)getAttributeInternal(MIDDLENAMES);
  }
  /**Sets <code>value</code> as the attribute value for MiddleNames
   */
  public void setMiddleNames(String value)
  {
    setAttributeInternal(MIDDLENAMES, value);
  }
  /**Gets the attribute value for LastName, using the alias name LastName
   */
  public String getLastName()
  {
    return (String)getAttributeInternal(LASTNAME);
  }
  /**Sets <code>value</code> as the attribute value for LastName
   */
  public void setLastName(String value)
  {
    setAttributeInternal(LASTNAME, value);
  }
  /**Gets the attribute value for FullName, using the alias name FullName
   */
  public String getFullName()
  {
    return (String)getAttributeInternal(FULLNAME);
  }
  /**Sets <code>value</code> as the attribute value for FullName
   */
  public void setFullName(String value)
  {
    setAttributeInternal(FULLNAME, value);
  }
  /**Gets the attribute value for EmailAddress, using the alias name EmailAddress
   */
  public String getEmailAddress()
  {
    return (String)getAttributeInternal(EMAILADDRESS);
  }
  /**Sets <code>value</code> as the attribute value for EmailAddress
   */
  public void setEmailAddress(String value)
  {
    setAttributeInternal(EMAILADDRESS, value);
  }
  /**Gets the attribute value for ManagerId, using the alias name ManagerId
   */
  public Number getManagerId()
  {
    return (Number)getAttributeInternal(MANAGERID);
  }
  /**Sets <code>value</code> as the attribute value for ManagerId
   */
  public void setManagerId(Number value)
  {
    setAttributeInternal(MANAGERID, value);
  }
  /**Gets the attribute value for PositionCode, using the alias name PositionCode
   */
  public String getPositionCode()
  {
    return (String)getAttributeInternal(POSITIONCODE);
  }
  /**Sets <code>value</code> as the attribute value for PositionCode
   */
  public void setPositionCode(String value)
  {
    setAttributeInternal(POSITIONCODE, value);
  }
  /**Gets the attribute value for Salary, using the alias name Salary
   */
  public Number getSalary()
  {
    return (Number)getAttributeInternal(SALARY);
  }
  /**Sets <code>value</code> as the attribute value for Salary
   */
  public void setSalary(Number value)
  {
    setAttributeInternal(SALARY, value);
  }
  /**Gets the attribute value for StartDate, using the alias name StartDate
   */
  public Date getStartDate()
  {
    return (Date)getAttributeInternal(STARTDATE);
  }
  /**Sets <code>value</code> as the attribute value for StartDate
   */
  public void setStartDate(Date value)
  {
    setAttributeInternal(STARTDATE, value);
  }
  /**Gets the attribute value for EndDate, using the alias name EndDate
   */
  public Date getEndDate()
  {
    return (Date)getAttributeInternal(ENDDATE);
  }
  /**Sets <code>value</code> as the attribute value for EndDate
   */
  public void setEndDate(Date value)
  {
    setAttributeInternal(ENDDATE, value);
  }
  /**Gets the attribute value for LastUpdateDate, using the alias name LastUpdateDate
   */
  public Date getLastUpdateDate()
  {
    return (Date)getAttributeInternal(LASTUPDATEDATE);
  }
  /**Sets <code>value</code> as the attribute value for LastUpdateDate
   */
  public void setLastUpdateDate(Date value)
  {
    setAttributeInternal(LASTUPDATEDATE, value);
  }
  /**Gets the attribute value for LastUpdatedBy, using the alias name LastUpdatedBy
   */
  public Number getLastUpdatedBy()
  {
    return (Number)getAttributeInternal(LASTUPDATEDBY);
  }
  /**Sets <code>value</code> as the attribute value for LastUpdatedBy
   */
  public void setLastUpdatedBy(Number value)
  {
    setAttributeInternal(LASTUPDATEDBY, value);
  }
  /**Gets the attribute value for CreationDate, using the alias name CreationDate
   */
  public Date getCreationDate()
  {
    return (Date)getAttributeInternal(CREATIONDATE);
  }
  /**Sets <code>value</code> as the attribute value for CreationDate
   */
  public void setCreationDate(Date value)
  {
    setAttributeInternal(CREATIONDATE, value);
  }
  /**Gets the attribute value for CreatedBy, using the alias name CreatedBy
   */
  public Number getCreatedBy()
  {
    return (Number)getAttributeInternal(CREATEDBY);
  }
  /**Sets <code>value</code> as the attribute value for CreatedBy
   */
  public void setCreatedBy(Number value)
  {
    setAttributeInternal(CREATEDBY, value);
  }
  /**Gets the attribute value for LastUpdateLogin, using the alias name LastUpdateLogin
   */
  public Number getLastUpdateLogin()
  {
    return (Number)getAttributeInternal(LASTUPDATELOGIN);
  }
  /**Sets <code>value</code> as the attribute value for LastUpdateLogin
   */
  public void setLastUpdateLogin(Number value)
  {
    setAttributeInternal(LASTUPDATELOGIN, value);
  }
  /**Gets the attribute value for AttributeCategory, using the alias name AttributeCategory
   */
  public String getAttributeCategory()
  {
    return (String)getAttributeInternal(ATTRIBUTECATEGORY);
  }
  /**Sets <code>value</code> as the attribute value for AttributeCategory
   */
  public void setAttributeCategory(String value)
  {
    setAttributeInternal(ATTRIBUTECATEGORY, value);
  }
  /**Gets the attribute value for Attribute1, using the alias name Attribute1
   */
  public String getAttribute1()
  {
    return (String)getAttributeInternal(ATTRIBUTE1);
  }
  /**Sets <code>value</code> as the attribute value for Attribute1
   */
  public void setAttribute1(String value)
  {
    setAttributeInternal(ATTRIBUTE1, value);
  }
  /**Gets the attribute value for Attribute2, using the alias name Attribute2
   */
  public String getAttribute2()
  {
    return (String)getAttributeInternal(ATTRIBUTE2);
  }
  /**Sets <code>value</code> as the attribute value for Attribute2
   */
  public void setAttribute2(String value)
  {
    setAttributeInternal(ATTRIBUTE2, value);
  }
  /**Gets the attribute value for Attribute3, using the alias name Attribute3
   */
  public String getAttribute3()
  {
    return (String)getAttributeInternal(ATTRIBUTE3);
  }
  /**Sets <code>value</code> as the attribute value for Attribute3
   */
  public void setAttribute3(String value)
  {
    setAttributeInternal(ATTRIBUTE3, value);
  }
  /**Gets the attribute value for Attribute4, using the alias name Attribute4
   */
  public String getAttribute4()
  {
    return (String)getAttributeInternal(ATTRIBUTE4);
  }
  /**Sets <code>value</code> as the attribute value for Attribute4
   */
  public void setAttribute4(String value)
  {
    setAttributeInternal(ATTRIBUTE4, value);
  }
  /**Gets the attribute value for Attribute5, using the alias name Attribute5
   */
  public String getAttribute5()
  {
    return (String)getAttributeInternal(ATTRIBUTE5);
  }
  /**Sets <code>value</code> as the attribute value for Attribute5
   */
  public void setAttribute5(String value)
  {
    setAttributeInternal(ATTRIBUTE5, value);
  }
  /**Gets the attribute value for Attribute6, using the alias name Attribute6
   */
  public String getAttribute6()
  {
    return (String)getAttributeInternal(ATTRIBUTE6);
  }
  /**Sets <code>value</code> as the attribute value for Attribute6
   */
  public void setAttribute6(String value)
  {
    setAttributeInternal(ATTRIBUTE6, value);
  }
  /**Gets the attribute value for Attribute7, using the alias name Attribute7
   */
  public String getAttribute7()
  {
    return (String)getAttributeInternal(ATTRIBUTE7);
  }
  /**Sets <code>value</code> as the attribute value for Attribute7
   */
  public void setAttribute7(String value)
  {
    setAttributeInternal(ATTRIBUTE7, value);
  }
  /**Gets the attribute value for Attribute8, using the alias name Attribute8
   */
  public String getAttribute8()
  {
    return (String)getAttributeInternal(ATTRIBUTE8);
  }
  /**Sets <code>value</code> as the attribute value for Attribute8
   */
  public void setAttribute8(String value)
  {
    setAttributeInternal(ATTRIBUTE8, value);
  }
  /**Gets the attribute value for Attribute9, using the alias name Attribute9
   */
  public String getAttribute9()
  {
    return (String)getAttributeInternal(ATTRIBUTE9);
  }
  /**Sets <code>value</code> as the attribute value for Attribute9
   */
  public void setAttribute9(String value)
  {
    setAttributeInternal(ATTRIBUTE9, value);
  }
  /**Gets the attribute value for Attribute10, using the alias name Attribute10
   */
  public String getAttribute10()
  {
    return (String)getAttributeInternal(ATTRIBUTE10);
  }
  /**Sets <code>value</code> as the attribute value for Attribute10
   */
  public void setAttribute10(String value)
  {
    setAttributeInternal(ATTRIBUTE10, value);
  }
  /**Gets the attribute value for Attribute11, using the alias name Attribute11
   */
  public String getAttribute11()
  {
    return (String)getAttributeInternal(ATTRIBUTE11);
  }
  /**Sets <code>value</code> as the attribute value for Attribute11
   */
  public void setAttribute11(String value)
  {
    setAttributeInternal(ATTRIBUTE11, value);
  }
  /**Gets the attribute value for Attribute12, using the alias name Attribute12
   */
  public String getAttribute12()
  {
    return (String)getAttributeInternal(ATTRIBUTE12);
  }
  /**Sets <code>value</code> as the attribute value for Attribute12
   */
  public void setAttribute12(String value)
  {
    setAttributeInternal(ATTRIBUTE12, value);
  }
  /**Gets the attribute value for Attribute13, using the alias name Attribute13
   */
  public String getAttribute13()
  {
    return (String)getAttributeInternal(ATTRIBUTE13);
  }
  /**Sets <code>value</code> as the attribute value for Attribute13
   */
  public void setAttribute13(String value)
  {
    setAttributeInternal(ATTRIBUTE13, value);
  }
  /**Gets the attribute value for Attribute14, using the alias name Attribute14
   */
  public String getAttribute14()
  {
    return (String)getAttributeInternal(ATTRIBUTE14);
  }
  /**Sets <code>value</code> as the attribute value for Attribute14
   */
  public void setAttribute14(String value)
  {
    setAttributeInternal(ATTRIBUTE14, value);
  }
  /**Gets the attribute value for Attribute15, using the alias name Attribute15
   */
  public String getAttribute15()
  {
    return (String)getAttributeInternal(ATTRIBUTE15);
  }
  /**Sets <code>value</code> as the attribute value for Attribute15
   */
  public void setAttribute15(String value)
  {
    setAttributeInternal(ATTRIBUTE15, value);
  }
  /**getAttrInvokeAccessor: generated method. Do not modify.
   */
  protected Object getAttrInvokeAccessor(int index,
                                         AttributeDefImpl attrDef) throws Exception
  {
        switch (index) {
        case EMPLOYEEID:
            return getEmployeeId();
        case TITLE:
            return getTitle();
        case FIRSTNAME:
            return getFirstName();
        case MIDDLENAMES:
            return getMiddleNames();
        case LASTNAME:
            return getLastName();
        case FULLNAME:
            return getFullName();
        case EMAILADDRESS:
            return getEmailAddress();
        case MANAGERID:
            return getManagerId();
        case POSITIONCODE:
            return getPositionCode();
        case SALARY:
            return getSalary();
        case STARTDATE:
            return getStartDate();
        case ENDDATE:
            return getEndDate();
        case LASTUPDATEDATE:
            return getLastUpdateDate();
        case LASTUPDATEDBY:
            return getLastUpdatedBy();
        case CREATIONDATE:
            return getCreationDate();
        case CREATEDBY:
            return getCreatedBy();
        case LASTUPDATELOGIN:
            return getLastUpdateLogin();
        case ATTRIBUTECATEGORY:
            return getAttributeCategory();
        case ATTRIBUTE1:
            return getAttribute1();
        case ATTRIBUTE2:
            return getAttribute2();
        case ATTRIBUTE3:
            return getAttribute3();
        case ATTRIBUTE4:
            return getAttribute4();
        case ATTRIBUTE5:
            return getAttribute5();
        case ATTRIBUTE6:
            return getAttribute6();
        case ATTRIBUTE7:
            return getAttribute7();
        case ATTRIBUTE8:
            return getAttribute8();
        case ATTRIBUTE9:
            return getAttribute9();
        case ATTRIBUTE10:
            return getAttribute10();
        case ATTRIBUTE11:
            return getAttribute11();
        case ATTRIBUTE12:
            return getAttribute12();
        case ATTRIBUTE13:
            return getAttribute13();
        case ATTRIBUTE14:
            return getAttribute14();
        case ATTRIBUTE15:
            return getAttribute15();
        case PRACTICEEO:
            return getPracticeEO();
        default:
            return super.getAttrInvokeAccessor(index, attrDef);
        }
    }
  /**setAttrInvokeAccessor: generated method. Do not modify.
   */
  protected void setAttrInvokeAccessor(int index, Object value,
                                       AttributeDefImpl attrDef) throws Exception
  {
        switch (index) {
        case EMPLOYEEID:
            setEmployeeId((Number)value);
            return;
        case TITLE:
            setTitle((String)value);
            return;
        case FIRSTNAME:
            setFirstName((String)value);
            return;
        case MIDDLENAMES:
            setMiddleNames((String)value);
            return;
        case LASTNAME:
            setLastName((String)value);
            return;
        case FULLNAME:
            setFullName((String)value);
            return;
        case EMAILADDRESS:
            setEmailAddress((String)value);
            return;
        case MANAGERID:
            setManagerId((Number)value);
            return;
        case POSITIONCODE:
            setPositionCode((String)value);
            return;
        case SALARY:
            setSalary((Number)value);
            return;
        case STARTDATE:
            setStartDate((Date)value);
            return;
        case ENDDATE:
            setEndDate((Date)value);
            return;
        case LASTUPDATEDATE:
            setLastUpdateDate((Date)value);
            return;
        case LASTUPDATEDBY:
            setLastUpdatedBy((Number)value);
            return;
        case CREATIONDATE:
            setCreationDate((Date)value);
            return;
        case CREATEDBY:
            setCreatedBy((Number)value);
            return;
        case LASTUPDATELOGIN:
            setLastUpdateLogin((Number)value);
            return;
        case ATTRIBUTECATEGORY:
            setAttributeCategory((String)value);
            return;
        case ATTRIBUTE1:
            setAttribute1((String)value);
            return;
        case ATTRIBUTE2:
            setAttribute2((String)value);
            return;
        case ATTRIBUTE3:
            setAttribute3((String)value);
            return;
        case ATTRIBUTE4:
            setAttribute4((String)value);
            return;
        case ATTRIBUTE5:
            setAttribute5((String)value);
            return;
        case ATTRIBUTE6:
            setAttribute6((String)value);
            return;
        case ATTRIBUTE7:
            setAttribute7((String)value);
            return;
        case ATTRIBUTE8:
            setAttribute8((String)value);
            return;
        case ATTRIBUTE9:
            setAttribute9((String)value);
            return;
        case ATTRIBUTE10:
            setAttribute10((String)value);
            return;
        case ATTRIBUTE11:
            setAttribute11((String)value);
            return;
        case ATTRIBUTE12:
            setAttribute12((String)value);
            return;
        case ATTRIBUTE13:
            setAttribute13((String)value);
            return;
        case ATTRIBUTE14:
            setAttribute14((String)value);
            return;
        case ATTRIBUTE15:
            setAttribute15((String)value);
            return;
        default:
            super.setAttrInvokeAccessor(index, value, attrDef);
            return;
        }
    }

    /**Gets the associated entity XXTest.oracle.apps.per.SelfService.Practice.schema.server.PracticeEOImpl
     */
    public PracticeEOImpl getPracticeEO() {
        return (PracticeEOImpl)getAttributeInternal(PRACTICEEO);
    }
    /**Sets <code>value</code> as the associated entity XXTest.oracle.apps.per.SelfService.Practice.schema.server.PracticeEOImpl
     */
    public void setPracticeEO(PracticeEOImpl value) {
        setAttributeInternal(PRACTICEEO, value);
    }
    /**Creates a Key object based on given key constituents
     */
    public static Key createPrimaryKey(Number employeeId) {
        return new Key(new Object[]{employeeId});
    }
}
==============================================================================
** OAFTestAM:

package XXTest.oracle.apps.per.SelfService.test.server;
import oracle.apps.fnd.framework.server.OAApplicationModuleImpl;
import oracle.apps.fnd.framework.server.OAViewObjectImpl;
import XXTest.oracle.apps.per.SelfService.test.server.XXTestEmpVOImpl;
import XXTest.oracle.apps.per.SelfService.test.server.XXTestUpdateVOImpl;
import oracle.apps.fnd.framework.OAViewObject;
import oracle.jbo.Row;
import oracle.jbo.RowSetIterator;
import oracle.jbo.domain.Number;
import oracle.jbo.Transaction;
// ---------------------------------------------------------------------
// ---    File generated by Oracle ADF Business Components Design Time.
// ---    Custom code may be added to this class.
// ---    Warning: Do not modify method signatures of generated methods.
// ---------------------------------------------------------------------
public class OAFTestAMImpl extends OAApplicationModuleImpl
{
  /**This is the default constructor (do not remove)
   */
  public OAFTestAMImpl()
  {
  }
  /**Sample main for debugging Business Components code using the tester.
   */
  public static void main(String[] args)
  {
    launchTester("XXTest.oracle.apps.per.SelfService.test.server", /* package name */
      "OAFTestAMLocal" /* Configuration Name */);
  }
  /**Container's getter for XXTestEmpVO
   */
  public XXTestEmpVOImpl getXXTestEmpVO()
  {
    return (XXTestEmpVOImpl)findViewObject("XXTestEmpVO");
  }
 
  public void initEmpVo(){
    OAViewObject vo= (OAViewObject)getXXTestEmpVO();
  //  vo.initQuery();
   vo.executeQuery();
   
    Row row= vo.createRow();
    vo.insertRow(row);
    row.setNewRowState(Row.STATUS_INITIALIZED);
  
  }
 
  public void initEmpDetVo(){
 
    XXTestEmpVOImpl vo= getXXTestEmpVO();
   
    vo.clearCache();
    vo.initQuery();

  }
 
  public void UpdateEmpDetVo(String EmpID){
    XXTestUpdateVOImpl updateVO= getXXTestUpdateVO();
    updateVO.clearCache();
    updateVO.initUpdateQuery(EmpID);
   
  }
  public void applyUpdate(){
      getTransaction().commit();
  }
 
  public void DeleteEmp(String EmpID){
   
    int empToDelete = Integer.parseInt(EmpID);
    System.out.println("empToDelete :"+empToDelete);
   
    OAViewObject vo = (OAViewObject)getXXTestEmpVO();
   // vo.clearCache();
   // vo.setWhereClause(null);
   // vo.setWhereClauseParam(0,empToDelete);
    if(!vo.isPreparedForExecution()){
        vo.executeQuery();
    }
   
    XXTestEmpVORowImpl row=null;
   
    int fetchRowCount = vo.getRowCount();
   // int RowCount = vo.getRowCount();
    System.out.println("fetchRowCount :"+fetchRowCount);
    //System.out.println("RowCount :"+RowCount);
   
    RowSetIterator deleteIter = vo.createRowSetIterator("deleteIter");
    if (fetchRowCount>0){
      deleteIter.setRangeStart(0);
      deleteIter.setRangeSize(fetchRowCount);
          for(int i=0;i<fetchRowCount;i++){
            row = (XXTestEmpVORowImpl)deleteIter.getRowAtRangeIndex(i);
            Number primaryKey = row.getEmployeeId();
                    if (primaryKey.compareTo(empToDelete) == 0)
                    {
                      row.remove();
                      getTransaction().commit();
                      break;
                    } 
          }
     
    }
   
  }
 
  public void apply(){
      getTransaction().commit();
  }
  /**Container's getter for XXTestUpdateVO
   */
  public XXTestUpdateVOImpl getXXTestUpdateVO()
  {
    return (XXTestUpdateVOImpl)findViewObject("XXTestUpdateVO");
  }
}

OAF Interview Question and Answer

http://oraclearea51.com/technical-articles/oaf-beginners-guide/127-oa-framework-interview-questions.html

More About on EO-VO-AM....

Entity Objects:An entity object implements the business rules for a given table, view, or snapshot. Entity objects are intended to be used in many clients (not just an OA Framework UI), and as such, should consolidate all of the relevant validation/behavior for the table.
1. Each table should have at most one entity object.
2. Entity objects should include attributes for all columns in its table.
3. You can subclass your own common entity objects .
4. You will commonly add object initialization, attribute validation, entity-level
 validation, and other functional behaviors to your entity objects.
5. Finally, you can create server "helper" objects and interfaces as needed to create modular code.

Entity Associations (Association Objects):
Associations let you create declarative relationships between entity objects. At runtime, BC4J uses these relationships to coordinate the related objects. There are two basic types of associations:
1. Composition - A strong association where the source entity object owns the destination entity object.
      In other words, the destination cannot exist independent of its source.
2. Reference - A weak association where the source entity object only references the destination entity object.
Create reference associations for any entity objects that you're likely to update or instantiate at runtime.

View Objects and View Rows:
view objects encapsulate database queries and provide access to associated entity objects. One of the most important view object design decisions is whether it should be based on plain SQL, or on entity objects.
1. All trivial UI view objects for things like Lists of Values (LOV) and poplists are based on plain SQL.
2. Any validation view objects, created to implement simple business rules for an entity object, are based on plain SQL.
3. All other view objects created for the UI, regardless of whether they are updateable, are based on entity objects.

View Links :As described above, an association defines a relationship between two entity objects. Similarly, a view link defines a relationship between two view objects that BC4J uses to automatically query and coordinate the destination view object based on the current source view object.
View links can be based on an association or a declarative join relationship between two view objects. For example, suppose two tables have a master-detail relationship based on a foreign key. The corresponding entity objects are related via an association, and view objects based on those entity objects can be related by a view link based on the association.
Although view links can be very convenient, use them sparingly in the web applications pages because they cache both the master and detail records as the user navigates from one master row to the next -- and this can be expensive. Use view links only in the following cases:
1. When specific beans (like the HGrid) require them.
2. When you have updateable master/detail view objects (on the same or different pages) whose underlying entity objects are related using composition, you must define a view link between them .
3. When you have a read-only master and detail view object on the same page, and navigating to a master row should cause the children to query automatically.

Application Modules(AM):Application Module UsesThe following is a list the distinct roles that application modules can play in your application:
1. UI Root Application Module -
 Establishes the transaction context for one or several related UI pages. Every page has a root application module which
 includes any view objects and nested application modules used by the page.
2. UI Shared Region Application Module - Any UI region with created for use in multiple pages should have its own containing
 application module. When this region is used in a page, OA Framework automatically nests its application module beneath
 the page's root application module.

Onoin Structure of OA Framework

OA Framework applications can be abstracted into a series of concentric layers, like an onion. The core layer represents the database and the surface layer represents the application pages. In between is a number of business logic and user interface layers. This layering allows for generic code and components to be implemented at the inner layers to maximize their reuse across the outer layers. For example, attribute validation is implemented at the Entity Object (a BC4J object-oriented representation of a database table in the middle tier) level. All application pages that provide the user with the ability to populate or update the value of the subject attribute would receive attribute validation for free through the underlying entity object. On the user-interface side, reusable components can be saved as shared regions in the metadata services (MDS) repository and reused across several pages. An administrator can choose to personalize the shared region such that the personalization impacts all instances of the same region across pages or personalize the shared region only in the context of the current page

OA Framework Architecture..

OA Framework is based on the industry-standard J2EE MVC design pattern. Developers manipulate the application's metadata using Oracle JDeveloper OA Extension, while OA Framework uses the most efficient manner to execute the application. The MVC architecture is a component-based design pattern with clean interfaces between the Model, View, and Controller. The Model is where the application implements its business logic. The View is where the application implements its user interface and the Controller is where the application handles user interaction and directs business flow.