Change the header to SO
[so.git] / mso-catalog-db / src / main / java / org / openecomp / mso / db / catalog / beans / ServiceToResourceCustomization.java
1 /*-\r
2  * ============LICENSE_START=======================================================\r
3  * ONAP - SO\r
4  * ================================================================================\r
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.\r
6  * ================================================================================\r
7  * Licensed under the Apache License, Version 2.0 (the "License");\r
8  * you may not use this file except in compliance with the License.\r
9  * You may obtain a copy of the License at\r
10  *\r
11  *      http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * Unless required by applicable law or agreed to in writing, software\r
14  * distributed under the License is distributed on an "AS IS" BASIS,\r
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16  * See the License for the specific language governing permissions and\r
17  * limitations under the License.\r
18  * ============LICENSE_END=========================================================\r
19  */\r
20 \r
21 package org.openecomp.mso.db.catalog.beans;\r
22 \r
23 import java.io.Serializable;\r
24 import java.sql.Timestamp;\r
25 import java.text.DateFormat;\r
26 \r
27 public class ServiceToResourceCustomization implements Serializable {\r
28 \r
29         private static final long serialVersionUID = 768026109321305392L;\r
30         \r
31         private String modelType;\r
32         private String serviceModelUUID;\r
33         private Timestamp created;\r
34         private String resourceModelCustomizationUUID;\r
35         \r
36         public ServiceToResourceCustomization() {}\r
37         \r
38         public String getServiceModelUUID() {\r
39                 return serviceModelUUID;\r
40         }\r
41         \r
42         public void setServiceModelUUID(String serviceModelUUID) {\r
43                 this.serviceModelUUID = serviceModelUUID;\r
44         }\r
45         \r
46         public String getModelType() {\r
47                 return modelType;\r
48         }\r
49         \r
50         public void setModelType(String modelType) {\r
51                 this.modelType = modelType;\r
52         }\r
53         \r
54         public Timestamp getCreated() {\r
55                 return created;\r
56         }\r
57         \r
58         public void setCreated(Timestamp created) {\r
59                 this.created = created;\r
60         }\r
61         \r
62         public String getResourceModelCustomizationUUID() {\r
63                 return resourceModelCustomizationUUID;\r
64         }\r
65 \r
66         public void setResourceModelCustomizationUUID(String resourceModelCustomizationUUID) {\r
67                 this.resourceModelCustomizationUUID = resourceModelCustomizationUUID;\r
68         }\r
69         \r
70         @Override\r
71         public boolean equals(Object o) {\r
72         if (!(o instanceof ServiceToResourceCustomization)) {\r
73             return false;\r
74         }\r
75         if (this == o) {\r
76             return true;\r
77         }\r
78         ServiceToResourceCustomization strc = (ServiceToResourceCustomization) o;\r
79         if (strc.getServiceModelUUID().equals(this.getServiceModelUUID()) \r
80                         && strc.getResourceModelCustomizationUUID().equals(this.getResourceModelCustomizationUUID())\r
81                         && strc.getModelType().equals(this.getModelType())) {\r
82             return true;\r
83         }\r
84         return false;\r
85                 \r
86         }\r
87         \r
88         @Override \r
89         public int hashCode() {\r
90                 \r
91                 int code = this.modelType == null ? 0 : this.modelType.hashCode();\r
92                 code += this.serviceModelUUID == null ? 0 : this.serviceModelUUID.hashCode();\r
93                 code += this.resourceModelCustomizationUUID == null ? 0 : this.resourceModelCustomizationUUID.hashCode();\r
94                 \r
95                 return code;\r
96                 \r
97         }\r
98 \r
99         @Override\r
100         public String toString() {\r
101                 StringBuilder sb = new StringBuilder();\r
102                 sb.append("ServiceToResourceCustomization: modelType=" + modelType + ",serviceModelUUID=" + serviceModelUUID+",resourceModelCustomizationUUID="+resourceModelCustomizationUUID);\r
103                 if (created != null) {\r
104                         sb.append (",created=");\r
105                         sb.append (DateFormat.getInstance().format(created));\r
106                 }\r
107                 return sb.toString();\r
108         }\r
109 \r
110 }\r