ViewPatientRequestAction.java
01 package com.bea.medrec.actions;
02 
03 import com.bea.medrec.beans.PatientBean;
04 import com.bea.medrec.utils.ClientException;
05 import com.bea.medrec.value.Patient;
06 import javax.servlet.http.HttpServletRequest;
07 import javax.servlet.http.HttpServletResponse;
08 import org.apache.struts.action.ActionForm;
09 import org.apache.struts.action.ActionForward;
10 import org.apache.struts.action.ActionMapping;
11 
12 /**
13  <p>Controller to view pending new patient registrations.</p>
14  *
15  @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
16  */
17 public class ViewPatientRequestAction extends AdminBaseAction {
18 
19   /**
20    <p>Process the specified HTTP request, and create the corresponding HTTP
21    * response (or forward to another web component that will create it).
22    * Return an <code>ActionForward</code> instance describing where and how
23    * control should be forwarded.
24    <br>
25    * View pending patient registration information.
26    </p>
27    *
28    @param mapping  The ActionMapping used to select this instance
29    @param form  The optional ActionForm bean for this request (if any)
30    @param request  The HTTP request we are processing
31    @param response  The HTTP response we are creating
32    */
33   public ActionForward executeAction(ActionMapping mapping,
34                                      ActionForm form,
35                                      HttpServletRequest request,
36                                      HttpServletResponse response)
37       throws ClientException, Exception {
38 
39     String patientId = request.getParameter("patientId");
40     Patient patient = null;
41     PatientBean patientBean = null;
42 
43     try {
44       patient = getAdminSession().findPatientById(new Integer(patientId));
45       patientBean = new PatientBean(patient);
46       setSessionAttribute(request, PATIENT_BEAN, patientBean);
47     catch (Exception e) {
48       throwClientException(e, mapping, "home");
49     }
50 
51     return mapping.findForward("view.patient.request");
52 
53   }
54 }