Thursday, 3 July 2014

Naming Conventions in OAF


GENERAL NAMING CONVENTION IN OAF



File Name length:-

File names are limited to 30.3 characters for OA Extension XML files (50.java for Java files).

Object Name length (regions, items, and so on):

            For performance reasons, object names (internal ID’s) are limited to 30 characters.

           Common abbreviations are acceptable to keep names as short as possible.

           Acceptable abbreviations can be instantly understood by a third party consultant.

          Object names in pages must be unique in the entire page.

          Most names follow Java naming convention (mixed case).


Naming Standards for a Page:- The page name should convey the object it Presents.

            Page name ends with PG:- <object name>PG

            For ex:-    EmpSearchPG,
    EmployeePG,
    SupplierPG


Naming Standards for a Region:- The region name should convey the object it Presents.

            Region name ends with RN:- <object name>RN

            For ex:-   MainRN,
   EmpSearchRN,
   PoHeaderRN

Naming Standards for an Object:-

                        EmpName
SearchEmpName
ResultsEmpName


Naming Standards for an Entity Object:- The EO should be named for the objects stored in its 
                                                                     underlying entity.

            Entity Object name ends with EO:- <EntityName>EO

            For ex:-  EmployeeEO,
                             SupplierEO,
                             PurchaseOrderHeaderEO.

 Naming Standards for an Entity Association Object:-The AO name should convey the relationship
                                                                                         between a parent and its child entities.

            Entity Association name ends with AO:-<parent>TO<child>AO

            For ex:- PoHeaderToLinesAO,
   SupplierToSitesAO,
   DepartmentToEmployeeAO

Naming Standards for a View Object:-The VO name should convey the nature of
                                                                the query.

View Object name ends with VO:- <Descriptive Name>VO

For ex:-  EmployeeVO,
                             SupplierVO,
                             PurchaseOrderVO.

Naming Standards for a View Link:- The VL name should convey the relationship
 between the master and detail VOs.

View Link name ends with VL:- <Master>To<Detail>VL

For ex:- EmployeeToDepartmenstVL
    PoHeaderToLinesVL

 Naming Standards for an Application Module:- The AM name should convey the purpose of the UI 
                                                                                module it services.

Application Module name ends with AM:-  <ModuleName>AM

For ex:-HelloWorldAM,
   EmployeesAM,
                SupplierAM.

Structure of OAF


STRUCTURE OF OAF


            The OAF pages follow MVC architecture.


    The structure of OAF contains:-
  •  MODEL
  •  VIEW
  •  CONTROLLER


MODEL:-

The entire database related transactions in OAF pages will be taken care by the MODEL. Model is where the application implements business logic.

Ø  The major components of Model are:-
Ø  Application Module(AM).
Ø  Entity Object(EO).
Ø  View Object(VO).

Application Module:-

            Application module serves as a container for related BC4J objects.
            Application module provides transaction context.
            Application module establish database connection.

            Entity Object:-

            Entity object encapsulates business rules and logic.
Entity objects are mainly used by any program that inserts, updates or deletes data.
Entity object provides consistent data validation across all application.
Entity objects may be linked to other entity objects by entity association objects.

View Object:-

View object encapsulates a database query.
View object provide iteration over the query result set.
View object primarily based on Entity Objects (EO) or may be based on plain SQL or may be based on multiple Eos.
View object provides single point of contact for getting and setting Eos values.



 VIEW:-

            View is nothing but the OAF page output.
Each UI (User Interface) widget corresponds to one or more java objects (Beans).
The java objects are used create HTML at run time.
Customers and third parties use Page Personalization to modify pages to fit business needs and user preferences.

CONTROLLER:-

            Controller controls the UI behavior.
            Controller classes define how your java beans behave.
            Controller classes subclass OAControllerImpl.
            OAPageBean is the main OA Framework page processing class.


There are methods in the Controller class to handle GET and POST requests.
Ø  processRequest.
Ø  processFormData.
Ø  processFormRequest.

The OAPageBean calls the processRequest method when a browser issues a GET request.
The OAPageBean then calls processFormData for pages that insert or update data.
The OAPageBean calls the processFormRequest method when a browser issues a GET request.


Introduction of OAF



WHAT IS OAF?


  OAF is a framework developed by oracle corporation for application development within the oracle EBS(e-Business Suite).

  Oracle Application Framework (OAF) provides visual and declarative approaches to Java EE development.

 The OA framework is also available to customers for personalization’s, customizations and custom-application development.

Components of OAF

  • BC4J(Business Component for Java):-

           Java business components for representing business logic.
  •  UIX(User Interface Xml):-

Java components for representing UI.
  •  OA Extension:–

 Design time tool to define declarative data in JDeveloper.
 Data resides in Metadata Repository (MDS) or XMLfiles in
 the file system.
  • OC4J(Oracle Component for Java):–

The Java Virtual Machine, for running from  JDeveloper.
  • AOL/J:-

Applications authentication, authorization and Java services
  • OA Framework:-

Programmatic ‘glue’ which integrates these technologies.

Characterstics of OAF
Ø  Declarative and Rapid application development
Ø  Consistent and Compelling UI
Ø  Built-in durable Personalization
Ø  Extensible UI and business logic
Ø  J2EE based, Java and XML
Ø  Based on MVC architecture.


Difference between OAF and Oracle Forms

The major difference between the Oracle Application Framework and Oracle Forms are:-


OAF

FORMS
OAF follows MVC and Client Server Architecture.

Forms Follows only Client Server Architecture.
OAF pages are light weight components
Compare to OAF pages Forms are not light weight.

OAF Pages can access through mobile devices.

Forms Can’t.
Look and Feel is good.

Not better when comparing to OAF.
OAF pages are integrated with the Java Top.

Forms are integrated with Application Top
A page is divided into regions. Regions contain fields, buttons, tables, and other components.

A form is divided into blocks; blocks contain the fields, buttons, and other components.



Export Data from your OAF Pages

OAF gives you an Export Button feature that you can implement to exports data displayed in one or more regions of an OA Framework page to a file. Export saves the data to a .csv (comma separated values) file that can be viewed in Microsoft Excel. When you select the Export button, Microsoft Windows opens a dialog box that lets you view the file either by opening it directly in Microsoft Excel, or by saving it to a designated directory to open later.

Exporting Data From All Regions On A Page:

You can declaratively enable data export for all regions in a page by creating a page-level Export button. Here are the steps:
1] Select your pageLayout region and create a region with the style pageButtonBar beneath it.
2] Add an item of item style exportButton to the pageButtonBar region to automatically expose an Export button on the page.
When a user selects the Export button, OA Framework exports the data from all the rendered regions on that page to a .csv file.

Exporting Data From a Specific Region On A Page:

1] Select the region and create a new region item of item style exportButton.
2] Set the View Instance name for the exportButton region item to the same view object associated with the region for which you are enabling export. This ties the Export button to the correct data source.

Exporting Data From Master/Detail Regions:

If you have a page that contains both a Master region and a corresponding Detail region and you want to export all the data from these two regions regardless of which Master row is selected, you must do so programmatically. There is no declarative support for this.
Example:
Note: This type of Master/Detail export is supported only when you implement a region-level export and not a page-level export (where all the regions on a page are exported).

Few Notes:

  • Set the Export All Rows property on the exportButton item to True to export all rows from a table’s view object regardless of the view object’s setMaxFetchSize value. If the Export All Rows property is set to False, the total number of rows that can be exported from a table is defined by its view object’s setMaxFetchsize.
  • Generally, when you export data from a page, OA Framework exports the data from the view object attribute associated with each item in each region. In some cases, when you do not want to export the data from the view attribute associated with an item, you can specify a different view attribute to export from, by setting the Export View Attribute property for that item. If you don’t set or set the Export View Attribute property to null, OA Framework exports data from the view attribute name associated with the item.
  • ExportButton has few limitations to export data from some regions. Please refer the OAF Developer Guide for more details.

An alternate way:

The CSV file generated by the ExportButton is very raw and basic and often user may not like the format. If you want to design your own format for a better look and feel, you can go for this approach:
Step 1: Create a Data Template XML file.
Design Data Template
Step 2: Create a Data Definition in Oracle XML Publisher Administrator Responsibility and attach the Data Template.
Data Definition
Step 3: Create the RTF Template. To design the RTF Template, you first need the data in xml file. You can quickly create a concurrent program to get the XML Data. Once you got the data, design your template.
define concurrent Program
View XML Data
Design Template
Step 4: Create a Template in Oracle XML Publisher Administrator Responsibility and attach the RTF Template.
Define Template
Step 5: Create a method in your AMIMPL to get the XML Data. Here P_PARAMETER1 and P_PARAMETER2 are the parameters to the data template.
Step 6:  Create a SubmitButton on the page (anywhere you want)
Step 7: In the controller, write code as below:
The data will be exported as below. By using XML Publisher, you can export the data to any format like Excel, PDF, and Word etc.
Export to Excel