001 /* 002 * Created on 21-Apr-2004 003 */ 004 package ca.uhn.hl7v2.protocol.impl; 005 006 import ca.uhn.hl7v2.protocol.ApplicationRouter; 007 008 /** 009 * A default implementation of <code>ApplicationRouter.AppRoutingData</code>. 010 * 011 * @author <a href="mailto:bryan.tripp@uhn.on.ca">Bryan Tripp</a> 012 * @version $Revision: 1.1 $ updated on $Date: 2007/02/19 02:24:26 $ by $Author: jamesagnew $ 013 */ 014 public class AppRoutingDataImpl implements ApplicationRouter.AppRoutingData { 015 016 private final String myMessageType; 017 private final String myTriggerEvent; 018 private final String myProcessingId; 019 private final String myVersionId; 020 021 /** 022 * Creates a new instance with args used as values that will be returned 023 * by the corresponding getters. 024 * 025 * @param theMessageType 026 * @param theTriggerEvent 027 * @param theProcessingId 028 * @param theVersionId 029 */ 030 public AppRoutingDataImpl(String theMessageType, String theTriggerEvent, 031 String theProcessingId, String theVersionId) { 032 myMessageType = theMessageType; 033 myTriggerEvent = theTriggerEvent; 034 myProcessingId = theProcessingId; 035 myVersionId = theVersionId; 036 } 037 038 /** 039 * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getMessageType() 040 */ 041 public String getMessageType() { 042 return myMessageType; 043 } 044 045 /** 046 * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getTriggerEvent() 047 */ 048 public String getTriggerEvent() { 049 return myTriggerEvent; 050 } 051 052 /** 053 * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getProcessingId() 054 */ 055 public String getProcessingId() { 056 return myProcessingId; 057 } 058 059 /** 060 * @see ca.uhn.hl7v2.protocol.ApplicationRouter.AppRoutingData#getVersion() 061 */ 062 public String getVersion() { 063 return myVersionId; 064 } 065 066 public boolean equals(Object o) { 067 boolean result = false; 068 if (o instanceof AppRoutingDataImpl) { 069 AppRoutingDataImpl that = (AppRoutingDataImpl) o; 070 if (this.getMessageType() == that.getMessageType() 071 && this.getTriggerEvent() == that.getTriggerEvent() 072 && this.getProcessingId() == that.getProcessingId() 073 && this.getVersion() == that.getVersion()) { 074 075 result = true; 076 } 077 } 078 return result; 079 } 080 081 public int hashCode() { 082 return getMessageType().hashCode() 083 + getTriggerEvent().hashCode() 084 + getProcessingId().hashCode() 085 + getVersion().hashCode(); 086 } 087 088 }