MVC Architecture of OAF


MVC  Architecture







 The components of MVC Architecture are:-
  •   MODEL.
  •   VIEW.
  •   CONTROLLER.

MODEL:-

            Model contains the components which handles data directly from database.

            The model encapsulates underlying data and business logic of the application.

            Model components are implemented using Business Components for Java

There are three basic component classes:-

Ø  The Application Module:– A container for related BC4J objects.

Ø  Entity objects:– Encapsulate business rules.

Ø  View objects:– Present data to the Framework page.

Model additionally contains three other components:-

Callable Statement:-

            Callable Statement is used to call a PL/SQL statements.

Prepare Statement:-

            Prepare Statements are used if we are using a “SELECT” statements.

OADB Transaction:-

OADB Transaction will take care of Oracle Apps related Databse Transactions. 




     Entity Object (EO):-

            Entity Object contains custom business logic.

            Entity Object map to a database table or other data source.

Entity Objects can be created on database objects like Table, View, Synonym etc or other Entity Objects.

Each entity object instance represents a single row and Contains attributes representing database columns.

Entity Objects are mainly used for insert, update or delete the records from database.

Entity Object will take care of business logic and validation related to a table.

Entity Object Encapsulate the attribute level and entity level validation.

OA Framework supports both Java and PL/SQL entity objects

If we want to perform the DML operations on the standard (Seeded) table then we go for PL/SQL based Entity Object.

If we want to perform the DML operations on the custom table then we go for Java Based Entity Object

All the entity objects that you create are subclass of oracle.apps.fnd.framework.server.OAEntityImpl
class.

While Creating the Entity Object always generate accessors (setters/getters). 

EO should have following attributes(WHO COLUMNS):-   

Ø  CreationDate
Ø  CreatedBy
Ø  LastUpdateDate
Ø  LastUpdatedBy
Ø  LastUpdateLogin

 After creating the entity object always attach that to VO.

        Entity Association:-

            Define a relationship between entity objects.

Facilitate access to data in related entity objects, May be based on database constraints, May be independent of database constraints

Consist of a source (master) and a destination (detail) entity.

There are two types of Entity Associations:-

Ø  Reference Association.

Ø  Composition Association.

Reference Association:-

Used for weak association between entities such as foreign keys for lookups.
Ex:- Requisition - Supplier association.

Composition Association:-

Used for composite objects with strong "owning" relationship
Use if: child entity cannot exist without parent;
Child is deleted when parent is deleted

Example: RequisitionHeader – RequisitionLine association


Behavior of Composition Association:-

Ø  When child is dirtied, parent is dirtied automatically

Ø  When child is locked, parent is locked first automatically

Ø  Parent is brought into memory automatically if not already in memory

Ø  Validation order is child first, parent second.

Ø  parent has final veto power on child modifications

Ø  Insert/Update order is parent first, child second

Ø  Delete order is child first, parent second

   
   View Object (VO):-

View Object is mainly used for Manage collection of data and to display them in OAF page.

View Object represents a query result.

View Objects are used for joining, filtering, projecting and sorting your business data.

View Object can be created in three ways:-

Ø  Generated SQL based on Eos.

Ø  Expert Mode custom SQL with no underlying Eos.

Ø  Expert Mode custom SQL manually mapped to Eos.

View Object can be created on the bases of Single Entity Object or more than one Entity Object.

View Object can also be created from SQL statements.

            A VO controls many view rows.

Each view row represents a row of the data that is queried from the database.

When you want aliases in the query, make sure that the attribute settings in the VO wizard include the alias names.

All the view objects that you create are subclass of 

oracle.apps.fnd.framework.server.OAViewObjectImpl class.

While creating always create View Row Java class
(ViewRowImpl) and accessors (setters/getters).

Each VO should have:

Ø  <YourName>VO.xml
Ø  <YourName>VOImpl.java (optional)
Ø  <YourName>ViewRowImpl.java (required)

After creating the view object always attach that to AM.

    
  View Link:-

            A view link is a link between view objects.

You can create view links by providing the following:
Ø  Source and destination views
Ø  Source and destination attributes

Use a view link to create a master-detail relationship between view objects.

Ø  Allows dynamic synchronization between parent and child VO.

Ø  Child rowset is ‘refreshed’ when the current parent row changes.
  


    Application Module (AM):-

            Application module serves as a container for related BC4J objects.

AM defines the logical data model and business methods needed support an application task.

AM is the interface between the Client transactions and Data Base transactions.

Types of AM:-

Ø  Root AM (The AM attached to main region is called Root AM).

Ø  Nested AM(The AM attached to child region is called Nested AM).

All the pages are attached to the AM.

The entire application module that you create is subclass of 

oracle.apps.fnd.framework.server.OAApplicationModuleImpl class.


    Transaction:-

            Holds database connection.

            Holds all entities centrally separated from AMs and VOs.

            Holds list of EOs that requires:

Ø  Validation
Ø  Posting to database
Ø  Commit notification



  BC4J Packages in JDeveloper:-

          BC4J packages also correspond to directory paths.

          EO-related (business logic) .java and .xml files in
oracle.apps.<application shortname>.<module>.schema.server

     AM and VO (UI-related logic) .java and .xml files in
oracle.apps.<application shortname>.<module>.server

    Poplist- and LOV-related VO and AM .java and .xmlfiles in
oracle.apps.<application shortname>.<module>.poplist.server
and
oracle.apps.<application shortname>.<module>.lov.server


View:-

View is the actual output of OAF pages.

View is implemented using UIX technology, after running the page in JDeveloper,
 then automatically    UIX will generate web.xml file.

Then generated web.xml file will be converted into HTML format of OAF page.

Customers and third parties use Page Personalization to modify pages to fit business needs and
 user preferences.

 What ever the result we want in our page that we can set here.

Oracle has provided lot of properties for everything that we want to modify the visual
 representation of the data.


 Controller:-

            Controller will take care of the web browser activities.

            Controller classes define how your java beans behave.

            Controller responds to user actions and directs the application flow.

Most of the codes will write in controller.

            There are several tasks you will do routinely in your code.

Ø  Handle button press and other events

Ø  Automatic queries

Ø  Dynamic WHERE clauses

Ø  Commits

Ø  JSP Forwards

          The most common locations for your code in Controller will be:-
                  
     Ø  processRequest (code for page initialization such as
                   
     Ø  HTTP GET actions, after passivation, and so on)

                    Ø  processFormData (typically no code)

                    Ø  processFormRequest (code for HTTP POST actions)

The common parameter passings to controller are:-

Ø  OAPageContext:- (Using the page Context we can set and get the item
         values)

Ø  OAWebBean:- (Using OAWebBeean we can get the position of the
     field in the page).


The entire controller that you create is subclass of oracle.apps.fnd.framework.server.OAControllerImpl class.


2 comments: