Daily Archives: October 16, 2020

Dynamic Train Region Handling in OAF

I got the codepack from my colleague and I will replacing him in the project. Then I got this requirement to show Train Region with 3 pages and for another one 2 pages. Initially it was three train pages for two individual pages. When I checked the code both the pages were same and they were dynamically populating the regions based on registered function.

Logical Page Structure

Current Setup(From User side)
Page-A TrainPG-1 TrainPG-2 TrainPG-3
Page B TrainPG-1 TrainPG-2 TrainPG-3

Requirement Given(From User side)
Page-A TrainPG-1 TrainPG-2 TrainPG-3
Page-B TrainPG-1 TrainPG-2

Current Setup(Actual Underlying Code)
Page-A TrainPG-1 TrainPG-2 TrainPG-3
Page-A TrainPG-1 TrainPG-2 TrainPG-3

Requirement Given(Actual Underlying Code)
Page-A TrainPG-1 TrainPG-2 TrainPG-3
Page-A TrainPG-1 TrainPG-2

With the given requirement I need to dynamically change the Train Page and footer regions for the pages that they have selected.

Approach – 1

First I have tried to create 2 regions one for Page-A Function-1 and next for Page-A Function-2. Here I tried to dynamically enable the region using SPEL. This approach worked for Train Region but did not work for Footer.

Approach -2 – Limitation -1

Now I tried to have only one region but disable the TrainPG-3 link in Train Region. The same I have tried for Footer Region. Here there were some Issues. Problem was the submit button was properly working for Page-A Function-1 but not working for Page-A Function-2.

Approach -2 – Limitation -2

To overcome the above limitation, I tried to take the Disable button by taking the bean. But I was not able to get the bean.

So to overcome the above limitation I have wrote logic based on page and function to restrict the button. Now I was able to accomplish the requirement given.

Below is the sample code which is a part of this requirement.

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
iSupplierUpdateAMImpl isupplierupdateamimpl = (iSupplierUpdateAMImpl) pageContext.getRootApplicationModule();
OAViewObject ttvo = (OAViewObject)isupplierupdateamimpl.findViewObject("TransientTrainVO");
isupplierupdateamimpl.createRow(ttvo,null,null);
String OAFunction = pageContext.getSessionValue("SOAFunc").toString();
if ("xx_ISUPPLIER_UPDATE_GEN".equalsIgnoreCase(OAFunction)){ //Function Restriction
ttvo.getCurrentRow().setAttribute("HideContactRegion",Boolean.TRUE);
ttvo.getCurrentRow().setAttribute("ShowHideNextButton",Boolean.FALSE);
OAPageButtonBarBean trainfooterRN = (OAPageButtonBarBean)webBean.findChildRecursive("TrainFooterRN");
OAButtonBean pgButton = (OAButtonBean)webBean.findChildRecursive("submitBTN");
// pgButton.setText("Nothing to Submit"); // Not working getting Error
}
else{
ttvo.getCurrentRow().setAttribute("HideContactRegion",Boolean.FALSE);
if(pageContext.getParameter("page").equals("/xx/oracle/apps/pos/isupplier/webui/XXaddressPG")) //Page Restriction
{
ttvo.getCurrentRow().setAttribute("ShowHideNextButton",Boolean.TRUE);
}
else
{
ttvo.getCurrentRow().setAttribute("ShowHideNextButton",Boolean.FALSE);
}
}
}

I welcome your Suggestions

Design a site like this with WordPress.com
Get started