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.EmbeddedId;
20  import javax.persistence.Entity;
21  import javax.persistence.JoinColumn;
22  import javax.persistence.ManyToOne;
23  import javax.persistence.Table;
24  
25  /**
26   * @author <a href="mailto:jfaath@apache.org">Jeff Faath</a>
27   */
28  @Entity
29  @Table(name = "j3_service_projection")
30  public class ServiceProjection implements java.io.Serializable {
31  		
32  		private static final long serialVersionUID = -8404899558507142913L;
33  		@EmbeddedId
34  		private ServiceProjectionId id = new ServiceProjectionId();
35  		@ManyToOne
36  		@JoinColumn(name = "business_key", insertable = false, updatable = false)
37  		private BusinessEntity businessEntity;
38  		@ManyToOne
39  		@JoinColumn(name = "service_key", insertable = false, updatable = false)
40  		private BusinessService businessService;
41  		
42  		public ServiceProjection() {
43  		}
44  		
45  		public ServiceProjection(BusinessEntity businessEntity, BusinessService businessService) {
46  			this.businessEntity = businessEntity;
47  			this.businessService = businessService;
48  			
49  			this.id.businessKey = businessEntity.entityKey;
50  			this.id.serviceKey = businessService.entityKey;
51  			
52  			businessEntity.getServiceProjections().add(this);
53  			businessService.getProjectingBusinesses().add(this);
54  		}
55  
56  		public ServiceProjectionId getId() {
57  			return id;
58  		}
59  		public void setId(ServiceProjectionId id) {
60  			this.id = id;
61  		}
62  
63  		public BusinessEntity getBusinessEntity() {
64  			return businessEntity;
65  		}
66  		public void setBusinessEntity(BusinessEntity businessEntity) {
67  			this.businessEntity = businessEntity;
68  		}
69  
70  		public BusinessService getBusinessService() {
71  			return businessService;
72  		}
73  		public void setBusinessService(BusinessService businessService) {
74  			this.businessService = businessService;
75  		}
76  		
77  }