2 * ============LICENSE_START=======================================================
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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=========================================================
21 package org.openecomp.sdc.be.datatypes.components;
23 import org.openecomp.sdc.be.datatypes.enums.JsonPresentationFieldsExtractor;
27 public class ServiceMetadataDataDefinition extends ComponentMetadataDataDefinition {
28 private static final String EMPTY_STR = "";
30 private String distributionStatus;
31 private String serviceType;
32 private String serviceRole;
33 private String instantiationType = EMPTY_STR;
34 private String serviceFunction;
36 private Boolean ecompGeneratedNaming = true;
38 private String namingPolicy = EMPTY_STR;
40 private String environmentContext;
42 public ServiceMetadataDataDefinition() {
50 public ServiceMetadataDataDefinition(ServiceMetadataDataDefinition other) {
52 serviceType = other.getServiceType();
53 serviceRole = other.getServiceRole();
54 serviceFunction = other.getServiceFunction();
57 public ServiceMetadataDataDefinition(JsonPresentationFieldsExtractor extractor){
59 serviceType = extractor.getServiceType();
60 serviceRole = extractor.getServiceRole();
61 serviceFunction = extractor.getServiceFunction();
64 public String getDistributionStatus() {
65 return distributionStatus;
68 public void setDistributionStatus(String distributionStatus) {
69 this.distributionStatus = distributionStatus;
72 public String getServiceType() {
76 public void setServiceType(String serviceType) {
77 this.serviceType = serviceType;
80 public String getServiceRole() {
84 public String getInstantiationType() {
85 return instantiationType;
88 public void setInstantiationType(String instantiationType) {
89 this.instantiationType = instantiationType;
92 public void setServiceRole(String serviceRole) {
93 this.serviceRole = serviceRole;
96 public Boolean isEcompGeneratedNaming() {
97 return ecompGeneratedNaming;
100 public Boolean getEcompGeneratedNaming() {
101 return ecompGeneratedNaming;
104 public void setEcompGeneratedNaming(Boolean ecompGeneratedNaming) {
105 this.ecompGeneratedNaming = ecompGeneratedNaming;
108 public String getNamingPolicy() {
112 public void setNamingPolicy(String namingPolicy) {
113 this.namingPolicy = namingPolicy;
116 public String getEnvironmentContext() {
117 return environmentContext;
120 public void setEnvironmentContext(String environmentContext) {
121 this.environmentContext = environmentContext;
124 public String getServiceFunction() {
125 return serviceFunction;
128 public void setServiceFunction(String serviceFunction) {
129 this.serviceFunction = serviceFunction;
133 public String toString() {
134 return "ServiceMetadataDataDefinition{" +
135 "distributionStatus='" + distributionStatus + '\'' +
136 ", serviceType='" + serviceType + '\'' +
137 ", serviceRole='" + serviceRole + '\'' +
138 ", serviceFunction='" + serviceFunction + '\'' +
139 ", ecompGeneratedNaming=" + ecompGeneratedNaming +
140 ", namingPolicy='" + namingPolicy + '\'' +
141 ", environmentContext='" + environmentContext + '\'' +
142 ", instantiationType='" + instantiationType + '\'' +
147 public int hashCode() {
148 final int prime = 31;
149 int result = super.hashCode();
150 result = prime * result + ((distributionStatus == null) ? 0 : distributionStatus.hashCode());
151 result = prime * result + ((ecompGeneratedNaming == null) ? 0 : ecompGeneratedNaming.hashCode());
152 result = prime * result + ((namingPolicy == null) ? 0 : namingPolicy.hashCode());
153 result = prime * result + ((serviceType == null) ? 0 : serviceType.hashCode());
154 result = prime * result + ((serviceRole == null) ? 0 : serviceRole.hashCode());
155 result = prime * result + ((serviceFunction == null) ? 0 : serviceFunction.hashCode());
156 result = prime * result + ((environmentContext == null) ? 0 : environmentContext.hashCode());
157 result = prime * result + ((instantiationType == null) ? 0 : instantiationType.hashCode());
162 public boolean equals(Object obj) {
169 if (!(obj instanceof ComponentMetadataDataDefinition)) {
172 if (!super.equals(obj)) {
175 if (getClass() != obj.getClass()) {
178 ServiceMetadataDataDefinition other = (ServiceMetadataDataDefinition) obj;
179 if (distributionStatus == null) {
180 if (other.distributionStatus != null) {
183 } else if (!distributionStatus.equals(other.distributionStatus)) {
186 if (ecompGeneratedNaming == null) {
187 if (other.ecompGeneratedNaming != null) {
190 } else if (!ecompGeneratedNaming.equals(other.ecompGeneratedNaming)) {
193 if (namingPolicy == null) {
194 if (other.namingPolicy != null) {
197 } else if (!namingPolicy.equals(other.namingPolicy)) {
200 if (serviceType == null) {
201 if (other.serviceType != null) {
204 } else if (!serviceType.equals(other.serviceType)) {
207 if (serviceRole == null) {
208 if (other.serviceRole != null) {
211 } else if (!serviceRole.equals(other.serviceRole)) {
214 if (environmentContext == null) {
215 if (other.environmentContext != null) {
218 } else if (!environmentContext.equals(other.environmentContext)) {
221 if (instantiationType == null) {
222 if (other.instantiationType != null) {
225 } else if (!instantiationType.equals(other.instantiationType)) {
228 if (serviceFunction == null){
229 if (other.serviceFunction != null) {
231 } else if (!serviceFunction.equals(other.serviceFunction))
234 return super.equals(obj);
238 public String getActualComponentType() {
240 return componentType != null ? componentType.getValue() : "";