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