Search This Blog

Wednesday, August 4, 2010

Tips to refine ADF code.

Tips to refine ADF code for better performance.

1. Page definition actions to be removed rather execute the VO in the backing bean.

2. Refresh condition for the iterators to be set to false in the Page definition. Make it to true in the backing bean only when that iterator is executed.

3. Get the AM instance from the VO rather than using createRootApplicationModule() method.

4. Use generic method for iterator execution.

5. Remove unnecessary bindings from pagedef, backing bean.

Samples to follow...


Sunday, March 14, 2010

OAF - Create VO on FLY.

String s = "select parameter_id from ap_expense_report_params_all erp where erp.expense_type_code = :1";

ViewObject viewobject = getDBTransaction().createViewObjectFromQueryStmt(s); viewobject.setWhereClauseParam(0, "ROUNDING");

viewobject.executeQuery();

OAViewRowImpl row = (OAViewRowImpl)viewobject.first();

if(row == null)

mRoundingParameterId = null;

else

mRoundingParameterId = (Number)row.getAttribute(0);

viewobject.remove();

OAF - How to add a new VO into a existing AM

If you have only to add a column to a VO you don't need to extend the AM.
To do this, you must create a new VO (e.g. XXReqSupplierVO) which extends the standard VO (e.g. ReqSupplierVO) substitute the standard VO with your new VO.


1. Right click on ur project file (xxx.jdr)


2. Edit Business Components Project...


3.Substitutions, Select the standard VO in the left panel and your VO in the right panel then click on Add Button


4. import the substitution on the server (running jpximport utility on your xxx.jpx file)


5. Bounce the OC4J(Apache) server


6. Ur new item on ReqSupplierLovRN page must refer to standard VO name (ReqSupplierVO), not to the personalized one. As you have imported the substitution on the server, at runtime when you refer to ReqSupplierVO the system, instead, use the extended GECMReqSupplierVO, so you can use your new column.
You don't have to create a new AM.My problem was different, because I needed to create a completely new VO, not to extend and existing one, so I had to add a new VO to the AM and that is why I would extend it.As it's not actually possibile I had to create a new page and to use directly my AM instead of the standard one. But this is not your case, I think.
In order to import them you have to right click on your project name and to choose "Import Business Components". Then you must select the server.xml file that you should find in the same directory (oracle.apps.icx.por.schema.server).


Monday, March 8, 2010

OAF - Remove Personalizations

ACTION PLAN===========
1. Login to application

2. Select Responsibility Functional Administrator

3. Click Personalization Tab ( Upper Right)

4. For Application , Enter the following: Self-Service Web Applications

5. Click on the Personalized Checkbox

6. Click Go

7. Remove or De-activate your personalization by selecting the personalization level at which you made a particular persanolization

Check the following tables before and after removing the Personalizations.
1. JDR_COMPONENTS

2. JDR_ATTRIBUTES

3. JDR_ATTRIBUTES_TRANS

4. JDR_PATHS

OAF - Submit a OAF Page using javascript

OAF code using OAScriptBean
OAPageButtonBarBean oapagebuttonbarbean = (OAPageButtonBarBean)webBean.findChildRecursive("PageButtons");


OASubmitButtonBean oasubmitbuttonbean = (OASubmitButtonBean)oapagebuttonbarbean.findChildRecursive"GenerateSignature");


oasubmitbuttonbean.setOnClick("javascript:return test();");



This function is written in the JavaScript file which was included as follows
OAWebBeanFactory oawebbeanfactory = pageContext.getWebBeanFactory();


OAScriptBean oascriptbean = (OAScriptBean)oawebbeanfactory.createWebBean(pageContext, "SCRIPT_BEAN");


oascriptbean.setSource("/OA_HTML/GenerateSignature.js");


webBean.addIndexedChild(oascriptbean);
The above code is written in Controller.


In the JavaScript function generate value and submit the page as below..
document.DefaultFormName.submit();


OAF - Best way to extend VO

If you cannot extend any existing VO then the best way is to create a stacklayout and place your items inside it using jdeveloper, create an AM and VO which you can wire up with the item. Use personalization to add a stackLayout and extend the stacklayout which you had created using jdeveloper. You can add a region using personalization only from 11.5.10 CU2.

OAF - Table Events

Table events are HTTP requests that are trapped and processed by OA Framework and handled during the processFormRequest phase.
EVENT_PARAM - indicates the event generated by a web bean (a table, in this case).


The possible events generated by a table are:


GOTO_EVENT - when 'Next' or 'Previous' navigation links are selected


SORT_EVENT - when a column header is selected to sort that column


HIDE_EVENT - when the 'Hide' link of a detail disclosure is selected


SHOW_EVENT - when the 'Show' link of a detail disclosure is selected


ADD_ROWS_EVENT - when the 'Add Another Row' button is selected


UPDATE_EVENT - when the total row 'Recalculate' button is selected


VALUE_PARAM - indicates a value that is relevant to a particular event: When a detail disclosure Hide/Show is selected, the value parameter contains the row index corresponding to the row whose Hide/Show was selected. When the 'Next' or 'Previous' link of table navigation bar is selected, the value parameter contains the index of the first row of the current range. For example, when the row range 1-10 is displayed, the value is 1 and when the row range 11-20 is displayed, the value is


SIZE_PARAM - indicates the number of rows currently displayed in the table (relevant only to the navigation event).


STATE_PARAM - indicates the current sort state (ascending or descending) of the column on which sorting is invoked (relevant only for the sort event).


Courtesy : Oracle OAF documentation.

OAF - Switch Apps responsibility in OAF.

OADBTransaction oadbtransaction = ((OAApplicationModule)getApplicationModule()).getOADBTransaction();String rspId = String.valueof(oadbtransaction.getResponsibilityId);

OAF - Hiding a Function/Page based on responsibility

Hiding based on responsibility
Best way to implement your Business logic is functional security.
1. Create a new function (no parameters and URL), say XX_SEC_FUNC


2. Attach it to the menu that is used in your responsibility.
In the page, just enter ${oa.FunctionSecurity.BENEFITS_GUEST} in the Rendered property.



Now Go to -> System administrator -> Security -> Responsibility


1. to hide the text exclude the function(XX_SEC_FUNC) in the responsibility.


2. to show it delete the function(XX_SEC_FUNC) from the exclusion list.
this is very flexible and can be configured easily. No code modification needed.And if you want to extend the functionality to multiple responsibilities, then it can be easily done

OAF - Enable Personalization

Followings Profile Options need to be enabled to perform Personalizations
FND : Personalization region/WYSIWYG link enable : Y
FND: Personalization Region Link Enabled : Y
Personalize Self-Service Defn :Y