ImportRecordAction.java
01 package com.bea.medrec.actions;
02 
03 import com.bea.medrec.utils.ClientException;
04 import com.bea.medrec.utils.MedRecLog4jFactory;
05 import javax.servlet.http.HttpServletRequest;
06 import javax.servlet.http.HttpServletResponse;
07 import org.apache.log4j.Logger;
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>Import XML controller.</p>
14  *
15  @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
16  */
17 public class ImportRecordAction extends AdminBaseAction {
18   private static Logger logger =
19       MedRecLog4jFactory.getLogger(ImportRecordAction.class.getName());
20 
21  /**
22   <p>Process the specified HTTP request, and create the corresponding HTTP
23   * response (or forward to another web component that will create it).
24   * Return an <code>ActionForward</code> instance describing where and how
25   * control should be forwarded.
26   <br>
27   * Handles incoming XML medical record requests.
28   </p>
29   *
30   @param mapping  The ActionMapping used to select this instance
31   @param form  The optional ActionForm bean for this request (if any)
32   @param request  The HTTP request we are processing
33   @param response  The HTTP response we are creating
34   */
35   public ActionForward executeAction(ActionMapping mapping,
36                                      ActionForm form,
37                                      HttpServletRequest request,
38                                      HttpServletResponse response)
39     throws ClientException, Exception
40   {
41     // Declare local variables.
42     String action = request.getParameter(ACTION);
43     String filename = null;
44     logger.debug("Action: "+action);
45 
46     if (isNotEmpty(action)
47       && action.equals(XML_UPLOAD)) {
48       filename = request.getParameter(XML_FILE);
49       logger.debug("XML filename: "+filename);
50       if (isEmpty(filename)) {
51         throw new ClientException("File "+filename+" not found.");
52       }
53 
54       try {
55         // Send registration to be processed.
56         // FIXME - cwall 3/30/04
57         // Until the following CR is resolved, XML upload functionality is inactive.
58         // CR175281 dev2dev XMLBeans schema upload produces 500 - "User has no access to upload files"
59         logger.info("***************************");
60         logger.info("Until the following CR is resolved, XML upload functionality is inactive.");
61         logger.info("CR175281 dev2dev XMLBeans schema upload produces 500 - \"User has no access to upload files\"");
62         logger.info("***************************");
63         getAdminSession().processXMLUpload(filename);
64       }
65       catch(Exception e) {
66         throwClientException(e, mapping, "view.import.files");
67       }
68     }
69     return mapping.findForward("confirm.import");
70   }
71 }