OA Framework Extension of Application Module
| Print |
Written by Anil Passi
Friday, 12 January 2007
Extending AM is similar to extending a View Object or an Entity Object. But some of the steps are slightly different. Hence I would like to dedicate an article on Extending AM.
What is an Application Module in OA Framework?
Think of AM as a broker between your Client Activity and database activity. It also manages the state of database transaction.
Is extension of AM recommended by Oracle?
Not really, simple because doing so isn't upgrade safe.
But sometimes you are left with no choice, and also it is better to extend that customize.
Which example will I undertake to extend an Application Module?
In this instance, lets take an example of an iRecruitment Functionality.
iRecruitment [IRC] is a web facing application from Oracle. Let's say, that we wish to capture a record in some custom table when a invalid Logon attempt occurs on iRecruitment Login page. The validation for User Logon occurs in a class named VisitorAMImpl.class
This class can be found in $JAVA_TOP/oracle/apps/per/irc/candidateSelfService/server
If you decompile this class using jad, you will notice the below code
public String validateLogin(String s, String s1)
String s2 = null;
OracleCallableStatement oraclecallablestatement = null;
String s3 = "begin :1 := fnd_web_sec.validate_login( p_user => :2 ,p_pwd => :3 ); commit; end; ";
OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getDBTransaction();
oraclecallablestatement = (OracleCallableStatement)oadbtransactionimpl.createCallableStatement(s3, 1);
We need to add extra logic, such that, if fnd_web_sec.validate_login returns N, then we either insert record into another table or raise a business event.
Note:- The new logic can be appended to the method of the parent class [as it is, without modifying original code, by using super.method() convention].
So we need to extend and substitute VisitorAMImpl.class?
Well, we can't substitute AM Implementation class, so we will need to substitute VisitorAM itself.
In the extend AM, do we need to write code for each and every method of AM Implementation class being extended?
Not really. You need to write the code for just that method for which you wish to incorporate new/additional logic.
What are the steps in brief, for doing so?
Step 1 [Optional].
Get a jad utility. This can be downloaded free. Just search on java decompiler jad. This will help you example the standard Oracle code.
Step 2. FTP all the files from $JAVA_TOP/oracle/apps/per/* to your PC and configure your PC for OA Framework development
Step 3. Create a new BC4J package in which the extension will reside.
Step 4. Note down the path and the properties of existing AM that we wish to extend
Step 5. Create a new AM, and specify the original AM being extended.
Step 6. Ensure that the properties of original AM are applicable for new AM too.
Step 7. Perform substitution. This will create a jpx file.
Step 8. Upload the jpx file into Database.
Step 9. Deploy the custom BC4J to $JAVA_TOP by FTP'ing all files.
In the Part-2[link here] of this article, I will provide steps with screenshots, to explain how Application Module can be extended in OA Framework.