Containerization feature of SO
[so.git] / mso-catalog-db / src / main / java / org / onap / so / db / catalog / beans / ExternalServiceToInternalService.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.db.catalog.beans;
22
23 import java.io.Serializable;
24
25 import javax.persistence.Column;
26 import javax.persistence.Entity;
27 import javax.persistence.GeneratedValue;
28 import javax.persistence.GenerationType;
29 import javax.persistence.Id;
30 import javax.persistence.Table;
31
32 import org.apache.commons.lang3.builder.EqualsBuilder;
33 import org.apache.commons.lang3.builder.HashCodeBuilder;
34 import org.apache.commons.lang3.builder.ToStringBuilder;
35
36 import com.openpojo.business.annotation.BusinessKey;
37
38 @Entity
39 @Table(name = "external_service_to_internal_model_mapping")
40 public class ExternalServiceToInternalService implements Serializable {
41
42         /**
43          * 
44          */
45         private static final long serialVersionUID = 3825246668050173010L;
46
47         @Id
48         @Column(name = "Id")
49         @GeneratedValue(strategy = GenerationType.IDENTITY)
50         private Integer id;
51
52         @BusinessKey
53         @Column(name = "SERVICE_NAME")
54         private String serviceName;
55
56         @BusinessKey
57         @Column(name = "PRODUCT_FLAVOR")
58         private String productFlavor;
59
60         @BusinessKey
61         @Column(name = "SUBSCRIPTION_SERVICE_TYPE")
62         private String subscriptionServiceType;
63
64         @BusinessKey
65         @Column(name = "SERVICE_MODEL_UUID")
66         private String serviceModelUUID;
67
68         @Override
69         public boolean equals(final Object other) {
70                 if (!(other instanceof ExternalServiceToInternalService)) {
71                         return false;
72                 }
73                 ExternalServiceToInternalService castOther = (ExternalServiceToInternalService) other;
74                 return new EqualsBuilder().append(serviceName, castOther.serviceName)
75                                 .append(productFlavor, castOther.productFlavor)
76                                 .append(subscriptionServiceType, castOther.subscriptionServiceType)
77                                 .append(serviceModelUUID, castOther.serviceModelUUID).isEquals();
78         }
79
80         @Override
81         public int hashCode() {
82                 return new HashCodeBuilder().append(serviceName).append(productFlavor).append(subscriptionServiceType)
83                                 .append(serviceModelUUID).toHashCode();
84         }
85
86         @Override
87         public String toString() {
88                 return new ToStringBuilder(this).append("id", id).append("serviceName", serviceName)
89                                 .append("productFlavor", productFlavor).append("subscriptionServiceType", subscriptionServiceType)
90                                 .append("serviceModelUUID", serviceModelUUID).toString();
91         }
92
93         public Integer getId() {
94                 return id;
95         }
96
97         public void setId(Integer id) {
98                 this.id = id;
99         }
100
101         public String getServiceName() {
102                 return serviceName;
103         }
104
105         public void setServiceName(String serviceName) {
106                 this.serviceName = serviceName;
107         }
108
109         public String getProductFlavor() {
110                 return productFlavor;
111         }
112
113         public void setProductFlavor(String productFlavor) {
114                 this.productFlavor = productFlavor;
115         }
116
117         public String getSubscriptionServiceType() {
118                 return subscriptionServiceType;
119         }
120
121         public void setSubscriptionServiceType(String subscriptionServiceType) {
122                 this.subscriptionServiceType = subscriptionServiceType;
123         }
124
125         public String getServiceModelUUID() {
126                 return serviceModelUUID;
127         }
128
129         public void setServiceModelUUID(String serviceModelUUID) {
130                 this.serviceModelUUID = serviceModelUUID;
131         }
132 }