Oa Framework

7
OA FRAMEWORK The OA Framework Tutorial delivered by Oracle is very good. Hence you may decide to ignore this article. The only reason I am writing this is based upon the requests that I received. OA Framework will continue to remain a formidable tool in Release12. Although Fusion is destined to use ADF, its methodology will be similar to OA Framework. Although you will need to re-write your OAF extensions in Oracle Fusion, but the OAF concepts can be carried forward to Oracle Fusion Applications. Hence I insist you all invest time to learnOA Framework. What are the pre-requisites for learning OA Framework? 1. You need to have an Oracle Apps 11i or higher environment to play around with. 2. Basic knowledge of java is needed. Rather I would say basic knowledge of OOP [Object Oriented Programming] is needed. I mean just the concepts. 3. Basics of XML, which can be learnt within an hour from w3schools link 4. Understand MVC as a concept[not in depths as you are just getting started]. Step 1. Which version of jDeveloper to use? DO NOT use jDeveloper 10g version in Oracle Apps[holds true until 11.5.10]. Oracle Applications tech stack may not always keep up in pace with Standalone Oracle. Run the below SQL in apps schema select 'Download patch 4573517' from ad_bugs where bug_number = '4125550' ; If this returns a record, then download patch 4573517 Otherwise run, select 'Download patch 4141787' from ad_bugs where bug_number = ‘4017300' ; If both the above SQL’s do not return a record, then download patch 4045639[assuming you are on 11i] Step 2. Unzip the downloaded patch file on your local drive. This will contain jDeveloper and FND libraries. Step 3. Create a database connection and ensure it works by clicking on Test button. Step 4. Follow the instructions for in file jdevdoc/WebHelp/fwkdevguide.htm This will be available underneath the jdevdoc directory. You can also use the Help Menu in jDeveloper to access this page. Step 5. In Tools menu, select preferences, “Embedded OC4J”, try to use "Default Local IP Address" option.

description

OAF

Transcript of Oa Framework

Page 1: Oa Framework

OA FRAMEWORK

The OA Framework Tutorial delivered by Oracle is very good. Hence you may decide to ignore this article. The only reason I am writing this is based upon the requests that I received.

OA Framework will continue to remain a formidable tool in Release12. Although Fusion is destined to use ADF, its methodology will be similar to OA Framework. Although you will need to re-write your OAF extensions in Oracle Fusion, but the OAF concepts can be carried forward to Oracle Fusion Applications. Hence I insist you all invest time to learnOA Framework.

What are the pre-requisites for learning OA Framework?1. You need to have an Oracle Apps 11i or higher environment to play around with.2. Basic knowledge of java is needed. Rather I would say basic knowledge of OOP [Object Oriented Programming] is needed. I mean just the concepts.3. Basics of XML, which can be learnt within an hour from w3schools link 4. Understand MVC as a concept[not in depths as you are just getting started].

Step 1. Which version of jDeveloper to use?DO NOT use jDeveloper 10g version in Oracle Apps[holds true until 11.5.10]. Oracle Applications tech stack may not always keep up in pace with Standalone Oracle.

Run the below SQL in apps schemaselect 'Download patch 4573517' from ad_bugs where bug_number = '4125550' ;If this returns a record, then download patch 4573517

Otherwise run,select 'Download patch 4141787' from ad_bugs where bug_number = ‘4017300' ;

If both the above SQL’s do not return a record, then download patch 4045639[assuming you are on 11i]

Step 2. Unzip the downloaded patch file on your local drive. This will contain jDeveloper and FND libraries.

Step 3. Create a database connection and ensure it works by clicking on Test button.

Step 4. Follow the instructions for in file jdevdoc/WebHelp/fwkdevguide.htmThis will be available underneath the jdevdoc directory. You can also use the Help Menu in jDeveloper to access this page.

Step 5. In Tools menu, select preferences, “Embedded OC4J”, try to use "Default Local IP Address" option.

Step 6. You will see toolbox.jws. Expand that, and Right click on Tutorial.jpr. This step is not necessary, however I suggest you do this to sanity check your environment.Ensure that you get no errors [Warnings are OK though]

Page 2: Oa Framework

Step 7. I suggest you run the HelloWorld to ensure that your runtime environment has been configured. This is underneath oracle.apps.fnd.framework.toolbox.tutorial.server

http://oracle.anilpassi.com/apps-technology/15.html very important link

MDS in OA Framework -What exactly it is? | Print |

 E-mai

l Written by Anil Passi    Sunday, 25 March 2007

We know it means MetaData Service. We also know that it has something to do with web page displayed in OA Framework. Lets try to understand the basics of  MDS.

Meta:- In technical world, meta work symbolizes dictionary. Think of a web page broken into small units which are fields, buttons, list boxes. These small individual units[fields, buttons etc] are stored in a dictionary, in the database. These units when combined together, they become a webpage that gets rendered on the browser.

Data:- Those meta pieces are not stored as binary files, but as data in tables. Those tables begin with jdr, for example JDR_ATTRIBUTES, JDR_ATTRIBUTES_TRANS, JDR_COMPONENTS & JDR_PATHS. The definition and relationship of each field/region/component is stored in these JDR tables. OA framework reads that data when you request a page. The page structure is then built based on MetaData.

Service:- Meta Data is available as a service(plain service not webservice). The data is there in JDR tables, but all such data has to be co-related, all fields, regions,buttons etc have to be clubbed into a meaningful manner to make a web page. You can say that MDS provides service to store & return page definitions. MDS collates those definitions in components/fields in a meaningful manner to build a

Page 3: Oa Framework

page.

In jDeveloper, when I build a page and its regions, it looks I am building an XML file. Is page definition stored as XML file in OA Framework?The storage page definition happens in JDR tables, where page components are not stored as XML. But MDS provides API's to build XML definition from the data in JDR tables.  Hence there are two provisions1. When you design a page, you store "page definiton" in XML format on your pc. When deploying to your system/server, you load this XML file into JDR tables by using command xmlimporter(see this link for example of XML Importer).2. When a user runs the page, OA Framework does the following steps:-Step a. OA Fwk Requests page definition/structure from (MDS) --note its cached tooStep b. MDS engine returns a xml file to OA FrameworkStep c. Each node/component in XML(of Step b) is translated into a web bean object. Let's say your page has    Region-Main         field1         Regionchild                 Button

In this case, four web beans objects will be instantiated by OA Framework. A bean object is nothing but an object representation components like fields, buttons, regions etc. A bean object also has methods like setRendered, setRequired, getRequired etc.Step d. Not only we have beans created for that page, those beans are nested as well, in exactly the same sequence of components within Region-Main. Hence parent child relationship is retained.Step e. After rendering the page,OA Framework then calls the controller class for that MDS page. The page is displayed to user after processRequest in Controller is completed.

Page 4: Oa Framework

Fine the web page is rendered by OA Framework, but what happens next?Before we answer the question, lets take a step backwards.Lets recollect how we defined that page. In OA Framework, when you define a page, there are two key things that you do:-    1. Specify/define a controller class for that page.    2. Specify/define an application module attached to that page.Keeping that in mind, we can now answer this question. When the page gets rendered/displayed on browser, then following things happen    A. Framework builds a web bean hierarchy[based on XML from MDS] to represent the structure of the page in memory    B. An object instance of ApplicationModule is created. You may recollect that application module manages the database state of the page.    C. A method named processRequest in controller class is executed.

What parameters are passed to method processRequest of the controller?OAPageContextOAWebBean

What are the usages of OAPageContext parameters?The main usages are:-1. To get and set values of the fields, using oapagecontext.getParameter and oapagecontext.putParameter2. For redirecting to the current page or another page. For example to redirecting to current page itself use oapagecontext.forwardImmediatelyToCurrentPage. Or you may use oapagecontext.sendRedirect(snewpage)

Page 5: Oa Framework

3. To get a handle to application module(remember we attached AM to page)  oapagecontext.getRootApplicationModule()4. Write debug messages, using oapagecontext.writeDiagnostics5. Get message text from FND Message dictionary, using oapagecontext.getMessage

What are the usages of parameter OAWebBean?Remember that webbean represents the hierarchy/structure of components in the page. Hence using this paremeter object, you can get a handle to any bean/component in that page hierarchy. Once you have a handle to that bean(say field bean or button bean), you can then invoke methods like setRendered etc to change the behaviour of page at runtime.Some examples are1. OAWebBean LastName = oawebbean.findIndexedChildRecursive("personLastName");Note: In this example, our page must have just one field whose name is personLastName2. Get a handle to region OAStackLayoutBean oastacklayoutbean = (OAStackLayoutBean)oawebbean.findIndexedChildRecursive("stackRegionName");3. As seen above, the generic bean object returned by findIndexedChildRecursive can be typcasted to corresponding bean object.

So the page gets rendered/display after the processRequest finishes its execution?Correct, the processRequest finishes and then the page renders.

Does this mean I can programatically create new bean components  and render those on a page at runtime using controller?Absolutely, you can literally add any component to the page at runtime. For example, using oawebbean.addIndexedChild(oawebbean1);However but I suggest you shouldn't follow this approach.  If you wish to display fields conditionally, then you can include those into MDS, and turn their rendering off in controller or use SPEL.Note: you can also create any additional bean for a page using "Create/Add New Item" feature of personalization. This is the prefered approach when adding display components to any standard Oracle OA Framework page.

I have nested regions in page, and each region is attached to its own controller. Will processRequest in each controller fire when page gets rendered?Absolutely, the controllers of inner regions fire first and then outer/higher level regions. This is a very common practice, when you include shared regions into your main page, whereby each shared region may have its own controller.

Is the MDS page definition cached?

Page 6: Oa Framework

Yes, hence any changes that you make to MDS in database, you then need to bounce the mid-tier.This is not applicable if you are testing the pages from jDev itself. jDev will first look at local XML files[local MDS]. If the page file is not found on your local PC, then Fwk gets the page definition from MDS in database.

When I do personalization, where is the personalization metadata stored?This too is stored in the database in MDS, but the path of that document is prefixed by customizations.For example if you personalize oracle/apps/per/irc/candidateSearch/webui/empSearchPG at site level, then its corresponding customized document will be in oracle/apps/per/irc/candidateSearch/webui/customizations/site/0/empSearchPG

Are personalizations in MDS cached too? and need mid-tier bounce?Not really, the MDS personalization layer are applied at runtime to the page, and hence mid-tier bounce is not required when you modify personalizations.

Where are the MDS files kept on File System?Although MDS for runtime is loaded into the Database, but the MDS definitions can also be found by navigating to $MODULE_TOP/mds.

Sometimes the OA Framework form function reference AK Region. Is AK still being used?AK is the MDS of old methodology, whereby regions and items were stored in tables namely AK_REGIONS and AK_REGION_ITEMS. The old pages[jsp or xml or pl/sql based] used to reference the AK regions. Hence the old form function definitions are pointing to AK Region names. During migration from AK to OA Framework, each such region was mapped with OA Framework page. Those mappings are stored in $MODULE_TOP/mds/regionMap.xml

Is regionMap.xml read from the file server when a form function is invoked?Not really, its loaded using xmlImporter just like any other OA Page.

How to I identify those modules for  which migration from AK to OA Framework took place?You will notice that all those applications that have profile option "FND: Migrated To JRAD" set to Yes [at application level]

The java files are in $JAVA_TOP/oracle/apps/per

The MDS file, is in $PER_TOP/mds/...