Sync Integ to Master
[sdc.git] / common-be / src / main / java / org / openecomp / sdc / be / datatypes / components / ServiceMetadataDataDefinition.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.sdc.be.datatypes.components;
22
23 import java.io.Serializable;
24
25 public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition implements Serializable {
26
27         /**
28          * 
29          */
30         private static final long serialVersionUID = -7661001892509435120L;
31         public static final String EMPTY_STR = "";
32
33         private String distributionStatus;
34         private String serviceType;
35         private String serviceRole;
36
37         private Boolean ecompGeneratedNaming = true;
38
39         private String namingPolicy = EMPTY_STR;
40
41         private String environmentContext;
42
43         public ServiceMetadataDataDefinition() {
44                 super();
45                 serviceType = "";
46                 serviceRole = "";
47         }
48
49         public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) {
50                 super(other);
51                 serviceType = other.getServiceType();
52                 serviceRole = other.getServiceRole();
53         }
54
55         public String getDistributionStatus() {
56                 return distributionStatus;
57         }
58
59         public void setDistributionStatus(String distributionStatus) {
60                 this.distributionStatus = distributionStatus;
61         }
62         
63         public String getServiceType(){
64                 return serviceType;
65         }
66         
67         public void setServiceType(String serviceType){
68                 this.serviceType = serviceType;
69         }
70
71         public String getServiceRole(){
72                 return serviceRole;
73         }
74
75         public void setServiceRole(String serviceRole){
76                 this.serviceRole = serviceRole;
77         }
78
79         public Boolean isEcompGeneratedNaming() {
80                 return ecompGeneratedNaming;
81         }
82
83         public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
84                 this.ecompGeneratedNaming = ecompGeneratedNaming;
85         }
86
87         public String getNamingPolicy() {
88                 return namingPolicy;
89         }
90
91         public void setNamingPolicy(String namingPolicy) {
92                 this.namingPolicy = namingPolicy;
93         }
94
95         public String getEnvironmentContext() { return environmentContext;  }
96
97         public void setEnvironmentContext(String environmentContext) { this.environmentContext = environmentContext;  }
98
99         @Override
100         public String toString() {
101                 return "ServiceMetadataDataDefinition{" +
102                                 "distributionStatus='" + distributionStatus + '\'' +
103                                 ", serviceType='" + serviceType + '\'' +
104                                 ", serviceRole='" + serviceRole + '\'' +
105                                 ", ecompGeneratedNaming=" + ecompGeneratedNaming +
106                                 ", namingPolicy='" + namingPolicy + '\'' +
107                                 ", environmentContext='" + environmentContext + '\'' +
108                                 '}';
109         }
110
111         @Override
112         public int hashCode() {
113                 final int prime = 31;
114                 int result = super.hashCode();
115                 result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode());
116                 result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode());
117                 result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode());
118                 result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
119                 result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode());
120                 result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode());
121                 return result;
122         }
123
124         @Override
125         public boolean equals(Object obj) {
126                 if (this == obj)
127                         return true;
128                 if (obj == null)
129                         return false;
130                 if (!(obj instanceof ComponentMetadataDataDefinition)) {
131                         return false;
132                 }
133                 if (!super.equals(obj)) {
134                         return false;
135                 }
136                 if (getClass() != obj.getClass())
137                         return false;
138                 ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj;
139                 if (distributionStatus == null) {
140                         if (other.distributionStatus != null)
141                                 return false;
142                 } else if (!distributionStatus.equals(other.distributionStatus))
143                         return false;
144                 if (ecompGeneratedNaming == null) {
145                         if (other.ecompGeneratedNaming != null)
146                                 return false;
147                 } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming))
148                         return false;
149                 if (namingPolicy == null) {
150                         if (other.namingPolicy != null)
151                                 return false;
152                 } else if (!namingPolicy.equals(other.namingPolicy))
153                         return false;
154                 if (serviceType == null){
155                         if (other.serviceType != null)
156                                 return false;
157                 } else if (!serviceType.equals(other.serviceType))
158                         return false;
159                 if (serviceRole == null){
160                         if (other.serviceRole != null)
161                                 return false;
162                 } else if (!serviceRole.equals(other.serviceRole))
163                         return false;
164                 if (environmentContext == null){
165                         if (other.environmentContext != null)
166                                 return false;
167                 } else if (!environmentContext.equals(other.environmentContext))
168                         return false;
169                 return super.equals(obj);
170         }
171
172         @Override
173         public String getActualComponentType() {
174
175                 return  componentType.getValue();
176         }
177
178 }