OAF_架构MVC系列1 - MVC的概述(概念)

 2015-04-03 Created By BaoXinjian

 一、摘要


MVC概要解析

 

 

 

二、解析


1. Model

BC4J(Business Components For Java) have three basic component classes:

Application Module - a container for related BC4J Object

Entity Objects - encapsulate business rules

View Objects - present data to the Framework page

BC4J is used to Business Logic and Data Handling Model

1.1 Entity Objects (EO)

Entity Objects are generally based on one table which encapsulate the business rules. These objects are used by OAF page to perform update/insert/delete operations. You can join two EOs using Entity Associations.

1.2 View Objects (VO)

These objects contain a SQL query that queries the data from database and present it in the OAF page. VOs can be based on one or many EOs or a SQL query. Two VO can be linked together through a View Link.

1.3 Application Module (AM)

It is a very important component for the package, it is the one which governs the entire session pool, access to database and the business logic components, every page should be attached to some AM.

It is a container for related BC4J objects and provides the database connection. It also provides Transaction Context (OADBTransaction) or Transaction Management. An AM can have more nested AM contained in it along with other BC4J components. But it is mandatory to have an AM for an OAF page.

 

2. View

View contains the actual page items on page which user can see.

The view in OAF comprises of various page level items like text fields, buttons, regions, links etc. These items are visible on any OAF page.

These items can either be tied to VO attribute or having a constant value or populated at run time based through controller logic.

Please note that- View Layer is altogether different than View Object!!!!!

 

3.  Controller

3.1 Controller:Controlling UI Behavior, You can override controller classes to:

Manipulate the UI at runtime

Manually initialize data items

Intercept and handle user events like button clicks

3.2 Controller handles all the user actions done on the page. OAF requires a java controller class to be defined for a page/region which handles various page level actions. The important methods in this class are:

a. ProcessRequest

     This request is called when page is rendered. Any logic to be executed during page initialization is kept here.

b. ProcessFormRequest

Any page submit action causes ProcessFormRequest to be executed.

The logic put here typically is that which needs to be executed after actions like button click or any other page submit action.

The Controller class is mostly used to put logic for actions on page such as button clicks, navigation to other pages.

The two objects that are passed to controller methods are OAPageContext and OAWebBean.

OAPageContext provides access to objects like AM class, page parameters, session values, navigation methods.

OAWebBean is generally used to get a handle of page items.

 

Thanks and Regards

你可能感兴趣的:(mvc)