1 16 package org.apache.activemq.store.jpa.model; 17 18 import javax.persistence.Basic; 19 import javax.persistence.Entity; 20 import javax.persistence.GeneratedValue; 21 import javax.persistence.GenerationType; 22 import javax.persistence.Id; 23 24 import org.apache.openjpa.persistence.jdbc.Index; 25 26 28 @Entity 29 public class StoredSubscription { 30 31 34 public static class SubscriptionId { 35 36 public String destination; 37 public String clientId; 38 public String subscriptionName; 39 40 public boolean equals(Object other) { 41 if (other == this) 42 return true; 43 if (!(other instanceof SubscriptionId)) 44 return false; 45 46 SubscriptionId sid = (SubscriptionId) other; 47 return (destination == sid.destination || (destination != null && destination.equals(sid.destination))) 48 && (clientId == sid.clientId || (clientId != null && clientId.equals(sid.clientId))) 49 && (subscriptionName == sid.subscriptionName || (subscriptionName != null && subscriptionName.equals(sid.subscriptionName))); 50 } 51 52 55 public int hashCode() { 56 return ((destination == null) ? 0 : destination.hashCode()) 57 ^ ((clientId == null) ? 0 : clientId.hashCode()) 58 ^ ((subscriptionName == null) ? 0 : subscriptionName.hashCode()) 59 ; 60 } 61 62 public String toString() { 63 return destination + ":" + clientId + ":" + subscriptionName; 64 } 65 66 public String getClientId() { 67 return clientId; 68 } 69 70 public void setClientId(String clientId) { 71 this.clientId = clientId; 72 } 73 74 public String getDestination() { 75 return destination; 76 } 77 78 public void setDestination(String destination) { 79 this.destination = destination; 80 } 81 82 public String getSubscriptionName() { 83 return subscriptionName; 84 } 85 86 public void setSubscriptionName(String subscriptionName) { 87 this.subscriptionName = subscriptionName; 88 } 89 } 90 91 @Id 92 @GeneratedValue(strategy=GenerationType.AUTO) 93 private long id; 94 95 @Basic 96 @Index(enabled=true, unique=false) 97 private String destination; 98 @Basic 99 @Index(enabled=true, unique=false) 100 private String clientId; 101 @Basic 102 @Index(enabled=true, unique=false) 103 private String subscriptionName; 104 105 @Basic 106 private long lastAckedId; 107 @Basic 108 private String selector; 109 110 111 public long getLastAckedId() { 112 return lastAckedId; 113 } 114 115 public void setLastAckedId(long lastAckedId) { 116 this.lastAckedId = lastAckedId; 117 } 118 119 public String getSelector() { 120 return selector; 121 } 122 123 public void setSelector(String selector) { 124 this.selector = selector; 125 } 126 127 public String getDestination() { 128 return destination; 129 } 130 131 public void setDestination(String destination) { 132 this.destination = destination; 133 } 134 135 public String getClientId() { 136 return clientId; 137 } 138 139 public void setClientId(String clientId) { 140 this.clientId = clientId; 141 } 142 143 public String getSubscriptionName() { 144 return subscriptionName; 145 } 146 147 public void setSubscriptionName(String subscriptionName) { 148 this.subscriptionName = subscriptionName; 149 } 150 151 public long getId() { 152 return id; 153 } 154 155 public void setId(long id) { 156 this.id = id; 157 } 158 } 159 | Popular Tags |