Advertisement
rahul0611

getting error

Aug 10th, 2011
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. package org.openmrs.module.basicmodule.web.controller;
  2.  
  3. import java.util.HashMap;
  4. import java.util.Map;
  5.  
  6. import javax.servlet.http.HttpServletRequest;
  7.  
  8. import org.apache.commons.logging.Log;
  9. import org.apache.commons.logging.LogFactory;
  10. import org.openmrs.module.basicmodule.HL7PIXPDQService;
  11. import org.springframework.stereotype.Controller;
  12. import org.springframework.web.bind.annotation.RequestMapping;
  13.  
  14. import ca.uhn.hl7v2.HL7Exception;
  15. import ca.uhn.hl7v2.model.Message;
  16. import ca.uhn.hl7v2.parser.GenericParser;
  17. import ca.uhn.hl7v2.parser.Parser;
  18.  
  19. @Controller
  20. public class PDQResponseController {
  21. private String submit = null;
  22.  
  23. /** Logger for this class and subclasses */
  24.  
  25. protected final Log log = LogFactory.getLog(getClass());
  26.  
  27. /** Success form view name */
  28. private final String SUCCESS_FORM_VIEW = "module/pixpdq/responseofpdqform.form";
  29.  
  30. /**
  31. * Initially called after the formBackingObject method to get the landing
  32. * form name
  33. *
  34. * @return String form view name
  35. */
  36.  
  37. /**
  38. * This class returns the form backing object. This can be a string, a
  39. * boolean, or a normal java pojo. The bean name defined in the
  40. * ModelAttribute annotation and the type can be just defined by the return
  41. * type of this method
  42. */
  43.  
  44.  
  45.  
  46. // @Override
  47. // protected Map<String, Object> referenceData(HttpServletRequest req)
  48. // throws Exception {
  49. // Map<String, Object> map = new HashMap<String, Object>();
  50. //
  51. // String resp;
  52. //
  53. // String Message = req.getParameter("messageInput");
  54. //
  55. // HL7PIXPDQService hl7serv = org.openmrs.api.context.Context
  56. // .getService(HL7PIXPDQService.class);
  57. //
  58. // Message m3 = null;
  59. //
  60. // m3 = hl7serv.processMessage(Message);
  61. //
  62. // Parser p2 = new GenericParser();
  63. //
  64. // resp = p2.encode(m3);
  65. //
  66. // map.put("msg", resp);
  67. //
  68. // return map;
  69. // }
  70.  
  71. @RequestMapping(value = "module/pixpdq/responseofpdqform.form")
  72. public Map<String, Object> onSubmit(HttpServletRequest request) throws HL7Exception{
  73. Map<String, Object> map = new HashMap<String, Object>();
  74.  
  75. String resp;
  76.  
  77. String Message = request.getParameter("messageInput");
  78.  
  79. HL7PIXPDQService hl7serv = org.openmrs.api.context.Context
  80. .getService(HL7PIXPDQService.class);
  81.  
  82. Message m3 = null;
  83.  
  84. m3 = hl7serv.processMessage(Message);
  85.  
  86. Parser p2 = new GenericParser();
  87.  
  88. resp = p2.encode(m3);
  89.  
  90. map.put("msg", resp);
  91.  
  92. return map;
  93.  
  94.  
  95.  
  96. }
  97. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement