Search This Blog

Saturday, March 19, 2016

02. OAF MVC Architecture



About Model


The entire Database related transactions in OAF pages will be taken care by the MODEL.
  • Model is where the application implements business logic.
  • Model will implement all the Data Base transactions.
  • Model component is implemented using BC4J where BC4J is Business Component for Java.
  • BC4J consists of three components:
    • Entity Object and Entity Associations
    • View Objects and View Links
    • Application Module
Model contains six components including BC4J components, additionally the other three components are:
  • Callable Statement
  • Prepare Statement
  • OADB Transactions
Callable statement is used to call a PL/SQL statements, Prepare statements are used if we are using single SELECT statement, and OADB transactions will take care of Oracle APPS related Data Base transactions.



pic1














Entity Objects and Entity Association


Entity Objects:
  • The entity objects are used if one wishes to do some insert/update operations.
  • Entity Objects represents a Data Base Row of a table.
  • Entity Objects will be based on the View (Oracle View), Synonyms or snapshots.
  • We need to create Entity Object if we want to perform DML operations on the OAF Page.
  • All the Entity Objects end with the EO.
Example:  employeeEO
  • When we create Entity Object (EO) one subclass will generate.
  •  
  • We have two types of Entity Objects
    I. PL/SQL based Entity Objects
    II. Java based Entity Objects
    Note: We have two types of tables in Oracle Apps they are Custom Tables and Seeded Tables.
    If we want to perform the DML operations on the standard (Seeded) table then we go for PL/SQL based Entity Object and if we want to perform the DML operations on the custom table then we go for Java Based Entity Object.
    Entity Association:
    • Entity Association is the relationship between two Entity Objects having one common column.
    • All the Entity Association ends with the AO (Association Object).
    Example:  EmpDeptAO
    • If we want to perform DML operations on Master Detail page then we go for Entity Association.
    • If we want to know common column between two tables then we will go for Entity Association.


    View Objects and View Links


    View Objects:
    • View Objects are used when we want some data to be displayed on page.
    • View Objects are used just for displaying purpose.
    • View Objects access the result set of a SQL statement, it can be either based on the Entity Object or plain SQL query.
    • All the view objects ends with the VO
    Example: EmployeeVO
    • When we create the View Object (VO) one subclass will generate with setters and getters method.

     
  • We have four types of View Objects and they are:
    1) Manual VO
    2) Automatic VO
    3) Validation VO
    4) Property VO

    Manual VO:  If we are writing our own SQL query then it will be called as Manual VO.
    Automatic VO:  Automatic VO is when we select an Entity Object automatically it will select the Query.

    Difference between Manual and Automatic VO is:
    • If we want to perform DML operations then we can go for VO that should be based on Entity Object.
    • We go for Manual VO if we are using simple SELECT statement.
    NOTE: Note that when we create VO (View Object) all the table columns will be converted into attributes, hence here we call columns as attributes.

    Validation VO:Validating the data in the Data Base, example using WHERE condition in the SELECT statement.
    Property VO:Attributes / columns without Data Base columns comes under property VO. These attributes are also called as Transient attributes.
    Example: Suppose there is a table which holds student marks so therefore it contains 6 columns to hold six subject marks for each student. There is no total column in the table to store the total marks of the student separately. Now in the output for display purpose we are taking TOTAL attribute, hence which is not from Data Base table and this TOTAL attribute is called Transient attribute.

    View Links:
    Relationship between two View Objects having one common column in both the VO’s is called View Link. All the View Link objects end with the VL
    Example: DeptEmpVL
    Note that if we want to display Master Detail data then we go for View Links, where as if we want to perform DML operations on Master Detail data we go for Entity Association.
    The below figure shows that how View Objects and View Links are interacting with Data Base, VO interacts with Data Base Directly or VO interacts with Data Base through the EO.
     
     

  • Application Module


    • It is very important component in the Model.
    • Every Oracle Application Framework (OAF) page should be attached to some Application Module.
    • It is the interface between the Client transactions and Data Base transactions.
    • All the application module objects end with AM.
    Example: employeeAM
    • Whenever we create AM one subclass will generate.
     


Application Module is of two types and they are:
I. Root Application Module.
II. Nested Application Module.
If we are attaching AM to the Main Region of the page then it is called Root Application Module and if we are attaching to the child regions (or) nested regions then it is called Nested Application Module.

The below figure shows what is the main region and what are the child regions in OAF page.
 



The View Objects containing in the Main Application Module can be used anywhere in the child regions or Nested Application Module.
If the View Objects are attached to the Nested Application Module then those view objects are applicable only to that particular nested region.


About View


  • View is the actual output OAF page what an end user can able to see.
  • In Oracle Apps Framework View is implemented using UIX technology, whereas UIX means User Interface XML.
  • Whenever we run the page in JDeveloper then automatically UIX will generate web.xml file.
  • The power of UIX is that allows metadata to be translated to an HTML page for a web browser or mobile device browsers.
  • The generated web.xml file will be converted into HTML format of OAF page.
  • Since web.xml file here will work as a cache memory.
  • Whenever we want to move the web.xml file into the server side then MDS repository is used to move the web.xml file into the server.
  • MDS stands for Meta Data Service and in the application top we will be having MDS folder.
  • When we deploy all the OAF page destination paths, regions then the files will be stored into the MDS tables.
  • The MDS table are like:
JDR_Paths:Stores the path of the documents, OA Framework pages and their parent child relationship.
JDR_Components:Stores components on documents and OA Framework pages.
JDR_Attributes:Stores attributes of components on documents and OA Framework pages.
JDR_ATTRIBUTES_TRANS:Stores translated attribute values of document components or OA framework pages.
JDR_DOCUMENT_ID_S: This is a sequence generator table.
  • MDS can be managed using standard database procedures and tools.


About Controller



  • Controller will take care of the web browser activities.
  • The controller manages the flow between pages.
  • Controller responds to the user actions and directs application flow.
  • The controller will request from HTTP get and HTTP post.
  • All the controllers end with the CO.
  • When we create controller on subclass will generate.
  •  
  •  
  •  
  • Controllers have three methods:
    1. Process Request (HTTP get).
    2. Process Form Request (HTTP post).
    3. Process Form Data.

    HTTP get:This is used while loading the page.
    HTTP post: After loading the page if we want changes.
    Process Request: This method will handle HTTP get, for example while loading the page displaying the default items.
    Process Form Request: This method will handle HTTP post. After loading the page if we want to perform any actions then we go for process form request. For example, after clicking button going to another page.
    Process Form Data: This page is invoked upon a browser ‘post’. During this phase the framework will automatically applies changes back to the underlying view objects. Rarely custom code is required in this phase. If exceptions are thrown during this phase the phase is skipped and the page redisplays with the error message.

    There are two parameters in the controller:
    1) OAPageContext
    2) OAWebBean

    OAPageContext:
    • To get and set values of the fields using the OAPageContext.getparatmeter and OAPageContext.putparameter.
    • To call one page to another page OAPageContext.setforwardURL.
    • To redirect the current page itself use OAPageContext.forwardImmediatelyToCurrentPage (or) OAPageContext.sendRedirect and many more.

    OAWebBean:
    • Each and every field we have properties and the properties define the behavior of item.
    • OAWebBean represents the Hierarchy/Structure of the components in the page.
    • WebBean represents the properties of item.
    As we discussed what Model, View, and Controller is, look at the below figure which shows that how they generally interact with each other or how the data flow between them is.
     
  • BC4J File Structure


    BC4J stands for Business Component for Java, the following figure shows the file structure of Business Component for Java where xxname stands for any user defined name and PO is the Application Short name of Purchasing, Vision Operations (USA), and you can use other also, depending upon the requirement. In place of XXAAM we generally use client name.
    In the below figure we listed
    • BC4J of AM and VO
    • BC4J of EO
    • BC4J of LOV
    • BC4J of poplist
    • BC4J of Controller
    • BC4J of Page
     
     

No comments:

Post a Comment