Showing posts with label Controller class. Show all posts
Showing posts with label Controller class. Show all posts

Wednesday, September 29, 2010

HideShowHeader bean and the setDefaultDisclosed property

Today's exercise will focus on one and only one property available to you in JDeveloper. This property is called the "setDefaultDisclosed" property and it controls whether a HideShowHeader region is expanded or collapsed. When you setup a pageLayout and associated regions this is set declaratively. That is, you set a property which controls how it is displayed on the page and you never worry about it again. The users have free regin to toggle it all they want.

However, suppose Oracle provides a HideShowHeaderRN on a page that is closed by default and you would like this to be expanded by default. If you struggle to think of an example of this, I've taken the liberty of providing one from Self Service Human Resources. Complete any of the Manager Self Service functions and hit the Review page. The list of approvers will be listed at the bottom of the page (if you configured AME correctly) and you have the option of adding an Ad Hoc approver:



As you can see it defaults to the collapsed state. Suppose you would like to auto-expand this when the page loads. Here is the expanded state that you'd like to see by default:


In the interest of time, we're going to skip the fundamentals on how to extend a Controller .class (CO) file in Oracle Applications. End-to-end steps on how to perform a CO extension be found in the following articles:

Controller class extension in 11.5.10
Controller class extension in R12

For our purposes, it is enough to know that programmatically setting a property on a web bean inside Oracle Applications occurs inside a Controller .class. We'll still need to know which of the COs to extend, so start by clicking the "About this Page" link in the lower left corner of the page. If you don't have that, set the profile option FND: Diagnostics for your user, clear the cache and then rejoin us. Be sure to click "Expand All" when you get to the page:



Scroll down until you see the Approval region. We'll start with the ApprovalsCO file:


To see where this file is stored in Oracle, expand the Business Component References Details hide/show item:


The complete path is oracle.apps.ame.dynamicapprovals.webui.ApprovalsCO:


This will be important as we will be importing and then extending this delivered code inside JDeveloper.

We will do the following:
  1. Import the page with the approvals section into JDeveloper
  2. Set a new controller class for the Region that extends the delivered CO
  3. set the setDefaultDisclosed property of the HideShowHeader region
Download the page definition of from the database using jdr_utils.printDocument. You'll want to start with the Review page that all SSHR transactions use and repeat the procedure until you get to the approvals section:


set feedback off
set serveroutput on format wrapped
set linesize 100
spool hack.lst
--
execute jdr_utils.printDocument('/oracle/apps/per/selfservice/review/webui/ReviewPG',100);
--
spool off


After studying the output from the above command, notice the /oracle/apps/ame/dynamicapprovals/webui/ApproversRN:


Re-run the jdr_utils.printDocument command and save the output in C:\jdevoafr12\myprojects\oracle\apps\ame\dynamicapprovals\webui\ApproversRN.xml where jdevoafr12 is the home where you installed JDeveloper for R12.

Inside JDeveloper, File -> Import -> Java Source to import the page definition. Once it appears, click it, then drop down into the structure and highlight the area region where you'd like to assign a new Controller. Naturally, I will use the prefix "hack" for my package: hack.oracle.apps.ame.dynamicapprovals.webui and hackApprovalsCO for the file name:


Here is the extended Controller .class file with comments inline:


/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package hack.oracle.apps.ame.dynamicapprovals.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 the delivered Controller
import oracle.apps.ame.dynamicapprovals.webui.ApprovalsCO;
// import the HideShowHeader bean...
import oracle.apps.fnd.framework.webui.beans.layout.OAHideShowHeaderBean;

/**
* Controller for ...
*/
// make sure you extend the delivered CO...
public class hackApprovalsCO extends ApprovalsCO
{
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)
{
// this line tells Oracle to run the default code, place your updates after it...
super.processRequest(pageContext, webBean);
pageContext.writeDiagnostics(this,"hackApprovalsCO - 10",3);
//
// instench-e-ate the HideShowHeader bean...
//
OAHideShowHeaderBean oaHideShowHeader = (OAHideShowHeaderBean)webBean.findIndexedChildRecursive("AdhocApproversShowHideRN");
//
// expand it...
//
oaHideShowHeader.setDefaultDisclosed(pageContext, Boolean.TRUE);
//
pageContext.writeDiagnostics(this,"hackApprovalsCO - 90",3);
}

/**
* 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);
}
}


  1. Make
  2. Compile
  3. Save
  4. .zip
  5. FTP
  6. unzip
  7. personalize
  8. Apouncy batch

After you've compiled and saved your works, .zip up the directory and FTP it to $JAVA_TOP. Unzip it and then get into the application to point at your new Java file. Login to Manager Self Service and start a "Change Hours" transaction, hitting the review page and then clicking Personalize Page in the upper right-hand corner:


Click the Complete View radio button so you can find the item you need to edit:



Scroll down until you find this one:


Set the value of the Controller .class field to the following string. I happen to do this at the Responsibility level so that my hacking doesn't disrupt the work of others in the system:

hack.oracle.apps.ame.dynamicapprovals.webui.hackApprovalsCO


Click Apply and you'll be back on the Review page. In my case I had to pounce abatchy (bounce Apache) in order for this to take effect so wait 20 seconds if you have access to do this. You'll have to wait at least 4 hours if you need an overseas DBA to do it for you:

$ADMIN_SCRIPTS_HOME/adapcctl.sh stop
$ADMIN_SCRIPTS_HOME/adapcctl.sh start
$ADMIN_SCRIPTS_HOME/adoacorectl.sh stop
sleep 10
$ADMIN_SCRIPTS_HOME/adoacorectl.sh start

For added emphasis, enable Diagnostics before reviewing your handiwork by performing the following:




Now start a new transaction, striking the review page with great fervor. The HideShowHeader bean is expanded when the processRequest method is fired (when the page loads):



Scroll down deep into the diagnostics and find the debug messages you wrote to output:



And that is how to auto-expand a HideShowHeader bean in Oracle Applications using JDeveloper.

Wednesday, March 4, 2009

Controller class extension using JavaScript

Our example today takes us to the HR Effective Date page inside Self Service. The goal is to default a field on a page. While this is old news using a standard CO extension, achieving it using JavaScript is a lesser known alternative. To ensure the application isn't hacked to pieces while testing this, a custom repsonsibility, menu and function have been created to limit collateral damage:

(N) Hack Manager Self-Service -> Hack Change Pay



Choose employee -> Action



A reasonable request would be to alter the Effective Date field to a default value on this page:



As noted, this can easily be accomplished using a Controller .class (CO) extension. However, this page and it's corresponding Java code seems to be unique in that it doesn't respect the supported method of extending the CO, finding the Effective Date field's handle and assigning it a default value. After much hacking and cursing, it was discovered that JavaScript can be used to default the value of the field. The JavaScript will be written inside of the CO and a Java method will be used to load it into Oracle's script tags.

A cursory inspection of the "About this Page" shows which CO code is responsible for the Effective Date section of the page:





The EffectiveDateCO is the Controller .class to be extended. The field that needs to be defaulted is called HrEffectiveDate. There are two ways to ascertain this:

  1. Examine the delivered CO code found in oracle.apps.pqh.selfservice.common.webui.EffectiveDateCO
  2. Examine the page definition stored in the "JDR" database tables

Here is the decompiled version of oracle.apps.pqh.selfservice.common.webui.EffectiveDateCO:



At the top of the "About this Page" is the name of the document: /oracle/apps/pqh/selfservice/common/webui/EffectiveDatePG, the layout of which is stored in a group of database tables prefixed with "JDR":



This layout can be retrieved from the database using the following SQL*Plus script:



set feedback off
set serveroutput on format wrapped
set linesize 100
spool hack.lst
--
execute jdr_utils.printDocument('/oracle/apps/pqh/selfservice/common/webui/EffectiveDatePG',100);
--
spool off





Again, take note of the HrEffectiveDate field. Since JavaScript will be the solution to this exercise, you can also do a View Source on the actual web page and search for the field's ID. This technique may cause blindness, so proceed at your own risk. Here is a glimpse of the HTML source code:



The ultimate goal of this exercise is to get our JavaScript code embedded into that tangled mess. Like recent CO extension topics, this one will focus on the coding necessary to achieve the result. For a complete guide to CO extensions, see the previous topics:

  1. R12 Controller Class extension
  2. Controller class extension in Oracle Applications

In order to implement this, we need to do the following:

  1. extend the delivered controller class with our own
  2. FTP this file to the $JAVA_TOP on the middle tier
  3. Personalize the page to execute our controller class instead of the delivered one

There are three lines of code necessary for defaulting the date field:



OABodyBean bodyBean = (OABodyBean) pageContext.getRootWebBean();
String javaS = "return document.getElementById(\"HrEffectiveDate\").value=\"31-Oct-2009\"";
bodyBean.setOnLoad(javaS);



In keeping with tradition, we'll use a hard-coded value to simply hack the date to something arbitrary. If you are so inclined, you can choose a date based on logic by calling a PL/SQL procedure or a SQL function. For now...lettuce use a static date as shown above.

The complete extended CO is shown here:


/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package hack.oracle.apps.pqh.selfservice.common.webui;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
// import delivered CO to extend
import oracle.apps.pqh.selfservice.common.webui.EffectiveDateCO;
// import this for the JavaScript
import oracle.apps.fnd.framework.webui.beans.OABodyBean;

/**
* Controller for ...
*/
// extend the delivered CO
public class hackEffectiveDateCO extends EffectiveDateCO
{
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);
// embed the JavaScript "onLoad" event...
OABodyBean bodyBean = (OABodyBean) pageContext.getRootWebBean();
String javaS = "return document.getElementById(\"HrEffectiveDate\").value=\"31-Oct-2009\"";
bodyBean.setOnLoad(javaS);
}

/**
* 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);
}
}


Once the code is deployed to the middle tier, bounce Apache. Then browse to the page and personalize the Controller Class property to point at the new CO:

(N) Manager Self-Service -> Hack Change Pay -> Click "Personalize Page" in the upper right corner:





Replace Inherit with hack.oracle.apps.pqh.selfservice.common.webui.hackEffectiveDateCO



Return to the application and note the defaulted date:



View Source and note that your JavaScript code has been embedded into the onLoad event in the page:

Friday, November 14, 2008

Default/setRequired DFF Segments in R12

Defaulting the value of a Descriptive Flexfield's Context or Segment values on an OA Framework page comes up frequently. It is possible to achieve this functionality using a Controller Class (CO) extension in JDeveloper R12. This example will focus on the code necessary to default the values using a CO extension. Note that setting a DFF segment to required in the Controller is different from setting up a DFF segment as required when it is configured. When a segment is set to required in the application, it is required on all responsibilities throughout the app. Using the custom code approach allows you to mark specific segments required only when necessary. For a complete discussion of Controller Class concepts and examples, see the previous topics:

  1. R12 Controller Class extension
  2. Controller class extension in Oracle Applications

Lettuce first setup a Descriptive Flexfield with some segments before rendering it on the Self Service page. If you already know how to do this and are just anxious to see the few lines of code to reach the solution, scroll down in this post until you find it. For our example we will use the "Change Pay:

Pay Details" page in Manager Self Service and the "Add'l Salary Admin. Details" Descriptive Flexfield attached to it. Navigate as follows:

(N) System Administrator -> Application -> Flexfield -> Descriptive -> Segments

Search for "Add'l Salary Admin. Details" and do the following:

  1. Uncheck "Freeze Flexfield Definition"
  2. Highlight "Global Data Elements"
  3. Add a Context called 'Oracle Hack' for the Code and Name
  4. Click the Segments button



Uncheck the Required Checkbox:


Save the DFF, Freeze Flexfield Definition and exit.

The first step to defaulting a DFF value on a Self Service page is to enable it. Browse to Manager Self Service -> Change Pay:


Choose an employee and click Action:


Click Propose Pay Change. On the "Change Pay: Pay Details" page, the DFF is now rendered under the Additional Details section:



Choosing the "Oracle Hack" Context then displays the one segment defined for it:




The goal of this exercise is to default the context as well as the segment value when the page loads. In order to do this, a Controller Class extension will need to be created that finds the DFF field and defaults the appropriate values. A cursory review of the "About this Page" link will show which CO's are already defined and where they are stored on the middle tier.


An extension to the oracle.apps.per.selfservice.changepay.webui.ProposedPayCO Controller Class will be performed in order to accomplish the defaulting:


The remaining steps to perform the defaulting are as follows:

  1. Download the page definition of /oracle/apps/per/selfservice/changepay/webui/ProposeNewPayPG from the database using jdr_utils.printDocument
  2. Import the page into JDeveloper
  3. Set a new controller class for the page that extends the default CO oracle.apps.per.selfservice.changepay.webui.ProposedPayCO
  4. write custom code to find and default the DFF fields

As mentioned earlier, the detailed instructions for steps 1-3 are explained in previous posts. The code in step 4 is presented here:


/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package hack.oracle.apps.per.selfservice.changepay.webui;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OADescriptiveFlexBean;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageTextInputBean;
// import the delivered CO
import oracle.apps.per.selfservice.changepay.webui.ProposedPayCO;

/**
* Controller for ...
*/
public class hackProposedPayCO extends ProposedPayCO
{
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);
// first, find the flexfield's handle
OADescriptiveFlexBean oaDFF = (OADescriptiveFlexBean)webBean.findIndexedChildRecursive("FlexField1");
// default the Attribute Category (DFF context)
oaDFF.setFlexContext(pageContext,"Oracle Hack");
oaDFF.processFlex(pageContext);
// now set the attribute/segment value
OAMessageTextInputBean txtHackBonus = (OAMessageTextInputBean)oaDFF.findIndexedChild("FlexField11");
txtHackBonus.setText("43500");
}
/**
* 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);
}

}


Once you are done coding, do a "Make" and "Rebuild" of the file and transfer it to $JAVA_TOP on the middle tier. Browse to the "Change Pay: Pay Details" page in Manager Self Service and personalize it to point at your new Controller:




Set the value of the new Controller to: hack.oracle.apps.per.selfservice.changepay.webui.hackProposedPayCO

Return to the Application and marvel at your handiwork:


For extra credit and part II of this topic, you can set the DFF segment to Required in the CO as well. Here is the code; note that the "yes" text is case-sensitive:



In 11.5.10, this seemed to not be possible, at least not in my experience hacking at it. Note that setting a DFF segment to required in the Controller is different from setting up a DFF segment as required when it is configured. When a segment is set to required in the application, it is required on all responsibilities throughout the app. Using the custom code approach allows you to mark specific segments required only when necessary.

Thursday, October 16, 2008

R12 Controller Class extension

Today's topic will cover how to perform a Controller class extension in the buggy, unstable product known as JDeveloper 10g, for use with Oracle Applications Release 12. The delay in posts is due partially to the fact that the documentation for JDeveloper 10g is actually for the 9i product. That's right, Oracle shipped documentation for Jdeveloper 10g that includes screen prints and instructions for an older product with a different user interface. Hence, all information presented on this page is a result of random and sometimes brutal hacking.

The example used to show that a Controller class extension *is* actually possible in R12 will be defaulting a MessageLoVInputBean within the New Hire process in Self Service Human Resources. For more information about what a Controller class is view the topic "Controller class extension in Oracle Applications".

First, log in to Oracle Applications to see where this defaulting will take place:

(N) Manager Self-Service -> Hire



Proceed to step 3 and notice that Oracle provides the Setup Business Group for the default Department/Organization name:



Click "About this Page" link in lower left corner to begin the process of finding the field name to default. Click "Expand All":



Then search for the Department; notice that the Controller class is called OrganizationCO:



Click Business Component Reference Details to get the complete path where the OrganizationCO is stored on the application tier:




Lettuce begin extending this file so that the Department name field is set to null. Open JDeveloper R12 on your client machine. This tutorial assumes you have already downloaded the client from Oracle and unzipped it to a root directory like

C:\JDEVOAR12. Also, set the Windows environment variable JDEV_USER_HOME:

Right-click My Computer -> Properties -> Advanced (tab) -> Environment Variables (button) -> JDEV_USER_HOME -> edit

Set the value to C:\JDEVOAFR12\jdevhome\jdev if "C:\JDEVOAFR12\" is where you unzipped JDeveloper R12.

Inside of JDeveloper, create a new Workspace by doing the following:

(N) File -> New and then choosing General -> Projects -> Workspace Configured for Oracle Applications




Enter an arbitrary value in the File Name dialog box to identify the kind of workspace this will be. I'll be hacking, so naturally mine is called 'hack.jws':



For a default project package, change the delivered names to a custom name.

oracle.apps.per.selfservice.deployperson.webui.OrganizationCO will be extended so our default package for the extended files will be hack.oracle.apps.per.selfservice.deployperson.webui:



Choose a .dbc file for the connection. If one is not already configured, follow these steps:

1. Browse to http://instance_name.domain.com:port_number/OA_HTML/jsp/fnd/aoljtest.jsp
2. Complete the information and click Test
3. Click "Enter AOL/J Setup Test"
4. Click "Locate DBC file"
5. Copy/paste the resulting DBC file and save it as hack.dbc to C:\JDEVOAFR12\jdevbin\oaext\dbc_files\secure







In order to extend the delivered Controller class and have your project work correctly, you will need to import the delivered

Controller class into your project. Each file in Oracle apps has many dependencies; rather than import one at a time, I download the entire JAVA_TOP to my local machine. Connect to the middle tier and do the following:

1. cd $JAVA_TOP
2. tar -cvf java_top.tar oracle
3. FTP the .tar file to C:\JDEVOAFR12\jdevhome\jdev\myclasses
4. extract the .tar file

Note that the above procedure could take a long time to complete as the $JAVA_TOP can be over 1GB. Now that the files are in place, connect to the database and run the following script:



set feedback off
set serveroutput on format wrapped
set linesize 100
spool hack.lst
--
execute jdr_utils.printDocument('/oracle/apps/per/selfservice/deployperson/webui/AssignmentPG',100);
--
spool off


This will spool the AssignmentPG page to a flat file, which can be saved and imported into JDeveloper:



Place it in C:\JDEVOAFR12\jdevhome\jdev\myhtml\OA_HTML. Now import the file into JDeveloper by doing File -> Import:



Even though it is not a Java file, you must choose "Java Source" (makes perfect sense):



Browse for C:\JDEVOAFR12\jdevhome\jdev\myhtml\OA_HTML



Deselect all and then check AssignmentPG and click OK. You will see the Page populate in the "Application Sources". Click on the Page and you will see the Structure populate in the "Structure" pane:




Right Click the HROrganizationRegion which has the HrDepartment field that will be updated and click "Set New Controller..."



Enter a package name identical to the delivered package but with your custom project name in front of it. For example, mine is: hack.oracle.apps.per.selfservice.deployperson.webui. The Controller class filename will follow the same standard: hackOrganizationCO



Note that this is an extended controller class that is not specific to the OrganizationCO:



You must import the delivered CO and extend that one; additionally, import the OAMessageLoVInputBean class for the field that will be defaulted:



The following code will default the Department Name field to null if it is equal to the value "Setup Business Group". The processRequest method has the code that performs this default. This is the code that is executed when a user hits the page. processFormRequest is called when the user submits the page to move on to the next one. Notice that the defaulting code is to occur when the page is first rendered. Also, the "super.processRequest(pageContext, webBean);" line tells Oracle to execute the delivered code and then fires the code inside processRequest.



/*===========================================================================+
| Copyright (c) 2001, 2005 Oracle Corporation, Redwood Shores, CA, USA |
| All rights reserved. |
+===========================================================================+
| HISTORY |
+===========================================================================*/
package hack.oracle.apps.per.selfservice.deployperson.webui;

import oracle.apps.fnd.common.VersionInfo;
import oracle.apps.fnd.framework.webui.OAPageContext;
import oracle.apps.fnd.framework.webui.beans.OAWebBean;
import oracle.apps.fnd.framework.webui.beans.message.OAMessageLovInputBean;
import oracle.apps.per.selfservice.deployperson.webui.OrganizationCO;

/**
* Controller for ...
*/
public class hackOrganizationCO extends OrganizationCO
{
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);
pageContext.writeDiagnostics(this,"Here2",3);
/*
* find the HrDepartment bean programatically
*/
OAMessageLovInputBean oaMessage = (OAMessageLovInputBean)webBean.findIndexedChildRecursive("HrDepartment");
/*
* if the value is not null...
*/
if (oaMessage.getValue(pageContext) != null) {
// get the value currently in the text box
String strDepartment = oaMessage.getValue(pageContext).toString();
pageContext.writeDiagnostics(this, "strDepartment: " + strDepartment, 3);
// If it's equal to the Setup Business Group...
if (strDepartment.equals("Setup Business Group")){
pageContext.writeDiagnostics(this, "Here10", 3);
// set it equal to null
oaMessage.setValue(pageContext,null);
}
}
//
pageContext.writeDiagnostics(this, "Here20", 3);
}

/**
* 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);
}

}



Now that the code is written, right-click the CO file and do a "Make" and then a "Rebuild". This creates the compiled .class files that will be transferred to the middle tier for execution inside Oracle Applications.



Go to C:\JDEVOAFR12\jdevhome\jdev\myclasses and find the folder called 'hack'. Right-click and create a .zip file. Follow these instructions to deploy it to the application tier:

1. FTP hack.zip to $JAVA_TOP
2. unzip hack.zip



Now browse to the page where this Controller .class code needs to be executed.

(N) Manager Self-Service -> Hire -> Step 3 -> Personalize Page



Click on Complete View then Expand All (link):



Find the Department Default Single Column and click the Pencil:



Set the Controller Class field to hack.oracle.apps.per.selfservice.deployperson.webui.hackOrganizationCO. Click Apply and then

"Return to Application" link.




This is Oracle so don't expect your changes to show up just yet. In R12, in addition to bouncing Apache, you must also bounce the OC4J process. Technology has advanced to the point that changes to the application require two laborious steps. You need to perform the following commands on the middle tier first:

1. $ADMIN_SCRIPTS_HOME/adapcctl.sh stop
2. $ADMIN_SCRIPTS_HOME/adapcctl.sh start

3. $ADMIN_SCRIPTS_HOME/adoacorectl.sh stop
4. sleep 10
5. $ADMIN_SCRIPTS_HOME/adoacorectl.sh start

Once these steps are complete, close your Browser and log back in to the application. In order to show that our code is being executed we will enable Diagnostics and check that our pageContext.writeDiagnostic messages are being written to output.

In order to enable diagnostics, click Diagnostics in the upper right hand corner. If this link is not present, set the profile option FND: Diagnostics to "Yes":



Show log on screen; click "Go":



Choose Event as the messages written out to diagnostics in the Controller class used a code of "3" for event. Going further down to Statement level will write more and more output to screen:



Now you've got mad junk written on the screen.



Go to the Hire process, step 3 and confirm that the Department field is null and that the output messages are written to the diagnostics dump at the bottom of the page:




Your code will also show up on the "About this Page" link. Score! Rah rah!