This project has retired. For details please refer to its Attic page.
PublisherAssertionId 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 javax.persistence.Column;
19  import javax.persistence.Embeddable;
20  
21  /**
22   * @author <a href="mailto:kurt@apache.org">Kurt T Stam</a>
23   */
24  @Embeddable
25  public class PublisherAssertionId implements java.io.Serializable {
26  
27  	private static final long serialVersionUID = -8329568181003010492L;
28  	private String fromKey;
29  	private String toKey;
30  
31  	public PublisherAssertionId() {
32  	}
33  
34  	public PublisherAssertionId(String fromKey, String toKey) {
35  		this.fromKey = fromKey;
36  		this.toKey = toKey;
37  	}
38  
39  	@Column(name = "from_key", nullable = false, length = 255)
40  	public String getFromKey() {
41  		return this.fromKey;
42  	}
43  
44  	public void setFromKey(String fromKey) {
45  		this.fromKey = fromKey;
46  	}
47  
48  	@Column(name = "to_key", nullable = false, length = 255)
49  	public String getToKey() {
50  		return this.toKey;
51  	}
52  
53  	public void setToKey(String toKey) {
54  		this.toKey = toKey;
55  	}
56  
57  	public boolean equals(Object other) {
58  		if ((this == other))
59  			return true;
60  		if ((other == null))
61  			return false;
62  		if (!(other instanceof PublisherAssertionId))
63  			return false;
64  		PublisherAssertionId castOther = (PublisherAssertionId) other;
65  
66  		return ((this.getFromKey() == null ? castOther.getFromKey() == null : this.getFromKey().equals(castOther.getFromKey())) || (this
67  				.getFromKey() != null
68  				&& castOther.getFromKey() != null && this.getFromKey().equals(
69  				castOther.getFromKey())))
70  				&& ((this.getToKey() == null ? castOther.getToKey() == null : this.getToKey().equals(castOther.getToKey())) || (this
71  						.getToKey() != null
72  						&& castOther.getToKey() != null && this.getToKey()
73  						.equals(castOther.getToKey())));
74  	}
75  
76  	public int hashCode() {
77  		int result = 17;
78  
79  		result = 37 * result
80  				+ (getFromKey() == null ? 0 : this.getFromKey().hashCode());
81  		result = 37 * result
82  				+ (getToKey() == null ? 0 : this.getToKey().hashCode());
83  		return result;
84  	}
85  
86  }