Friday, June 29, 2012

Personalization and Creating Custom DFF in OAF

Scenario: To capture additional candidate details in iRecruitment Candidate Page.


Approach: Created a custom DFF and integrated/add the DFF in a new region of Candidate Page.
 This DFF is created on a custom table (xx_per_candidate_attr) as above which has personID and Attribute1 to Attribute30 as columns.



Custom OAF Region Code to enable the DFF:

Create a VO for the custom table(xx_per_candidate_attr) and name it as xx_per_candidate_attrVO.




In CO:


public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);


OAApplicationModule am = pageContext.getApplicationModule(webBean);


Number person_id= (Number)pageContext.getRootApplicationModule().invokeMethod("getCachedPersonId");


Serializable[] personParam = { person_id.toString() };
am.invokeMethod("initQuery",personParam);
}






In AM:
Create a method as below in AM which is called from CO

public void initQuery(String person_id)
{
Row hrow;


xx_per_candidate_attrVOImpl vo=get xx_per_candidate_attrVO1();
vo.setWhereClauseParams(null);
vo.setWhereClauseParam(0,person_id);

if(!vo.isPreparedForExecution())


{ vo. executeQuery(); }
hrow=vo.createRow();
vo.insertRow(hrow);
hrow.setNewRowState(Row.STATUS_INITIALIZED);
}


Custom XML Region:
Create an item of type FLEX and enter the below details

Item Id : candidateDFF
Item Type : FLEX
Name : XX_PER_CANDIDATE
Prompt: Country Details
ViewName: XX_PER_CANDIDATE_ATTRVO1
APPLICATION : PER

When you open your RN XML file you will find the details as below,



To make the DFF read only we have to set the readonly flag as true , when done you will see the xml as below,







For Readonly mode of DFF we have to follow the below coding:

In AM:
public void initQuery(String person_id)

{
Row hrow;


XXApplicantDetailsVOImpl vo=getXXApplicantDetailsVO1();
vo.setWhereClauseParams(null);
vo.setWhereClauseParam(0,person_id);

if(!vo.isPreparedForExecution())
{
vo. executeQuery();
}


hrow=vo.first();


if( hrow != null )
{
vo.insertRow(hrow);
hrow.setNewRowState(Row.STATUS_INITIALIZED);
}else
{
hrow=vo.createRow();
vo.insertRow(hrow);
hrow.setNewRowState(Row.STATUS_INITIALIZED);
}
}


Personalization : Through personalization we have to add this region in the corresponding page.


1 comment:

  1. Thank you for sharing this valuable information.Oracle OAF Online Training and save it to some flat file and may directly upload the same, in another example, to an identical page.

    ReplyDelete