ViewRequestsAction.java
01 package com.bea.medrec.actions;
02 
03 import com.bea.medrec.utils.BeanHelper;
04 import com.bea.medrec.utils.ClientException;
05 import com.bea.medrec.utils.MedRecLog4jFactory;
06 import java.util.Collection;
07 import javax.servlet.http.HttpServletRequest;
08 import javax.servlet.http.HttpServletResponse;
09 import org.apache.log4j.Logger;
10 import org.apache.struts.action.ActionForm;
11 import org.apache.struts.action.ActionForward;
12 import org.apache.struts.action.ActionMapping;
13 
14 /**
15  <p>Controller displaying pending registration requests.</p>
16  *
17  @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
18  */
19 public class ViewRequestsAction extends AdminBaseAction {
20 
21   private static Logger logger =
22       MedRecLog4jFactory.getLogger(ViewRequestsAction.class.getName());
23 
24  /**
25   <p>Process the specified HTTP request, and create the corresponding HTTP
26   * response (or forward to another web component that will create it).
27   * Return an <code>ActionForward</code> instance describing where and how
28   * control should be forwarded.
29   <br>
30   * Displays pending registration requests.
31   </p>
32   *
33   @param mapping  The ActionMapping used to select this instance
34   @param form  The optional ActionForm bean for this request (if any)
35   @param request  The HTTP request we are processing
36   @param response  The HTTP response we are creating
37   */
38   public ActionForward executeAction(ActionMapping mapping,
39                                      ActionForm form,
40                                      HttpServletRequest request,
41                                      HttpServletResponse response)
42     throws ClientException, Exception {
43 
44     try {
45       // Retrieve new patients to approve/deny.
46       Collection<Object> col = getAdminSession().findNewUsers();
47       Collection<Object> patientApprovalBeans =
48           BeanHelper.toPatientApprovalBeanCollection(col);
49       logger.debug("Num of Patients to Approve: "+patientApprovalBeans.size());
50       request.setAttribute("PatientApprovalBeans", patientApprovalBeans);
51     }
52     catch(Exception e) {
53       throwClientException(e, mapping, "home");
54     }
55 
56     return mapping.findForward("view.requests");
57   }
58 
59 }