Thursday, October 31, 2013

Calling the Procedure in OAF


Calling the Procedure in OAF


Now we r going to learn about how to call the procedures in oaf page.

First Create the work space and project.

Create the AM.

Create the page and attach the AM.

Create one new region in the page of style messageComponentLayout.

Create two items of style messageTextInput and data type number.

Create one submit button.

The structure of the page looks like as follows.





Now we have to create one package and package body to call that in OAF page.

//Package Specification
//Addition of two numbers.

CREATE OR REPLACE PACKAGE APPS.proc_in_oaf AUTHID CURRENT_USER
IS
PROCEDURE addition
(   item1            IN      NUMBER, 
    item2            IN      NUMBER, 
    addition    OUT  NUMBER
);
END proc_in_oaf;


//Package Body
CREATE OR REPLACE PACKAGE BODY APPS.proc_in_oaf
IS
PROCEDURE addition 
(   item1          IN    NUMBER,
             item2          IN    NUMBER,
               addition  OUT NUMBER
)
IS

BEGIN

 addition  := item1 + item2;

END addition;

END proc_in_oaf;


After creating the procedure,

Create the method in the AMImpl.java file for calling the and executing the procedure.

        public String AddNumber(String item1,String item2)
    { OADBTransaction oadbtransaction = (OADBTransaction)getTransaction();
      OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getTransaction();
     String retValues;
    StringBuffer str = "Begin proc_in_oaf.addition(:1,:2,:3); End;";
     
     OracleCallableStatement oraclecallablestatement =
      (OracleCallableStatement)oadbtransaction.createCallableStatement(str.toString(), 1);
     try{
      oraclecallablestatement.setFloat(1,  Float.parseFloat(item1)  );
      oraclecallablestatement.setFloat(2,  Float.parseFloat(item2) );
      oraclecallablestatement.registerOutParameter(3, Types.VARCHAR);
      oraclecallablestatement.execute();
                       
      retValues = oraclecallablestatement.getString(3);
     }
     catch(Exception e)
     {
      throw OAException.wrapperException(e);
     }
     return retValues;
    }



Next create one controller in the page .

And call the method in the processFormRequest.




//FOR Copy Paste

  public void processFormRequest(OAPageContext pageContext, OAWebBean webBean)
  {
    super.processFormRequest(pageContext, webBean);
   
     
          OAApplicationModule am = pageContext.getApplicationModule(webBean);
               
           if (pageContext.getParameter("item3") != null)         
           {           
                Serializable[] parameters1 = { pageContext.getParameter("item1"),
                                        pageContext.getParameter("item2"),
                                                                           };
                              
            String retVals1 = (String)am.invokeMethod("AddNumber", parameters1);
            String message = "Sum:  " + retVals1;                    
            throw new OAException(message, OAException.INFORMATION);

         
          }

      }


This completes the project.

Run the page to see the output.




After click on ADD button it will give the addition of two numbers.



Monday, October 28, 2013

Invoking sequence in OAF Page


Invoking sequence in OAF Page



To invoke the sequence number in the OAF page then write the following code in the setter method of the required column in EOImpl.java file.




//For Copy Paste//

    public void create(AttributeList attributeList) {
        super.create(attributeList);
       
          OADBTransaction transaction = getOADBTransaction();
      // To get the employee id  through sequence
          Number employeeId = transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");
          setEmployeeId(employeeId);

         
// Start date should be set to sysdate
        setStartDate(transaction.getCurrentDBDate());
        // end create()
 }



OR
If you want to write in controller write the below code in processRequest of controller class.

          OADBTransaction transaction = (OADBTransaction)am.getOADBTransaction();
          Number seqvalue= transaction.getSequenceValue("FWK_TBX_EMPLOYEES_S");  
          System.out.println("seqvalue-->"+seqvalue);       
          OAMessageStyledTextBean mcb = (OAMessageStyledTextBean)webBean.findChildRecursive("EmpId");
          mcb.setValue(pageContext,seqvalue);

The Desired output shulde like.


Search page using Query Region



Search page using Query Region


First create one workspace and project.

Create one AM.

Create the page and attach the AM to page.

Create the VO.

select * from fwk_tbx_employees

Attach VO to AM.

Select the page in main region right click select new region and set the Region style as query.

And in the property inspector set the following property.

Construction Mode--- >resultBasedSearch.



Right click on query region select new-- > Region using Wizard.

First u will get the welcome window just click next .

In next window select your AM and VO.
Click next.



In next window select  region style as table.



In next step select the attributes u want to display.




Click next, next and finish.


The structure of the page is as follows.



For each item set the property search allowed to true





Run the page to see the output.

If u use Query region then there is no need to create search and clear button they will come automatically


Wednesday, October 23, 2013

Naming Rules 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.

Tuesday, October 22, 2013

Difference between OAF and Oracle Forms

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.






What is 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.

Characteristics 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.