My First Requirement in OAF Seeded page


Issue in OAF page.

There was a Requirement in OAF page and the requirement is to query the results in Page automatically when the user opens the page and to add 200 rows for insertion.

The page Navigation is
Maintenance Super User, Vision Operations -> Assets Tab -> Mass Meter Readings

Issue – 1

Requirement: As client wants to enter the Meter reading data in a bulk . It takes time to manually query it, add it. So he needs to display the Results of meters as well as inserting 200 empty rows at a stretch in page for data entry.

The page looks like this in the below picture

1.

The Requirement is that we have to populate the record when the page gets displayed.

Logic for Solution

Query the VO when page gets Executed on page loading(On process Request)
Adding 200 rows on the add row button event.

Problem Solution

Creating a Extending the Seeded controller where in this case the controller is EamMassCtrReadingsCO and we have to handle the Add Row button event.

public class xxCounterReadingCO27 extends CounterReadingCO //Extending Oracle Controller
{

public xxCounterReadingCO27()
{
}

public void processRequest(OAPageContext pageContext, OAWebBean webBean)
{
super.processRequest(pageContext, webBean);
pageContext.writeDiagnostics(this, “Code Gets Executed”, 4);   //Works like SOP in the Oracle base page. Refer NOTE-2
OAApplicationModule am = pageContext.getApplicationModule(webBean);
OAViewObject vo1 = (OAViewObject)am.findViewObject(“CounterReadingContextVO”);
OAViewObject vo = (OAViewObject)am.findViewObject(“CounterReadingVO”);
CounterReadingVOImpl counterreadingvoimpl = (CounterReadingVOImpl)am.findViewObject(“CounterReadingVO”);
counterreadingvoimpl.setWhereClauseParam(0, “-1”); //setting Param as it was set
counterreadingvoimpl.setWhereClauseParam(1, “-1”);
counterreadingvoimpl.executeQuery(); //This statement is the magic where Query gets executed
Enumeration e = webBean.getChildNames();
webBean.getIndexedChild(1).toString();
pageContext.writeDiagnostics(this, “test 11111111111111111111111111”, 4);
for(int i = 0; i < webBean.getIndexedChildCount(); i++) { pageContext.writeDiagnostics(this, “test 2222222222222222222222”, 4); pageContext.writeDiagnostics(this, webBean.getIndexedChild(i).toString(), 4); } for(; e.hasMoreElements(); pageContext.writeDiagnostics(this, (new StringBuilder()).append(e.nextElement()).append(“Values of Child Associated”).toString(), 4)) { } OAAdvancedTableBean table = (OAAdvancedTableBean)webBean.findChildRecursive(“counterTableRN”); } public void processFormRequest(OAPageContext pageContext, OAWebBean webBean) { super.processFormRequest(pageContext, webBean); OAApplicationModule am = pageContext.getApplicationModule(webBean); OAViewObject vo = (OAViewObject)am.findViewObject(“CounterReadingVO”); OAViewObject vo1 = (OAViewObject)am.findViewObject(“CounterReadingContextVO”); pageContext.writeDiagnostics(this, “Code Gets Executed”, 4); pageContext.writeDiagnostics(this, (new StringBuilder()).append(“EVENT_PARAM————->”).append(pageContext.getParameter(“event”)).toString(), 4);
pageContext.writeDiagnostics(this, (new StringBuilder()).append(“SOURCE_PARAM————->”).append(pageContext.getParameter(“source”)).toString(), 4);
if(“addRows”.equals(pageContext.getParameter(“event”)) && ((OAAdvancedTableBean)webBean).getName().equals(pageContext.getParameter(“source”)))
{
pageContext.writeDiagnostics(this, (new StringBuilder()).append(“Message on clicking Button”).append(pageContext.getParameter(“event”)).append(((OAAdvancedTableBean)webBean).getName()).append(“Hence the Details”).toString(), 4);
for(int i = 0; i < 200; i++) //logic to display the row count for 200 { OARow oarow = (OARow)vo.createRow(); OARow oarow1 = (OARow)vo1.first(); if(oarow1 != null) { Object obj = oarow1.getAttribute(“MaintOrgId”); pageContext.writeDiagnostics(this, (new StringBuilder()).append(oarow1.getAttribute(“MaintOrgId”)).append(“Am”).toString(), 4); if(obj != null) { oarow.setAttribute(“MaintOrganizationId”, obj.toString()); } } vo.insertRow(oarow); } } } }

NOTE-1 : On Extending Controller you have to note the page path and the controller path of oracle seeded page. Instead of replacing the controller and Bouncing the server we can rename the controller and change the controller path in the page.

NOTE-2 : Click the menu Diagnostics(Which will be in the top of the page near Home ) which opens a page and change the dropdown to Show Log on Screen At the Time of changing you will have log level which has to set to Exception. pageContext.writeDiagnostics(this, “Code Gets Executed”, 4); Why we change the log level is that in the above code we have mentioned the level as 4 which is Exception. Short Desc: Diagnostics -> Show Log on Screen -> Exception(4)

About pacesettergraam

A good and realistic person

Posted on November 12, 2013, in OAF and tagged , , , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: