Saturday, January 28, 2017

Creating First OAF Page In Project

in this lesson we are going to see how to create the first page in OAF according to our requirement.
The first page is nothing but the patient entry page.
Here we are going to create the patient entry page.
  1. First create one Workspace and Project.
  2. Create one AM
  3. Create one page and attach AM to the page.
For example:
Workspace Name : StirlingVision
Project Name : StirlingPRJ
AM Name : StrilingAM
Package Name: xxstirling.oracle.apps.po.stirlingprj.server

Now according to the document that is based on MD-050 document we need to create the page structure of Patient Entry page. The below figure shows the page structure with description of each item and regions.
41
Run the page and see the output, the below picture shows the output of the page.
42
Now for every value what we are entering in the field must be saved in the data base and for that we know that we need to insert data into the table.
Create one table which stores the details of patients in Data Base. The Table with who columns is :
CREATE TABLE XXSTIRLING_PATIENT_ENTRY_TABLE(PATIENT_ID NUMBER(10) PRIMARY KEY,
PATIENT_NAME VARCHAR2(40),
REVIEW VARCHAR2(10),
PHONE_NUMBER NUMBER(15),
SEX VARCHAR2(7),
AGE NUMBER(3),
AMOUNT NUMBER(6),
DATE_CHECKED DATE,
ADDRESS VARCHAR2(40),
–who columns
LAST_UPDATE_DATE DATE NOT NULL,
LAST_UPDATED_BY NUMBER NOT NULL,
CREATION_DATE DATE NOT NULL,
CREATED_BY NUMBER NOT NULL,
LAST_UPDATE_LOGIN NUMBER);
Now after creating table we need to create one Entity Object in the project.
Create one Entity Object (EO) in the project
For example:
Entity Name : StirlingPatientEntryEO
Package : xxstirling.oracle.apps.po.stirlingprj.schema.server
After creating Entity Object Create one VO, for example:
View Object Name: PatientEntryVO
Package: xxstirling.oracle.apps.po.stirlingprj.server
Attach EO to VO while creating.
Attach VO to the AM.
After attaching VO to the AM give View Instance and View attribute to each and every item in the page and check the data type and size of the attribute is mapped properly. We have seen the radio buttons so for both Radio Button items give the same View Instance and View Attribute and Checked value for Male is MALE, checked value for Female is FEMALE.
Radio Button validation in a page:
For Radio buttons only one radio button must be checked out of all available radio buttons for that we need to write the code in the Process Request of the controller.
Create one Controller on the main region and write the following Radio Button Validation code in the Process Request of Controller:
OAMessageRadioButtonBean var1 = (OAMessageRadioButtonBean)webBean.findChildRecursive(“male”);
var1.setName(“Gender”);
var1.setValue(“Male”);
OAMessageRadioButtonBean var2 = (OAMessageRadioButtonBean)webBean.findChildRecursive(“female”);
var2.setName(“Gender”);
var2.setValue(“Female”);
Add the corporate logo to the page.
Now for storing the data in the Data Base we need to open the AM file and create the method in the java file of AM
public void xxinsertpatient()
{
PatientEntryVOImpl vo= getPatientEntryVO1();
OADBTransaction trans= getOADBTransaction();
vo.executeQuery();
Row v_row = (Row)vo.createRow();
vo.insertRow(v_row);
}
After writing the method in AM we need to initialize the AM in the Controller, write the following code in the process Request of controller:
//in the proecessRequest after super class
StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean);
am.xxinsertpatient();
After initializing AM and the method of AM in controller, we have to write the validation code for Add button so therefore we need to write the code in ProcessFormRequest for Add button as follows:
StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean);
if (pageContext.getParameter(“item3”)!=null)
{
am.getOADBTransaction().commit();
throw new OAException(“Patient Data Entered Successfully”,OAException.CONFIRMATION);
}
Now rebuild the code in the controller and also rebuild the code in the AM. After successfully rebuilding the code run the page enter some date and click on Add button so that patient will be added.

The below figure shows the output of the page:
43

No comments:

Post a Comment

How to improve blog performance

Improving the performance of a blog can involve a variety of strategies, including optimizing the website's technical infrastructure, im...