3babe4ad23eb96db8c444154859d91a3725aef18
[so.git] / mso-catalog-db / src / main / java / org / openecomp / mso / db / catalog / beans / ServiceToResourceCustomization.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.openecomp.mso.db.catalog.beans;
22
23 import java.io.Serializable;
24 import java.sql.Timestamp;
25 import java.text.DateFormat;
26
27 import org.apache.commons.lang3.builder.EqualsBuilder;
28
29 import com.openpojo.business.annotation.BusinessKey;
30
31 public class ServiceToResourceCustomization implements Serializable {
32
33         private static final long serialVersionUID = 768026109321305392L;
34         
35         @BusinessKey
36         private String modelType = null;
37         @BusinessKey
38         private String serviceModelUUID = null;
39         private Timestamp created = null;
40         @BusinessKey
41         private String resourceModelCustomizationUUID = null;
42         
43         public ServiceToResourceCustomization() {}
44         
45         public String getServiceModelUUID() {
46                 return serviceModelUUID;
47         }
48         
49         public void setServiceModelUUID(String serviceModelUUID) {
50                 this.serviceModelUUID = serviceModelUUID;
51         }
52         
53         public String getModelType() {
54                 return modelType;
55         }
56         
57         public void setModelType(String modelType) {
58                 this.modelType = modelType;
59         }
60         
61         public Timestamp getCreated() {
62                 return created;
63         }
64         
65         public void setCreated(Timestamp created) {
66                 this.created = created;
67         }
68         
69         public String getResourceModelCustomizationUUID() {
70                 return resourceModelCustomizationUUID;
71         }
72
73         public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {
74                 this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;
75         }
76         
77
78         @Override
79         public boolean equals (final Object other) {
80                 if (!(other instanceof ServiceToResourceCustomization)) {
81                         return false;
82                 }
83                 ServiceToResourceCustomization castOther = (ServiceToResourceCustomization) other;
84                 return new EqualsBuilder().append(modelType, castOther.modelType)
85                                 .append(serviceModelUUID, castOther.serviceModelUUID)
86                                 .append(resourceModelCustomizationUUID, castOther.resourceModelCustomizationUUID).isEquals();
87         }
88         
89         @Override 
90         public int hashCode() {
91                 
92                 int code = this.modelType == null ? 0 : this.modelType.hashCode();
93                 code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();
94                 code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();
95                 
96                 return code;
97                 
98         }@Override
99         public String toString() {
100                 StringBuilder sb = new StringBuilder();
101                 sb.append("ServiceToResourceCustomization: modelType=").append(modelType).append(",serviceModelUUID=")
102             .append(serviceModelUUID).append(",resourceModelCustomizationUUID=").append(resourceModelCustomizationUUID);
103                 if (created != null) {
104                         sb.append (",created=");
105                         sb.append (DateFormat.getInstance().format(created));
106                 }
107                 return sb.toString();
108         }
109
110 }