This project has retired. For details please refer to its Attic page.
Subscription xref
View Javadoc
1   package org.apache.juddi.model;
2   /*
3    * Copyright 2001-2008 The Apache Software Foundation.
4    * 
5    * Licensed under the Apache License, Version 2.0 (the "License");
6    * you may not use this file except in compliance with the License.
7    * You may obtain a copy of the License at
8    * 
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   * 
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  
18  import java.util.ArrayList;
19  import java.util.Date;
20  import java.util.List;
21  
22  import javax.persistence.CascadeType;
23  import javax.persistence.Column;
24  import javax.persistence.Entity;
25  import javax.persistence.FetchType;
26  import javax.persistence.Id;
27  import javax.persistence.Lob;
28  import javax.persistence.OneToMany;
29  import javax.persistence.Table;
30  import javax.persistence.Temporal;
31  import javax.persistence.TemporalType;
32  
33  /**
34   * @author <a href="mailto:kurt@apache.org">Kurt T Stam</a>
35   * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
36   */
37  @Entity
38  @Table(name = "j3_subscription")
39  public class Subscription implements java.io.Serializable, Comparable<Subscription> {
40  
41  	private static final long serialVersionUID = -2271361594186854662L;
42  	private String subscriptionKey;
43  	private String authorizedName;
44  	private String subscriptionFilter;
45  	private String bindingKey;
46  	private String notificationInterval;
47  	private Integer maxEntities;
48  	private Date expiresAfter;
49  	private Boolean brief;
50  	private Date lastNotified;
51  	private Date createDate;
52  	private List<SubscriptionMatch> subscriptionMatches = new ArrayList<SubscriptionMatch>(0);
53  
54  	public Subscription() {
55  	}
56  
57  	public Subscription(String subscriptionKey, String bindingKey,
58  			String notificationInterval) {
59  		this.subscriptionKey = subscriptionKey;
60  		this.bindingKey = bindingKey;
61  		this.notificationInterval = notificationInterval;
62  	}
63  
64  	@Id
65  	@Column(name = "subscription_key", nullable = false, length = 255)
66  	public String getSubscriptionKey() {
67  		return this.subscriptionKey;
68  	}
69  	public void setSubscriptionKey(String subscriptionKey) {
70  		this.subscriptionKey = subscriptionKey;
71  	}
72  
73  	@Column(name = "authorized_name", nullable = false, length = 255)
74  	public String getAuthorizedName() {
75  		return authorizedName;
76  	}
77  	public void setAuthorizedName(String authorizedName) {
78  		this.authorizedName = authorizedName;
79  	}
80  
81  	@Lob
82  	@Column(name = "subscription_filter", nullable = false, length = 65636)
83  	public String getSubscriptionFilter() {
84  		return subscriptionFilter;
85  	}
86  	public void setSubscriptionFilter(String subscriptionFilter) {
87  		this.subscriptionFilter = subscriptionFilter;
88  	}
89  	
90  	@Column(name = "binding_key", length = 255)
91  	public String getBindingKey() {
92  		return this.bindingKey;
93  	}
94  	public void setBindingKey(String bindingKey) {
95  		this.bindingKey = bindingKey;
96  	}
97  
98  	@Column(name = "notification_interval")
99  	public String getNotificationInterval() {
100 		return this.notificationInterval;
101 	}
102 	public void setNotificationInterval(String notificationInterval) {
103 		this.notificationInterval = notificationInterval;
104 	}
105 
106 	@Column(name = "max_entities")
107 	public Integer getMaxEntities() {
108 		return maxEntities;
109 	}
110 	public void setMaxEntities(Integer maxEntities) {
111 		this.maxEntities = maxEntities;
112 	}
113 
114 	@Temporal(TemporalType.TIMESTAMP)
115 	@Column(name = "expires_after", length = 29)
116 	public Date getExpiresAfter() {
117 		return expiresAfter;
118 	}
119 	public void setExpiresAfter(Date expiresAfter) {
120 		this.expiresAfter = expiresAfter;
121 	}
122 
123 	@Column(name = "brief")
124 	public Boolean isBrief() {
125 		return brief;
126 	}
127 	public void setBrief(Boolean brief) {
128 		this.brief = brief;
129 	}
130 
131 	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "subscription")
132 	public List<SubscriptionMatch> getSubscriptionMatches() {
133 		return subscriptionMatches;
134 	}
135 	public void setSubscriptionMatches(List<SubscriptionMatch> subscriptionMatches) {
136 		this.subscriptionMatches = subscriptionMatches;
137 	}
138 
139 	@Temporal(TemporalType.TIMESTAMP)
140 	@Column(name = "last_notified", length = 29)
141 	public Date getLastNotified() {
142 		return lastNotified;
143 	}
144 
145 	public void setLastNotified(Date lastNotified) {
146 		this.lastNotified = lastNotified;
147 	}
148 
149 	@Temporal(TemporalType.TIMESTAMP)
150 	@Column(name = "create_date", length = 29, nullable = false)
151 	public Date getCreateDate() {
152 		return createDate;
153 	}
154 
155 	public void setCreateDate(Date createDate) {
156 		this.createDate = createDate;
157 	}
158 
159 	public int compareTo(Subscription o) {
160 		if (o==null || o.getSubscriptionKey()==null) return 0;
161 		if (o.getSubscriptionKey().equals(getSubscriptionKey())) return 1;
162 		else return 0;
163 	}
164 }