Final Code in AM, Update Page, and Patient Entry Page Controller

Ratings:
(4)
Views:641
Banner-Img
  • Share this blog:

There are few changes we need to made while calling or navigating from one form to another form. So after all the final code in the Update page controller class looks like the following: public void processRequest(OAPageContext pageContext, OAWebBean webBean){  super.processRequest(pageContext, webBean);  StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean);  //am.xxinsertpatient();  if(pageContext.getParameter("pid")!=null)  {   String pid = pageContext.getParameter("pid").toString();   String whereclause = "PATIENT_ID='"+pid+"'";   am.getPatientEntryVO1().setWhereClause(null);   am.getPatientEntryVO1().setWhereClause(whereclause);   am.getPatientEntryVO1().executeQuery();  }  else  {   am.xxinsertpatient();  } OAMessageRadioButtonBean var1 = (OAMessageRadioButtonBean)webBean.findChildRecursive("male"); var1.setName("Gender"); var1.setValue("Male"); OAMessageRadioButtonBean var2 = (OAMessageRadioButtonBean)webBean.findChildRecursive("female"); var2.setName("Gender"); var2.setValue("Female");}/*** Procedure to handle form submissions for form elements in* a region.* @param pageContext the current OA page context* @param webBean the web bean corresponding to the region*/public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){ super.processFormRequest(pageContext, webBean); StirlingAMImpl am= (StirlingAMImpl)pageContext.getApplicationModule(webBean); // am.xxinsertpatient(); if (pageContext.getParameter("update")!=null) {  am.getOADBTransaction().commit();  throw new OAException("Patient Data Updated Successfully",OAException.CONFIRMATION); } if(pageContext.getParameter("item4")!=null) {  pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",                             null,                             OAWebBeanConstants.KEEP_MENU_CONTEXT,                             null,                             null,                             true,                             OAWebBeanConstants.ADD_BREAD_CRUMB_YES,                             OAWebBeanConstants.IGNORE_MESSAGES); }} The above code is the Controller class code in Update Page. Let us see the Patient Entry page controller code: public void processRequest(OAPageContext pageContext, OAWebBean webBean){ super.processRequest(pageContext, webBean); StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean); if(pageContext.getParameter("ppatientid")!=null) {  String pid = pageContext.getParameter("ppatientid").toString();  String whereclause = "PATIENT_ID='"+pid+"'";  am.getPatientEntryVO1().setWhereClause(null);  am.getPatientEntryVO1().setWhereClause(whereclause);  am.getPatientEntryVO1().executeQuery(); } else {  am.xxinsertpatient(); } OAMessageRadioButtonBean var1 = (OAMessageRadioButtonBean)webBean.findChildRecursive("male"); var1.setName("Gender"); var1.setValue("Male"); OAMessageRadioButtonBean var2 = (OAMessageRadioButtonBean)webBean.findChildRecursive("female"); var2.setName("Gender"); var2.setValue("Female");}/*** Procedure to handle form submissions for form elements in* a region.* @param pageContext the current OA page context* @param webBean the web bean corresponding to the region*/public void processFormRequest(OAPageContext pageContext, OAWebBean webBean){ super.processFormRequest(pageContext, webBean); StirlingAMImpl am = (StirlingAMImpl)pageContext.getApplicationModule(webBean); if (pageContext.getParameter("item3")!=null) {  System.out.println("Add button called");  am.getOADBTransaction().commit();  throw new OAException("Patient Data Entered Successfully",OAException.CONFIRMATION); } if(pageContext.getParameter("item9")!=null) {  pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/SearchPG",                             null,                             OAWebBeanConstants.KEEP_MENU_CONTEXT,                             null,                             null,                             true,                             OAWebBeanConstants.ADD_BREAD_CRUMB_YES,                             OAWebBeanConstants.IGNORE_MESSAGES);  }  else  if (pageContext.getParameter("item11")!=null)  {   pageContext.setForwardURL("OA.jsp?page=/xxstirling/oracle/apps/po/stirlingprj/webui/StrilingPG",                             null,                             OAWebBeanConstants.KEEP_MENU_CONTEXT,                             null,                             null,                             true,                             OAWebBeanConstants.ADD_BREAD_CRUMB_YES,                             OAWebBeanConstants.IGNORE_MESSAGES);  }} The code below is the code is the AM Java code, and note that we created only one AM for the entire project. We created two methods overall in AM and the below code shows the two methods: public void xxinsertpatient(){  PatientEntryVOImpl vo= getPatientEntryVO1();  OADBTransaction trans= getOADBTransaction();  vo.executeQuery();  Row v_row = (Row)vo.createRow();  vo.insertRow(v_row);}public void xxSearchPatient (OAPageContext pc, OAWebBean wb){  String pid = null;  String name = null;  String phno = null;  //OAViewObject vo= getSearchVO1();  SearchVOImpl vo1= getSearchVO1();  if (pc.getParameter("item1")!=null)  {   pid = pc.getParameter("item1").toString();   vo1.setWhereClauseParam(0,pid);  }  else  {   vo1.setWhereClauseParam(0,null);  }  if(pc.getParameter("item2")!=null)  {   name = pc.getParameter("item2").toString();   vo1.setWhereClauseParam(1,name);  }  else  {   vo1.setWhereClauseParam(1,null);  }  if(pc.getParameter("item3")!=null)  {   phno = pc.getParameter("item3").toString();   vo1.setWhereClauseParam(2,phno);  }  else  {   vo1.setWhereClauseParam(2,null);  }  vo1.executeQuery();} Check out our Popular Trainings  Structure of OAF Advantages and Dis-Advantages of OAF SQL Server DBA Training in Bangalore Creating First OAF Page in Project

You liked the article?

Like : 0

Vote for difficulty

Current difficulty (Avg): Medium

Recommended Courses

1/15

About Author
Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.


Stay Updated


Get stories of change makers and innovators from the startup ecosystem in your inbox