Coverage Report - ca.uhn.hl7v2.protocol.impl.AppRoutingDataImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
AppRoutingDataImpl
39%
11/28
2%
1/36
3.5
 
 1  
 /*
 2  
  * Created on 21-Apr-2004
 3  
  */
 4  
 package ca.uhn.hl7v2.protocol.impl;
 5  
 
 6  
 import ca.uhn.hl7v2.protocol.ApplicationRouter;
 7  
 import ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData;
 8  
 
 9  
 /**
 10  
  * A default implementation of <code>ApplicationRouter.AppRoutingData</code>. 
 11  
  * 
 12  
  * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a>
 13  
  * @version $Revision: 1.1 $ updated on $Date: 2007-02-19 02:24:26 $ by $Author: jamesagnew $
 14  
  */
 15  
 public class AppRoutingDataImpl implements ApplicationRouter.AppRoutingData {
 16  
 
 17  
     private final String myMessageType;
 18  
     private final String myTriggerEvent;
 19  
     private final String myProcessingId;
 20  
     private final String myVersionId;
 21  
      
 22  
     /**
 23  
      * Creates a new instance with args used as values that will be returned 
 24  
      * by the corresponding getters.
 25  
      */
 26  
     public AppRoutingDataImpl(String theMessageType, String theTriggerEvent, 
 27  998
                 String theProcessingId, String theVersionId) {
 28  998
         myMessageType = theMessageType;
 29  998
         myTriggerEvent = theTriggerEvent;
 30  998
         myProcessingId = theProcessingId;
 31  998
         myVersionId = theVersionId;
 32  998
     }
 33  
 
 34  
     /**
 35  
      * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getMessageType()
 36  
      */
 37  
     public String getMessageType() {
 38  1256
         return myMessageType;
 39  
     }
 40  
 
 41  
     /**
 42  
      * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getTriggerEvent()
 43  
      */
 44  
     public String getTriggerEvent() {
 45  1206
         return myTriggerEvent;
 46  
     }
 47  
 
 48  
     /** 
 49  
      * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getProcessingId()
 50  
      */
 51  
     public String getProcessingId() {
 52  1126
         return myProcessingId;
 53  
     }
 54  
 
 55  
     /** 
 56  
      * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getVersion()
 57  
      */
 58  
     public String getVersion() {
 59  1096
         return myVersionId;
 60  
     }
 61  
 
 62  
     @Override
 63  
     public boolean equals(Object o) {
 64  10
         if (this == o) return true;
 65  0
         if (!(o instanceof AppRoutingDataImpl)) return false;
 66  
 
 67  0
         AppRoutingDataImpl that = (AppRoutingDataImpl) o;
 68  
 
 69  0
         if (myMessageType != null ? !myMessageType.equals(that.myMessageType) : that.myMessageType != null)
 70  0
             return false;
 71  0
         if (myProcessingId != null ? !myProcessingId.equals(that.myProcessingId) : that.myProcessingId != null)
 72  0
             return false;
 73  0
         if (myTriggerEvent != null ? !myTriggerEvent.equals(that.myTriggerEvent) : that.myTriggerEvent != null)
 74  0
             return false;
 75  0
         if (myVersionId != null ? !myVersionId.equals(that.myVersionId) : that.myVersionId != null)
 76  0
             return false;
 77  
 
 78  0
         return true;
 79  
     }
 80  
 
 81  
     @Override
 82  
     public int hashCode() {
 83  0
         int result = myMessageType != null ? myMessageType.hashCode() : 0;
 84  0
         result = 31 * result + (myTriggerEvent != null ? myTriggerEvent.hashCode() : 0);
 85  0
         result = 31 * result + (myProcessingId != null ? myProcessingId.hashCode() : 0);
 86  0
         result = 31 * result + (myVersionId != null ? myVersionId.hashCode() : 0);
 87  0
         return result;
 88  
     }
 89  
 
 90  
     /**
 91  
      * Returns an instance of AppRoutingData which accepts all
 92  
      * message types, versions, etc.
 93  
      */
 94  
         public static AppRoutingData withAll() {
 95  0
                 return new AppRoutingDataImpl("*","*", "*", "*");
 96  
         }
 97  
 
 98  
 }