Coverage Report - ca.uhn.hl7v2.protocol.impl.AppWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
AppWrapper
77%
7/9
N/A
1.667
 
 1  
 /*
 2  
  * Created on 16-May-2005
 3  
  */
 4  
 package ca.uhn.hl7v2.protocol.impl;
 5  
 
 6  
 import java.util.Map;
 7  
 
 8  
 import ca.uhn.hl7v2.HL7Exception;
 9  
 import ca.uhn.hl7v2.app.Application;
 10  
 import ca.uhn.hl7v2.app.ApplicationException;
 11  
 import ca.uhn.hl7v2.model.Message;
 12  
 import ca.uhn.hl7v2.protocol.ReceivingApplication;
 13  
 import ca.uhn.hl7v2.protocol.ReceivingApplicationException;
 14  
 
 15  
 /**
 16  
  * Wraps a ca.uhn.hl7v2.app.Application as a ca.uhn.hl7v2.protocol.ReceivingApplication. 
 17  
  * ReceivingApplication replaces Application with HAPI 0.5.
 18  
  *  
 19  
  * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
 20  
  * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:26 $ by $Author: jamesagnew $
 21  
  */
 22  
 public class AppWrapper implements ReceivingApplication {
 23  
 
 24  
     private Application myApplication;
 25  
     
 26  
     /**
 27  
      * @param theApplication an Application to wrap as a ReceivingApplication.  
 28  
      */
 29  9
     public AppWrapper(Application theApplication) {
 30  9
         myApplication = theApplication;
 31  9
     }
 32  
 
 33  
     /** 
 34  
      * @see ca.uhn.hl7v2.protocol.ReceivingApplication#processMessage(ca.uhn.hl7v2.model.Message, java.util.Map)
 35  
      */
 36  
     public Message processMessage(Message theMessage, Map<String, Object> theMetadata) 
 37  
             throws ReceivingApplicationException, HL7Exception {
 38  
         Message result;
 39  
         try {
 40  63
             result = myApplication.processMessage(theMessage);
 41  0
         } catch (ApplicationException e) {
 42  0
             throw new ReceivingApplicationException(e);
 43  61
         }
 44  
         
 45  61
         return result;
 46  
     }
 47  
 
 48  
     /** 
 49  
      * @see ca.uhn.hl7v2.protocol.ReceivingApplication#canProcess(ca.uhn.hl7v2.model.Message)
 50  
      */
 51  
     public boolean canProcess(Message theMessage) {
 52  63
         return myApplication.canProcess(theMessage);
 53  
     }
 54  
 
 55  
 }