Showing posts with label OAF. Show all posts
Showing posts with label OAF. Show all posts

Tuesday, September 26, 2017

How to make OAF Controller Changes reflect without Application Bounce

How to make OAF Controller Changes reflect without Application Bounce


Often, when working with OAF customizations, we usually need to change the java code frequently and test in server, which requires application tier or apache bounce. Bouncing the application tier frequently effects multiple users and slows down the pages performance. In order to overcome this, if changes only involve controller changes, developer can follow below procedure(before that one needs to understand that controller code is cached using the Controller Class Name).

  1. Whenever you want to modify existing controller class code(say, ControllerA), create a new Controller Class(ControllerB) which is exactly as a copy of ControllerA.
  2. Make desired changes in ControllerB code.
  3. Mention ControllerB as controller using personalization.
  4. See the changes reflected on the page
  5. Note: Once ControllerB class name is registered with server, second change to this class will not be reflected unless server is bounced.
  6. To summarize, use different controller names for each change.




Monday, June 19, 2017

Embedding Custom Region into Standard OAF Page

Embedding Custom Region into Standard OAF Page

In this article, we shall see how to insert custom OAF region into standard page using personalization.

Make sure that you enable following profile options for enabling the “Personalization” link on OAF page
1.       Personalize Self-Service Defn” to “Yes”
2.       FND: Personalization Region Link Enabled” for displaying region level personalization links

Create an item on standard page by clicking on “Personalize” link for ex:- “Personalize Stack Layout” as shown in below screenshot:-





Click on “Create Item” icon as shown in below screenshot:-



Enter details for “Create Item” as follows:-

Level
Site
Item Style
Stack Layout
ID
Unique Id for ex:- customRegion
Extends
Custom region path for ex:- /xxcust/oracle/apps/per/irc/webui/MyCustomRN

Same is shown in below screenshot:-


Monday, March 6, 2017

OAF - Dynamically adding view attribute, Dynamically creating view object


In this article, we shall see code snippets in OAF, on
1.       How to dynamically add view attribute to existing VO
2.       How to create view object dynamically and get values by executing the query

How to dynamically add view attribute to existing VO

Following code can be used for dynamically adding new view attribute to existing standard VO

OAViewObject stdVO = (OAViewObject)am.findViewObject("OracleStdVO");
        if (stdVO != null) {
            try {
                String transientAttr =
                    stdVO.findAttributeDef("AdditionalInfo").toString();
            } catch (Exception e) {
                 stdVO.addDynamicAttribute("AdditionalInfo");
  pageContext.writeDiagnostics(this,"<<<Added dynamic transient  attribute>>>",OAFwkConstants.STATEMENT);
            }
               }

How to dynamically create query based view object

String requisitionLineId = 123;              // Need to pull up dynamically
String requisitionHeaderId = 234;           // Need to pull dynamically
       
// Create view object(only if doesnot exist) for getting ATTRIBUTE11 from PO_REQUISITION_LINES_ALL table
oracle.jbo.server.ViewObjectImpl customVO = (ViewObjectImpl)am.findViewObject("POReqVO");
if(customVO==null){
                pageContext.writeDiagnostics(this,"<<<Inside customVO is null>>>",OAFwkConstants.STATEMENT);
                // Define query.
                 String retnSqlStr = "select ATTRIBUTE11 from  PO_REQUISITION_LINES_ALL WHERE REQUISITION_LINE_ID =:1 AND REQUISITION_HEADER_ID = :2";
                customVO = (ViewObjectImpl)am.createViewObjectFromQueryStmt("POReqVO", retnSqlStr);
}
String attribute11  = null;
pageContext.writeDiagnostics(this,"<<<Created customVO>>>"+customVO,OAFwkConstants.STATEMENT);
customVO.setWhereClause(null);
customVO.setWhereClauseParams(null);
// Execute Query for this Requisition line
customVO.setWhereClauseParam(0,requisitionLineId);
customVO.setWhereClauseParam(1,requisitionHeaderId);
customVO.executeQuery();

int rowCnt = customVO.getRowCount();
pageContext.writeDiagnostics(this,"<<<Executed Retention Query RowCount = >>>"+rowCnt,OAFwkConstants.STATEMENT);
customVO.setRangeSize(rowCnt);
Row retnRows[] = customVO.getAllRowsInRange(); //there will be only one row but will loop

// Get  value after query execution
for(Row retnRow:retnRows){
                attribute11  = (String)retnRow.getAttribute(0);
                pageContext.writeDiagnostics(this,"<<<Inside retention query row loop retention = >>>"+retention,OAFwkConstants.STATEMENT);

}