View Javadoc
1   /*
2    * Copyright 2001-2008 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   */
17  package org.apache.juddi.model;
18  
19  import javax.persistence.Column;
20  import javax.persistence.Embeddable;
21  
22  /**
23   * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
24   */
25  
26  
27  @Embeddable
28  public class ServiceProjectionId implements java.io.Serializable {
29  	
30  	private static final long serialVersionUID = 3146022787279005205L;
31  	@Column(name = "business_key", nullable = false, length = 255)
32  	String businessKey;
33  	@Column(name = "service_key", nullable = false, length = 255)
34  	String serviceKey;
35  	
36  	public ServiceProjectionId() {
37  	}
38  	public ServiceProjectionId(String businessKey, String serviceKey) {
39  		this.businessKey = businessKey;
40  		this.serviceKey = serviceKey;
41  	}
42  
43  	public int hashCode() {
44  		final int prime = 31;
45  		int result = 1;
46  		result = prime * result
47  				+ ((businessKey == null) ? 0 : businessKey.hashCode());
48  		result = prime * result
49  				+ ((serviceKey == null) ? 0 : serviceKey.hashCode());
50  		return result;
51  	}
52  	public boolean equals(Object obj) {
53  		if (this == obj)
54  			return true;
55  		if (obj == null)
56  			return false;
57  		if (getClass() != obj.getClass())
58  			return false;
59  		ServiceProjectionId other = (ServiceProjectionId) obj;
60  		if (businessKey == null) {
61  			if (other.businessKey != null)
62  				return false;
63  		} else if (!businessKey.equals(other.businessKey))
64  			return false;
65  		if (serviceKey == null) {
66  			if (other.serviceKey != null)
67  				return false;
68  		} else if (!serviceKey.equals(other.serviceKey))
69  			return false;
70  		return true;
71  	}
72  	
73  }