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.xml.MedRecXMLProcessor;
06 import java.util.Collection;
07 import javax.servlet.http.HttpServletRequest;
08 import javax.servlet.http.HttpServletResponse;
09 import org.apache.struts.action.ActionForm;
10 import org.apache.struts.action.ActionForward;
11 import org.apache.struts.action.ActionMapping;
12
13 /**
14 * <p>Controller that retrieves all pending XML medical records.</p>
15 *
16 * @author Copyright (c) 2006 by BEA Systems. All Rights Reserved.
17 */
18 public class ViewImportRecordsAction extends AdminBaseAction {
19
20 /**
21 * <p>Process the specified HTTP request, and create the corresponding HTTP
22 * response (or forward to another web component that will create it).
23 * Return an <code>ActionForward</code> instance describing where and how
24 * control should be forwarded.
25 * <br>
26 * View pending incoming XML medical records..
27 * </p>
28 *
29 * @param mapping The ActionMapping used to select this instance
30 * @param form The optional ActionForm bean for this request (if any)
31 * @param request The HTTP request we are processing
32 * @param response The HTTP response we are creating
33 */
34 public ActionForward executeAction(ActionMapping mapping,
35 ActionForm form,
36 HttpServletRequest request,
37 HttpServletResponse response)
38 throws ClientException, Exception {
39 Collection<Object> xmlFiles = null;
40 Collection<Object> importBeans = null;
41 MedRecXMLProcessor xmlProcessor = null;
42
43 try {
44 // Get XML processor, then all pending xml files.
45 xmlProcessor = MedRecXMLProcessor.getInstance();
46 xmlFiles = xmlProcessor.getIncomingXMLFiles();
47 importBeans = BeanHelper.toImportBeanCollection(xmlFiles);
48 } catch (Exception e) {
49 throwClientException(e, mapping, "home");
50 }
51 // Set on request to be display by view.
52 request.setAttribute(IMPORT_BEANS, importBeans);
53
54 return mapping.findForward("view.import.files");
55 }
56 }
|