Search This Blog

Saturday, March 19, 2016

22. OAF EO Extension

EO Extension in OAF


This OAF online tutorial lesson explains how to Extend Entity Object in Oracle Apps Framework (OAF) with one sample requirement, taking it as an example to explain EO Extension Process in OAF.
First of all let us understand the requirement. We have one Responsibility called “OA Framework ToolBox Tutorial Labs”. If you don’t have that Responsibility go to System Administrator Responsibility -> User and add the Responsibility. The application for the OA Framework ToolBox Tutorial Labs is “Common Modules-AK”.
In the responsibility navigate to “Main Employee Search”.
OA Framework ToolBox Tutorial Labs -> Tutorial Lab -> Employees -> Main Employee Search
 
The below image shows the same Navigation Process:
Navigation in AM extension oaf
After navigating to the Main Employee Search page we have a button called Create Employee. Whenever we click on Create Employee Button it will take us to another page for creating employee.
Creating employee in OAF AM extension process requirement
The below image shows the Create Employee OAF page window, in the below image you can see that Email Address is highlighted. Let’s see the explanation after the image why it’s highlighted.
EO extension requirement in OAF
In the above image you might have observed that Email Address field is empty. So therefore here our requirement is we want the default email address as “training@newtonapples.com/old”.
Hence Email Address field is an attribute in OAF, we need to add default value to the attribute. This can be done by extending EO where it contains all the attribute values. We can perform DML operations (INSERT, UPDATE, DELETE) only using EO. Here we need to set the default value of Email Address to “training@newtonapples.com/old”. Let us see how to extend EO step wise.
 
Step 1: Go to About this Page of Create Employee page. Extract the Business Component Reference Details. You can see the EmployeeEO.
Copy the EmployeeEO and create the same directory structure in JDeveloper patch, which is available in your desktop system.
The below image shows the sample way of creating the directory structure and copying the files from the Server to the JDeveloper patch.
Copying and creating the directory structure in OAF for EO extension
 
Step 2: Open the JDeveloper and create new WorkSpace and Project.
For example:-
Workspace Name : XXEOExtension




Project Name : XXEOExtensionPRJ




Default Package: xxeoextension.oracle.apps.fnd.framework.toolbox.labsolutions.webui
Note that we need to create the Default package name according to the path which we will see in about this page, we have a page path like as follows:-
/oracle/apps/fnd/framework/toolbox/labsolutions/webui/EmployeePG 120.9
 
We need to replace the Default package name according to the patch as follows:-
xxeoextension.oracle.apps.fnd.framework.toolbox.labsolutions.webui
If you observe, we removed slash symbols, and also we removed the page name and at the beginning we have to give our own name like “xxeoextension”.
 
Step 3: After creating the dummy workspace and Dummy project, we will get a structure. Now create the Entity Object.
For example give the Entity name as follows:
Name : EmployeeEOEx




Package : xxeoextension.oracle.apps.fnd.framework.toolbox.schema.server
In Extends Entity, select the Original EmployeeEO which you will find in browse because we created the same directory structure as it is in server and also we copied from the server.
The below image shows the EO creation process Window
EO extension selecting the original EO while creating EO
After that whenever you click on Next button, you will not find any Entity Attributes:
EO showing empty entity attributes
To see the Attributes, click on the button called New From Table.., Using right arrow buttons move all the available Attributes into the selected list.
Creating or selecting Entity Attributes Coloumns
After that in fourth step of EO creation process, check the Validation Method check box. The same scenario is shown in the below image:
Validating methods in EO extension
 
Step 4: After creating EO open the Java File and add the two lines in create method. In the below code you need to add only two lines, line numbers 40 and 41. No need to do any changes for the remaining entire code.
[sql]package xxeoextension.oracle.apps.fnd.framework.toolbox.schema.server;
import oracle.apps.fnd.framework.server.OAEntityDefImpl;
import oracle.apps.fnd.framework.toolbox.schema.server.EmployeeEOImpl;
import oracle.jbo.AttributeList;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.domain.RowID;
import oracle.jbo.server.AttributeDefImpl;
import oracle.jbo.server.EntityDefImpl;
// ———————————————————————
// —    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 EmployeeEOExImpl extends EmployeeEOImpl
{
  public static final int MAXATTRCONST = EntityDefImpl.getMaxAttrConst(“oracle.apps.fnd.framework.toolbox.schema.server.EmployeeEO”);
  public static final int ROWID = MAXATTRCONST;
  private static OAEntityDefImpl mDefinitionObject;
  /**This is the default constructor (do not remove)
   */
  public EmployeeEOExImpl()
  {
  }
  /**Retrieves the definition object for this instance class.
   */
  public static synchronized EntityDefImpl getDefinitionObject()
  {
    if (mDefinitionObject == null)
    {
      mDefinitionObject =
          (OAEntityDefImpl)EntityDefImpl.findDefObject(“xxeoextension.oracle.apps.fnd.framework.toolbox.schema.server.EmployeeEOEx”);
    }
    return mDefinitionObject;
  }
  /**Add attribute defaulting logic in this method.
   */
  public void create(AttributeList attributeList)
  {
    super.create(attributeList);
    setEmailAddress(“training@newtonapples.com/old”);
  }
  /**Add Entity validation code in this method.
   */
  protected void validateEntity()
  {
    super.validateEntity();
  }
  /**Gets the attribute value for EmployeeId, using the alias name EmployeeId
   */
  public Number getEmployeeId()
  {
    return super.getEmployeeId();
  }
  /**Sets value as the attribute value for EmployeeId
   */
  public void setEmployeeId(Number value)
  {
    super.setEmployeeId(value);
  }
  /**Gets the attribute value for Title, using the alias name Title
   */
  public String getTitle()
  {
    return super.getTitle();
  }
  /**Sets value as the attribute value for Title
   */
  public void setTitle(String value)
  {
    super.setTitle(value);
  }
  /**Gets the attribute value for FirstName, using the alias name FirstName
   */
  public String getFirstName()
  {
    return super.getFirstName();
  }
  /**Sets value as the attribute value for FirstName
   */
  public void setFirstName(String value)
  {
    super.setFirstName(value);
  }
  /**Gets the attribute value for MiddleNames, using the alias name MiddleNames
   */
  public String getMiddleNames()
  {
    return super.getMiddleNames();
  }
  /**Sets value as the attribute value for MiddleNames
   */
  public void setMiddleNames(String value)
  {
    super.setMiddleNames(value);
  }
  /**Gets the attribute value for LastName, using the alias name LastName
   */
  public String getLastName()
  {
    return super.getLastName();
  }
  /**Sets value as the attribute value for LastName
   */
  public void setLastName(String value)
  {
    super.setLastName(value);
  }
  /**Gets the attribute value for FullName, using the alias name FullName
   */
  public String getFullName()
  {
    return super.getFullName();
  }
  /**Sets value as the attribute value for FullName
   */
  public void setFullName(String value)
  {
    super.setFullName(value);
  }
  /**Gets the attribute value for EmailAddress, using the alias name EmailAddress
   */
  public String getEmailAddress()
  {
    return super.getEmailAddress();
  }
  /**Sets value as the attribute value for EmailAddress
   */
  public void setEmailAddress(String value)
  {
    super.setEmailAddress(value);
  }
  /**Gets the attribute value for ManagerId, using the alias name ManagerId
   */
  public Number getManagerId()
  {
    return super.getManagerId();
  }
  /**Sets value as the attribute value for ManagerId
   */
  public void setManagerId(Number value)
  {
    super.setManagerId(value);
  }
  /**Gets the attribute value for PositionCode, using the alias name PositionCode
   */
  public String getPositionCode()
  {
    return super.getPositionCode();
  }
  /**Sets value as the attribute value for PositionCode
   */
  public void setPositionCode(String value)
  {
    super.setPositionCode(value);
  }
  /**Gets the attribute value for Salary, using the alias name Salary
   */
  public Number getSalary()
  {
    return super.getSalary();
  }
  /**Sets value as the attribute value for Salary
   */
  public void setSalary(Number value)
  {
    super.setSalary(value);
  }
  /**Gets the attribute value for StartDate, using the alias name StartDate
   */
  public Date getStartDate()
  {
    return super.getStartDate();
  }
  /**Sets value as the attribute value for StartDate
   */
  public void setStartDate(Date value)
  {
    super.setStartDate(value);
  }
  /**Gets the attribute value for EndDate, using the alias name EndDate
   */
  public Date getEndDate()
  {
    return super.getEndDate();
  }
  /**Sets value as the attribute value for EndDate
   */
  public void setEndDate(Date value)
  {
    super.setEndDate(value);
  }
  /**Gets the attribute value for LastUpdateDate, using the alias name LastUpdateDate
   */
  public Date getLastUpdateDate()
  {
    return super.getLastUpdateDate();
  }
  /**Sets value as the attribute value for LastUpdateDate
   */
  public void setLastUpdateDate(Date value)
  {
    super.setLastUpdateDate(value);
  }
  /**Gets the attribute value for LastUpdatedBy, using the alias name LastUpdatedBy
   */
  public Number getLastUpdatedBy()
  {
    return super.getLastUpdatedBy();
  }
  /**Sets value as the attribute value for LastUpdatedBy
   */
  public void setLastUpdatedBy(Number value)
  {
    super.setLastUpdatedBy(value);
  }
  /**Gets the attribute value for CreationDate, using the alias name CreationDate
   */
  public Date getCreationDate()
  {
    return super.getCreationDate();
  }
  /**Sets value as the attribute value for CreationDate
   */
  public void setCreationDate(Date value)
  {
    super.setCreationDate(value);
  }
  /**Gets the attribute value for CreatedBy, using the alias name CreatedBy
   */
  public Number getCreatedBy()
  {
    return super.getCreatedBy();
  }
  /**Sets value as the attribute value for CreatedBy
   */
  public void setCreatedBy(Number value)
  {
    super.setCreatedBy(value);
  }
  /**Gets the attribute value for LastUpdateLogin, using the alias name LastUpdateLogin
   */
  public Number getLastUpdateLogin()
  {
    return super.getLastUpdateLogin();
  }
  /**Sets value as the attribute value for LastUpdateLogin
   */
  public void setLastUpdateLogin(Number value)
  {
    super.setLastUpdateLogin(value);
  }
  /**Gets the attribute value for AttributeCategory, using the alias name AttributeCategory
   */
  public String getAttributeCategory()
  {
    return super.getAttributeCategory();
  }
  /**Sets value as the attribute value for AttributeCategory
   */
  public void setAttributeCategory(String value)
  {
    super.setAttributeCategory(value);
  }
  /**Gets the attribute value for Attribute1, using the alias name Attribute1
   */
  public String getAttribute1()
  {
    return super.getAttribute1();
  }
  /**Sets value as the attribute value for Attribute1
   */
  public void setAttribute1(String value)
  {
    super.setAttribute1(value);
  }
  /**Gets the attribute value for Attribute2, using the alias name Attribute2
   */
  public String getAttribute2()
  {
    return super.getAttribute2();
  }
  /**Sets value as the attribute value for Attribute2
   */
  public void setAttribute2(String value)
  {
    super.setAttribute2(value);
  }
  /**Gets the attribute value for Attribute3, using the alias name Attribute3
   */
  public String getAttribute3()
  {
    return super.getAttribute3();
  }
  /**Sets value as the attribute value for Attribute3
   */
  public void setAttribute3(String value)
  {
    super.setAttribute3(value);
  }
  /**Gets the attribute value for Attribute4, using the alias name Attribute4
   */
  public String getAttribute4()
  {
    return super.getAttribute4();
  }
  /**Sets value as the attribute value for Attribute4
   */
  public void setAttribute4(String value)
  {
    super.setAttribute4(value);
  }
  /**Gets the attribute value for Attribute5, using the alias name Attribute5
   */
  public String getAttribute5()
  {
    return super.getAttribute5();
  }
  /**Sets value as the attribute value for Attribute5
   */
  public void setAttribute5(String value)
  {
    super.setAttribute5(value);
  }
  /**Gets the attribute value for Attribute6, using the alias name Attribute6
   */
  public String getAttribute6()
  {
    return super.getAttribute6();
  }
  /**Sets value as the attribute value for Attribute6
   */
  public void setAttribute6(String value)
  {
    super.setAttribute6(value);
  }
  /**Gets the attribute value for Attribute7, using the alias name Attribute7
   */
  public String getAttribute7()
  {
    return super.getAttribute7();
  }
  /**Sets value as the attribute value for Attribute7
   */
  public void setAttribute7(String value)
  {
    super.setAttribute7(value);
  }
  /**Gets the attribute value for Attribute8, using the alias name Attribute8
   */
  public String getAttribute8()
  {
    return super.getAttribute8();
  }
  /**Sets value as the attribute value for Attribute8
   */
  public void setAttribute8(String value)
  {
    super.setAttribute8(value);
  }
  /**Gets the attribute value for Attribute9, using the alias name Attribute9
   */
  public String getAttribute9()
  {
    return super.getAttribute9();
  }
  /**Sets value as the attribute value for Attribute9
   */
  public void setAttribute9(String value)
  {
    super.setAttribute9(value);
  }
  /**Gets the attribute value for Attribute10, using the alias name Attribute10
   */
  public String getAttribute10()
  {
    return super.getAttribute10();
  }
  /**Sets value as the attribute value for Attribute10
   */
  public void setAttribute10(String value)
  {
    super.setAttribute10(value);
  }
  /**Gets the attribute value for Attribute11, using the alias name Attribute11
   */
  public String getAttribute11()
  {
    return super.getAttribute11();
  }
  /**Sets value as the attribute value for Attribute11
   */
  public void setAttribute11(String value)
  {
    super.setAttribute11(value);
  }
  /**Gets the attribute value for Attribute12, using the alias name Attribute12
   */
  public String getAttribute12()
  {
    return super.getAttribute12();
  }
  /**Sets value as the attribute value for Attribute12
   */
  public void setAttribute12(String value)
  {
    super.setAttribute12(value);
  }
  /**Gets the attribute value for Attribute13, using the alias name Attribute13
   */
  public String getAttribute13()
  {
    return super.getAttribute13();
  }
  /**Sets value as the attribute value for Attribute13
   */
  public void setAttribute13(String value)
  {
    super.setAttribute13(value);
  }
  /**Gets the attribute value for Attribute14, using the alias name Attribute14
   */
  public String getAttribute14()
  {
    return super.getAttribute14();
  }
  /**Sets value as the attribute value for Attribute14
   */
  public void setAttribute14(String value)
  {
    super.setAttribute14(value);
  }
  /**Gets the attribute value for Attribute15, using the alias name Attribute15
   */
  public String getAttribute15()
  {
    return super.getAttribute15();
  }
  /**Sets value as the attribute value for Attribute15
   */
  public void setAttribute15(String value)
  {
    super.setAttribute15(value);
  }
  /**Gets the attribute value for RowID, using the alias name RowID
   */
  public RowID getRowID()
  {
    return (RowID)getAttributeInternal(ROWID);
  }
  /**getAttrInvokeAccessor: generated method. Do not modify.
   */
  protected Object getAttrInvokeAccessor(int index,
                                         AttributeDefImpl attrDef) throws Exception
  {
    if (index == ATTRIBUTE1)
    {
      return getAttribute1();
    }
    if (index == ATTRIBUTE10)
    {
      return getAttribute10();
    }
    if (index == ATTRIBUTE11)
    {
      return getAttribute11();
    }
    if (index == ATTRIBUTE12)
    {
      return getAttribute12();
    }
    if (index == ATTRIBUTE13)
    {
      return getAttribute13();
    }
    if (index == ATTRIBUTE14)
    {
      return getAttribute14();
    }
    if (index == ATTRIBUTE15)
    {
      return getAttribute15();
    }
    if (index == ATTRIBUTE2)
    {
      return getAttribute2();
    }
    if (index == ATTRIBUTE3)
    {
      return getAttribute3();
    }
    if (index == ATTRIBUTE4)
    {
      return getAttribute4();
    }
    if (index == ATTRIBUTE5)
    {
      return getAttribute5();
    }
    if (index == ATTRIBUTE6)
    {
      return getAttribute6();
    }
    if (index == ATTRIBUTE7)
    {
      return getAttribute7();
    }
    if (index == ATTRIBUTE8)
    {
      return getAttribute8();
    }
    if (index == ATTRIBUTE9)
    {
      return getAttribute9();
    }
    if (index == ATTRIBUTECATEGORY)
    {
      return getAttributeCategory();
    }
    if (index == CREATEDBY)
    {
      return getCreatedBy();
    }
    if (index == CREATIONDATE)
    {
      return getCreationDate();
    }
    if (index == EMAILADDRESS)
    {
      return getEmailAddress();
    }
    if (index == EMPLOYEEID)
    {
      return getEmployeeId();
    }
    if (index == ENDDATE)
    {
      return getEndDate();
    }
    if (index == FIRSTNAME)
    {
      return getFirstName();
    }
    if (index == FULLNAME)
    {
      return getFullName();
    }
    if (index == LASTNAME)
    {
      return getLastName();
    }
    if (index == LASTUPDATEDBY)
    {
      return getLastUpdatedBy();
    }
    if (index == LASTUPDATEDATE)
    {
      return getLastUpdateDate();
    }
    if (index == LASTUPDATELOGIN)
    {
      return getLastUpdateLogin();
    }
    if (index == MANAGERID)
    {
      return getManagerId();
    }
    if (index == MIDDLENAMES)
    {
      return getMiddleNames();
    }
    if (index == POSITIONCODE)
    {
      return getPositionCode();
    }
    if (index == ROWID)
    {
      return getRowID();
    }
    if (index == SALARY)
    {
      return getSalary();
    }
    if (index == STARTDATE)
    {
      return getStartDate();
    }
    if (index == TITLE)
    {
      return getTitle();
    }
    return super.getAttrInvokeAccessor(index, attrDef);
  }
  /**setAttrInvokeAccessor: generated method. Do not modify.
   */
  protected void setAttrInvokeAccessor(int index, Object value,
                                       AttributeDefImpl attrDef) throws Exception
  {
    if (index == ATTRIBUTE1)
    {
      setAttribute1((String)value);
      return;
    }
    if (index == ATTRIBUTE10)
    {
      setAttribute10((String)value);
      return;
    }
    if (index == ATTRIBUTE11)
    {
      setAttribute11((String)value);
      return;
    }
    if (index == ATTRIBUTE12)
    {
      setAttribute12((String)value);
      return;
    }
    if (index == ATTRIBUTE13)
    {
      setAttribute13((String)value);
      return;
    }
    if (index == ATTRIBUTE14)
    {
      setAttribute14((String)value);
      return;
    }
    if (index == ATTRIBUTE15)
    {
      setAttribute15((String)value);
      return;
    }
    if (index == ATTRIBUTE2)
    {
      setAttribute2((String)value);
      return;
    }
    if (index == ATTRIBUTE3)
    {
      setAttribute3((String)value);
      return;
    }
    if (index == ATTRIBUTE4)
    {
      setAttribute4((String)value);
      return;
    }
    if (index == ATTRIBUTE5)
    {
      setAttribute5((String)value);
      return;
    }
    if (index == ATTRIBUTE6)
    {
      setAttribute6((String)value);
      return;
    }
    if (index == ATTRIBUTE7)
    {
      setAttribute7((String)value);
      return;
    }
    if (index == ATTRIBUTE8)
    {
      setAttribute8((String)value);
      return;
    }
    if (index == ATTRIBUTE9)
    {
      setAttribute9((String)value);
      return;
    }
    if (index == ATTRIBUTECATEGORY)
    {
      setAttributeCategory((String)value);
      return;
    }
    if (index == CREATEDBY)
    {
      setCreatedBy((Number)value);
      return;
    }
    if (index == CREATIONDATE)
    {
      setCreationDate((Date)value);
      return;
    }
    if (index == EMAILADDRESS)
    {
      setEmailAddress((String)value);
      return;
    }
    if (index == EMPLOYEEID)
    {
      setEmployeeId((Number)value);
      return;
    }
    if (index == ENDDATE)
    {
      setEndDate((Date)value);
      return;
    }
    if (index == FIRSTNAME)
    {
      setFirstName((String)value);
      return;
    }
    if (index == FULLNAME)
    {
      setFullName((String)value);
      return;
    }
    if (index == LASTNAME)
    {
      setLastName((String)value);
      return;
    }
    if (index == LASTUPDATEDBY)
    {
      setLastUpdatedBy((Number)value);
      return;
    }
    if (index == LASTUPDATEDATE)
    {
      setLastUpdateDate((Date)value);
      return;
    }
    if (index == LASTUPDATELOGIN)
    {
      setLastUpdateLogin((Number)value);
      return;
    }
    if (index == MANAGERID)
    {
      setManagerId((Number)value);
      return;
    }
    if (index == MIDDLENAMES)
    {
      setMiddleNames((String)value);
      return;
    }
    if (index == POSITIONCODE)
    {
      setPositionCode((String)value);
      return;
    }
    if (index == SALARY)
    {
      setSalary((Number)value);
      return;
    }
    if (index == STARTDATE)
    {
      setStartDate((Date)value);
      return;
    }
    if (index == TITLE)
    {
      setTitle((String)value);
      return;
    }
    super.setAttrInvokeAccessor(index, value, attrDef);
    return;
  }
}
[/sql]
 
Step 5: Rebuild the code, after successfully rebuilding the code goto, Tools -> Project Properties. Extract Business Components and then select Substitutions. Substitute Old and New Entity Objects, for example see the below image:
EO substituitions in EO extension process
Rebuild the code and then rebuild the entire project.
 
Step 6: Move the project file into the server.
Go to MyClasses folder in JDeveloper patch move the XXEOExtensionPRJ file into the server Java top.
After moving the project file, note that we need to move even JPX file, generally JPX file for the project is available in the same folder.
For example move the JPX file from the MyClasses folder to the EOExtensionPRJ directory in server.
After moving the project file and jpx files, run the import script.
java oracle.jrad.tools.xml.importer.JPXImporter $JAVA_TOP/xxeoextension/XXEOExtensionPRJ.jpx -username apps -password apps -dbconnection "(description = (address_list = (address = (community = tcp.world)(protocol = tcp)(host = www.newtonapples.com/old)(port = 1521)))(connect_data = (service_name = newton)))"
 
Step 7: Bounce the server or clear the Cache in Function Administrator responsibility. Sometimes even if you clear cache it will not workout. So therefore, if that the case then you must bounce the server.
Finally select the Create Employee button, so that you can see for the Email Address the default value as “training@newtonapples.com/old”.
You can see the changed Entity Object name in About This Page.
 
The below image shows the sample output.
Final output in EO extension
Finally we finished sample EO Extension process in OAF.

No comments:

Post a Comment