KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > activemq > store > jpa > model > StoredSubscription


1 /*
2  * Copyright 2006 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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 /**
27  */

28 @Entity
29 public class StoredSubscription {
30         
31     /**
32      * Application identity class for Magazine.
33      */

34     public static class SubscriptionId {
35
36         public String JavaDoc destination;
37         public String JavaDoc clientId;
38         public String JavaDoc subscriptionName;
39
40         public boolean equals(Object JavaDoc 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         /**
53          * Hashcode must also depend on identity values.
54          */

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 JavaDoc toString() {
63             return destination + ":" + clientId + ":" + subscriptionName;
64         }
65
66         public String JavaDoc getClientId() {
67             return clientId;
68         }
69
70         public void setClientId(String JavaDoc clientId) {
71             this.clientId = clientId;
72         }
73
74         public String JavaDoc getDestination() {
75             return destination;
76         }
77
78         public void setDestination(String JavaDoc destination) {
79             this.destination = destination;
80         }
81
82         public String JavaDoc getSubscriptionName() {
83             return subscriptionName;
84         }
85
86         public void setSubscriptionName(String JavaDoc 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 JavaDoc destination;
98     @Basic
99     @Index(enabled=true, unique=false)
100     private String JavaDoc clientId;
101     @Basic
102     @Index(enabled=true, unique=false)
103     private String JavaDoc subscriptionName;
104     
105     @Basic
106     private long lastAckedId;
107     @Basic
108     private String JavaDoc 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 JavaDoc getSelector() {
120         return selector;
121     }
122
123     public void setSelector(String JavaDoc selector) {
124         this.selector = selector;
125     }
126
127     public String JavaDoc getDestination() {
128         return destination;
129     }
130
131     public void setDestination(String JavaDoc destination) {
132         this.destination = destination;
133     }
134
135     public String JavaDoc getClientId() {
136         return clientId;
137     }
138
139     public void setClientId(String JavaDoc clientId) {
140         this.clientId = clientId;
141     }
142
143     public String JavaDoc getSubscriptionName() {
144         return subscriptionName;
145     }
146
147     public void setSubscriptionName(String JavaDoc 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