Monday, 3 June 2013

Creating an AM


Creating an AM:-  
    • Right click on the Model Project-> Click on New -> Application Module (ADF Business Components->Business Tier)Component -> Click on OK. 
    • On clicking on OK, the View Object creation wizard will be opened which will help you in creating the Application Module, say MyAM.


    • In step 1give the package name as “model.am” (Why? You can refer to the ADF Business component naming standard). 
    • Enter the AM name as MyAM, the display name will be automatically set by the Jdeveloper, however you can change it at any time. 
    • Keep the extends and Property Set field as it is, this for ADF Advanced tutorial, and we are less bother about for it. 
    • Click on Next to the next step.

    • In step 2, shuttle the EmployeeVO earlier created by you to right, to add the VO to the AM. Else you can add the VO to the AM later also. 
    • The View Instance name i.e. “EmployeeVO1” indicates the name that will be exposed to the View Controller layer using the AM.
    • Step 3, AMs can be nested also. For our application we are not going to use nested AM. 
    • If more than one AM are present in the Application then while creating the new AMs existing AMs will be displayed here so that you can nested one AM to another.
  
    • In step 4, you can generate Application Module class and Application Module definition class.
    • Step 5 is a summary of Application Module you are going to create. Just review it and click on Finish to complete the Application Module creation wizard.
 

    • You have created your first Application Module, named as MyAM. You can see it under Model project present in Application Navigator palette as shown below.

Creating a VO

Creating an VO:-


    • Right click on the Model Project-> Click on New -> View Object (ADF Business Components->Business Tier)Component -> Click on OK. 
    • On clicking on OK, the View Object creation wizard will be opened which will help you in creating the View Object, say EmployeeVO.
    • In step 1 give the package name as “model.view” (Why? You can refer to the ADF Business component naming standard). 
    • Enter the VO name as EmployeeVO, the display name will be automatically set by the Jdeveloper, however you can change it at any time. 
    • Keep the extends and Property Set field as it is, this for ADF Advanced tutorial, and we are less bother about for it. 
    • Our VO is going to be based on EO(Entity Object). It may be also based on SQL query, Programmatic or Static List based. 
    • Click on Next to the next step.
    • In step 2, as we have selected that our VO will be based on EO(In step 1), we have to select the EO based on which our VO will be created. 
    • Select the EmployeeEO and shuttle it to right and click on Next to go to step 3 of VO creation wizard. 
    • As discussed earlier VO may be based on a single EO or multiple no of EOs. How to create a VO based on multiple no. of EOs we will discuss later. 
    • You can see the updatable field is checked, which means you can insert or update a record using this VO.
    • In Step 3 of the wizard, you will be able to select the attributes that will be available to your VO and you can also arrange the display order of the attributes. 
    • To achieve the same, select the attributes that you want to be in your VO and shuttle them to right. 
    • To change the order of the attributes, use the up and down arrow buttons present in the wizard. 
    • Click on Next.
    • In step 4, you can set the attributes properties, their default values and lots more. 
    • We will not change the attribute setting now. 
    • All the attribute properties that we set to the EmployeeEO will be available here, as our EmployeeVO is based on the EmployeeEO. 
    • Click on Next.
    • In step 5, you will be able to see the SQL query for the VO. This will be basically a SELECT query in SQL. 
    • You can add a where clause to the query in the where values to filter the records that will be fetched by the VO. 
    • You can also add a Order By clause to order the records that will fetched by the VO. 
    • Click on Next to go to Step 6.
    • In step 6 click on Next to continue. 
    • What is Bind Variable and how to use it we will discuss it later in details.
    • In step 7 the wizard will create the java classes related to VO if you wish to create. Again we will discuss about it later in details.
    • In step 8 the wizard will create the application module for you if you check the Add to Application Module(If not exists or else it will add the VO to the selected Application Module.). 
    • We will learn how to create an Application Module, so don’t check the Add to Application Module check box.


    • Step 9 is a summary of view object you are going to create. Just review it and click on Finish to complete the view object creation wizard.

    • You have created your first view object, named as EmployeeVO. You can see it under Model project present in Application Navigator palette as shown below.