What is MDS In the OAF framework? What is OAPageContext & OAWebBean ?, Oafoapagecontext
Address: http://oracle.anilpassi.com/mds-in-oa-framework-what-exactly-it-is-2.html
We know that "MDS" is the abbreviation of "MetaData Service". We also know that MDS has a certain relationship with page display in the OAF framework. Let's take a look at the basic knowledge of MDS.
Meta: in the technical field, meta indicates "Dictionary ". imagine a Web page is broken down into many small units (cells, buttons, option boxes ...). these small units are stored in a dictionary (table) in the database. when these units are combined, the web page is displayed in the browser.
Data: The Dictionary Fragments (meta pieces) are not stored as binary files, but stored in database tables. the prefixes of these tables are "jdr", such as JDR_ATTRIBUTES, JDR_ATTRIBUTES_TRANS, JDR_COMPONENTS, and JDR_PATHS. the definitions and relationships of all fields/regions/components (field/region/component) are stored in these JDR tables. when you request a page, the OAF framework will read the data from the database. the structure of the page is reconstructed from these MetaData.
Service: MetaData can be used as a Service. all data exists in the JDR table, but all the data must be reconnected. All fields, regions, and buttons must form a page in a meaningful way. therefore, it can be said that MDS provides a service to store/reconstruct web pages. the MDS service re-combines fragmented page components into meaningful pages.
In jDeveloper, when we are creating a page and area, it seems that we are creating an XML file. In the OAF framework, is the page definition saved using an XML file?
In fact, the page definition is stored in the JDR table and is not stored in XML files. However, MDS provides an API interface to convert JDR table data into XML descriptive files.
Therefore, there are two forms:
1. when designing a page, we save the page definition in XML format in the file system. when we deploy the server/system, we need to import these XML files to the JDR table. the OAF framework provides the import tool:
For example, use the following command to import RcvBarCodeLovRN. xml to the database.
C:\Oracle\p9879989\jdevbin\oaext\bin\import C:\Oracle\p17888411\jdevhome\jdev\myprojects\oracle\apps\po\rcv\lov\webui\RcvBarCodeLovRN.xml -rootdir C:\Oracle\p17888411\jdevhome\jdev\myprojects -username apps -password apps -dbconnection erik-lnx.oracle.com:1522:VID
select * from JDR_COMPONENTS where comp_id = 'SecTxnQtyColRN';
2. When the user wants to display a page, the OAF framework does the following:
Step 1. The OAF framework defines the request to the MDS page, which will be cached (the first time the page is opened, it will be slow and will be faster in the future ).
Step 2. The MDS engine returns an XML file to the OAF framework
Step 3. Each node/component (mode/component) in the XML file will be converted into a webBean object.
For example, there is a page with the following structure:
Region-Main
Field1
Region-Child
Button
In this example, the OAF framework will instantiate four webBean objects. Each object represents a component (field/button/region ...). each webBean object has some methods, such as setRendered (), setRequired (), getRequired (), and so on.
Step 4. these webBean objects are not only created one by one, but also nested between them. The nesting order is the same as that when the page is defined. therefore, the parent-child relationship of the page component is retained.
Step 5. After the page is ready, the OAF framework will call the controller (CO. class) of the MDS page. After the processRequest () method in CO is executed, you can see the page.
So far, OAF has displayed the web page. What will happen below?
Before answering this question, let's review the previous steps. let's review how to define this page. in OAF, when we define a page, there are two key steps:
1. Define a CO/controller for page
2. Define an AM/application module and attach it to this page.
When a page is displayed in a browser, the following occurs:
A. The framework will establish a webBean hierarchy based on the XML file provided by the MDS in the memory to represent the page structure.
B. Create an ApplicationModule object. We can re-obtain this AM object to manage the database status of the page.
C. CO processRequest () method execution.
What parameters will be passed when the processRequest () method is executed?
OAPageContext
OAWebBean
What is the purpose of the OAPageContext parameter?
1. Use oaPageContext. getParameter () and oaPageContext. putParameter () to set the value of field.
2. Redirect the page to the current page or another page. For example, oaPageContext. forwardImmediatelyToCurrentPage () is redirected to the current page, and oaPageContext. sendRedirect (newPage) is redirected to another page.
3. Get AM: oaPageContext. getRootApplicationModule () Because AM has been attached to the page.
4. Write the debug information: oaPageContext. writeDiagnostics ().
5. Get the information from the FND message dictionary: oaPageContext. getMessage ().
What are the functions of OA webbean parameters?
We know that the webBean object represents the structure/hierarchy in the page. therefore, we can use this parameter to operate all the components in the page structure. once we obtain the component object (field bean or button bean), we can use setRendered () and other methods to change the page behavior during runtime.
For example:
1. OAWebBean lastName = oaWebBean. findIndexedChildRecursive ("personLastName ");
2. Get the object of a region: OAStackLayoutBean oaStackLayoutBean = (OAStackLayoutBean) oaWebBean. findIndexedChildRecursive ("stackRegionName ");
3. As shown in the preceding two points, the objects returned by the findIndexedChildRecursive () method can be mapped to the corresponding bean object.
Highlights:
Now there is a page in which the area is nested, and each area has its own CO/controller. When the page comes out, will the processRequest () method in each CO be executed?
Answer: Yes. the CO in the internal region is executed first, and then the CO in the external region is executed. this is common. When you add a public region (shared region) to the home page, each public region may have its own CO.
Will the MDS page definition be cached?
A: Yes. Therefore, when the MDS is updated in the database, restart the weblogic Server.
However, this is not applicable to the jDeveloper test page. jDeveloper will first find the local XML file/local MDS. The framework will find the page definition from the database only when the local file system cannot be found.