Coverage Report - ca.uhn.hl7v2.protocol.ApplicationWrapper
 
Classes in this File Line Coverage Branch Coverage Complexity
ApplicationWrapper
0%
0/7
N/A
2
 
 1  
 package ca.uhn.hl7v2.protocol;
 2  
 
 3  
 import java.util.Map;
 4  
 
 5  
 import ca.uhn.hl7v2.HL7Exception;
 6  
 import ca.uhn.hl7v2.app.Application;
 7  
 import ca.uhn.hl7v2.app.ApplicationException;
 8  
 import ca.uhn.hl7v2.model.Message;
 9  
 
 10  
 /**
 11  
  * Wraps a legacy HAPI {@link Application} to convert it to a new
 12  
  * style {@link ReceivingApplication}
 13  
  */
 14  
 public class ApplicationWrapper implements ReceivingApplication<Message> {
 15  
 
 16  
         private final Application application;
 17  
 
 18  
         /**
 19  
          * Constructor
 20  
          * 
 21  
          * @param theApplication The application to wrap
 22  
          */
 23  0
         public ApplicationWrapper(Application theApplication) {
 24  0
                 this.application = theApplication;
 25  0
         }
 26  
 
 27  
         /**
 28  
          * {@inheritDoc}
 29  
          */
 30  
         public Message processMessage(Message theMessage, Map<String, Object> theMetadata) throws ReceivingApplicationException, HL7Exception {
 31  
                 try {
 32  0
                         return this.application.processMessage(theMessage);
 33  0
                 } catch (ApplicationException e) {
 34  0
                         throw new ReceivingApplicationException(e);
 35  
                 }
 36  
         }
 37  
 
 38  
         /**
 39  
          * {@inheritDoc}
 40  
          */
 41  
         public boolean canProcess(Message theMessage) {
 42  0
                 return this.application.canProcess(theMessage);
 43  
         }
 44  
 
 45  
 }